PageSourceSearch

https://retinart.net/wp-content/themes/uncode/library/js/app.js?ver=1320858034

js retinart.net collected 2026-10-02 09:57:46 UTC 371,220 bytes, 11,616 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.addEventListener('loadedmetadata', function(e) {
2230					$('body').removeClass('video-not-supported');
2231					video_el.play();
2232				});
2233				if ( video_el.currentTime > 0 && video_el.readyState > 2 ) {
2234					video_el.muted = true;
2235					video_el.loop = true;
2236					$(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2237					$(video_el).addClass('started').closest('#page-header').addClass('video-started');
2238					$(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2239					$('body').removeClass('video-not-supported');
2240					video_el.play();
2241				} else {
2242					requestTimeout(function(){
2243                         backgroundSelfVideosInit( $ctx );
2244					}, 1000);
2245				}
2246			});
2247		}
2248	};
2249
2250	backgroundSelfVideosInit( $ctx );
2251
2252	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2253		window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
2254			var $el = model.view.$el,
2255				shortcode = model.attributes.shortcode;
2256
2257			if (typeof MediaElement === "function") {
2258				backgroundSelfVideosInit( $el );
2259			} else {
2260				backgroundSelfVideosInit( $el[0] );
2261			}
2262		});
2263	}
2264};
2265
2266UNCODE.is_scrolling = false;
2267
2268UNCODE.disableHoverScroll = function() {
2269
2270	if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor) {
2271		var body = document.body,
2272		timer;
2273
2274		window.addEventListener('scroll', function() {
2275			var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300;
2276			clearRequestTimeout(timer);
2277			if ( body.classList && !body.classList.contains('disable-hover') ) {
2278				body.classList.add('disable-hover');
2279				window.dispatchEvent(new CustomEvent('disable-hover'));
2280			}
2281			UNCODE.is_scrolling = true;
2282
2283			timer = requestTimeout(function() {
2284				if ( body.classList ) {
2285					body.classList.remove('disable-hover');
2286					window.dispatchEvent(new CustomEvent('enable-hover'));
2287				}
2288				UNCODE.is_scrolling = false;
2289			}, delay);
2290		}, false);
2291	}
2292};
2293
2294UNCODE.isotopeLayout = function() {
2295	if ($('.isotope-layout').length > 0) {
2296		var isotopeContainersArray = [],
2297			typeGridArray = [],
2298			layoutGridArray = [],
2299			screenLgArray = [],
2300			screenMdArray = [],
2301			screenSmArray = [],
2302			transitionDuration = [],
2303			$filterItems = [],
2304			$filters = $('.isotope-system .isotope-filters'),
2305			$itemSelector = '.tmb-iso',
2306			$items,
2307			itemMargin,
2308			correctionFactor = 0,
2309			firstLoad = true,
2310			isOriginLeft = $('body').hasClass('rtl') ? false : true;
2311		$('[class*="isotope-container"]').each(function(index) {
2312			var _this = $(this);
2313			var isoData = _this.data(),
2314			$data_lg,
2315			$data_md,
2316			$data_sm;
2317			_this.children('.tmb').addClass('tmb-iso');
2318			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
2319			else $data_lg = '1000';
2320			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
2321			else $data_md = '600';
2322			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
2323			else $data_sm = '480';
2324			screenLgArray.push($data_lg);
2325			screenMdArray.push($data_md);
2326			screenSmArray.push($data_sm);
2327			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
2328			if (isoData.type == 'metro') typeGridArray.push(true);
2329			else typeGridArray.push(false);
2330			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
2331			else layoutGridArray.push('masonry');
2332			isotopeContainersArray.push(_this);
2333			_this.attr('data-iso-index', index);
2334		});
2335		var colWidth = function(index) {
2336				$(isotopeContainersArray[index]).width('');
2337				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
2338					widthAvailable = $(isotopeContainersArray[index]).width(),
2339					columnNum = 12,
2340					columnWidth = 0,
2341					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
2342					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
2343					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
2344					$rowContainer,
2345					paddingRow,
2346					$colContainer,
2347					paddingCol;
2348
2349				if ( consider_menu )
2350					winHeight = winHeight - UNCODE.menuHeight;
2351
2352				if ( data_vp_height === '1' ) {
2353					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
2354					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
2355					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
2356					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
2357					winHeight = winHeight - ( paddingRow + paddingCol );
2358				}
2359
2360				if (isPx) {
2361					columnWidth = Math.ceil(widthAvailable / columnNum);
2362					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
2363				} else {
2364					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
2365				}
2366				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
2367				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
2368				for (var i = 0, len = $items.length; i < len; i++) {
2369					var $item = $($items[i]),
2370						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
2371						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
2372						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
2373
2374
2375					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
2376						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
2377					}
2378
2379					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
2380						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
2381					}
2382
2383					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
2384						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2385							switch (parseInt(multiplier_w[1])) {
2386								case (5):
2387								case (4):
2388								case (3):
2389									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2390									multiplier_w[1] = 6;
2391									break;
2392								case (2):
2393								case (1):
2394									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
2395									multiplier_w[1] = 3;
2396									break;
2397								default:
2398									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2399									multiplier_w[1] = 12;
2400									break;
2401							}
2402
2403							if (multiplier_w[1] == 2.4) { // 5 columns
2404								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2405								multiplier_w[1] = 6;
2406							}
2407						}
2408					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
2409						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2410							switch (parseInt(multiplier_w[1])) {
2411								case (5):
2412								case (4):
2413								case (3):
2414								case (2):
2415								case (1):
2416									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2417									multiplier_w[1] = 6;
2418									break;
2419								default:
2420									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2421									multiplier_w[1] = 12;
2422									break;
2423							}
2424
2425							if (multiplier_w[1] == 2.4) { // 5 columns
2426								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2427								multiplier_w[1] = 6;
2428							}
2429						}
2430					} else if (widthAvailable < screenSmArray[index]) {
2431						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2432							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2433							multiplier_w[1] = 12;
2434							if (typeGridArray[index]) multiplier_h[1] = 12;
2435						}
2436					}
2437					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
2438						height;
2439
2440					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
2441						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
2442						if ( widthAvailable < screenSmArray[index] ) {
2443							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
2444						}
2445					} else {
2446						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
2447					}
2448
2449					if (width >= widthAvailable) {
2450						$item.css({
2451							width: widthAvailable
2452						});
2453						if (typeGridArray[index]) {
2454							$item.children().add($item.find('.backimg')).css({
2455								height: height
2456							});
2457						}
2458					} else {
2459						$item.css({
2460							width: width
2461						});
2462						if (typeGridArray[index]) {
2463							$item.children().add($item.find('.backimg')).css({
2464								height: height
2465							});
2466						}
2467					}
2468				}
2469				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
2470					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
2471				} else {
2472					return columnWidth;
2473				}
2474			},
2475			init_isotope = function() {
2476				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
2477					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
2478						isotopeId = isotopeSystem.attr('id'),
2479						$layoutMode = layoutGridArray[i],
2480						setIsotopeFirstRowTimeOut,
2481					setIsotopeFirstRow = function(items){
2482						var firstRow = true;
2483						$(items).each(function(index, val){
2484							var el = items[index].element,
2485								el_top = items[index].position.y,
2486								$el = $(el);
2487							if ( index > 0 && el_top > 0 && firstRow ) {
2488								firstRow = false;
2489							} else if ( index == 0 && el_top == 0 ) {
2490								firstRow = true;
2491							}
2492							if ( firstRow ) {
2493								$el.removeClass('tmb-isotope-further-row');
2494							} else {
2495								$el.addClass('tmb-isotope-further-row');
2496							}
2497						});
2498					};
2499					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
2500						//resizable: true,
2501						itemSelector: $itemSelector,
2502						layoutMode: $layoutMode,
2503						transitionDuration: transitionDuration[i],
2504						masonry: {
2505							columnWidth: colWidth(i)
2506						},
2507						vertical: {
2508							horizontalAlignment: 0.5,
2509						},
2510						sortBy: 'original-order',
2511						isOriginLeft: isOriginLeft
2512					})
2513					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
2514					.on('layoutComplete', function( event, items ){
2515						if ( typeof items[0] !== 'undefined' ) {
2516							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
2517								setIsotopeFirstRow(items);
2518							}
2519						}
2520					})
2521					.on('arrangeComplete', function( event, items ){
2522						if ( typeof items[0] !== 'undefined' ) {
2523							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
2524								clearRequestTimeout(setIsotopeFirstRowTimeOut);
2525								setIsotopeFirstRowTimeOut = requestTimeout(function(){
2526									setIsotopeFirstRow(items);
2527								}, 100);
2528							}
2529						}
2530					});
2531					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
2532						$(isotopeContainersArray[i]).infinitescroll({
2533								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
2534								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
2535								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat', // selector for all items you'll retrieve
2536								animate: false,
2537								behavior: 'local',
2538								debug: false,
2539								loading: {
2540									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
2541									speed: 0,
2542									finished: undefined,
2543									msg: $('#' + isotopeId + ' .loadmore-button'),
2544								},
2545								errorCallback: function() {
2546									var isotope_system = $(this).closest('.isotope-system');
2547									$('.loading-button', isotope_system).hide();
2548									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
2549								}
2550							},
2551							// append the new items to isotope on the infinitescroll callback function.
2552							function(newElements, opts) {
2553								var $isotope = $(this),
2554									isotopeId = $isotope.closest('.isotope-system').attr('id'),
2555									filters = new Array(),
2556									$loading_button = $isotope.closest('.isotope-system').find('.loading-button'),
2557									$infinite_button = $isotope.closest('.isotope-system').find('.loadmore-button'),
2558									$numPages = $('a', $infinite_button).data('pages'),
2559									delay = 300;
2560								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
2561								$infinite_button.show();
2562								$loading_button.hide();
2563								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
2564								$('> li', $isotope).remove();
2565								$.each($(newElements), function(index, val) {
2566									$(val).addClass('tmb-iso');
2567									if ($(val).is("li")) {
2568										filters.push($(val)[0]);
2569									}
2570								});
2571								newElements = newElements.filter(function(x) {
2572									return filters.indexOf(x) < 0
2573								});
2574								$.each($(filters), function(index, val) {
2575									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
2576								});
2577								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
2578								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2579									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
2580									if (typeof getLightbox === 'object') {
2581										getLightbox.refresh();
2582									} else {
2583										UNCODE.lightbox();
2584									}
2585								}
2586								if ( typeof twttr !== 'undefined' )
2587									twttr.widgets.load(isotopeContainersArray[i]);
2588
2589								requestTimeout(function() {
2590									Waypoint.refreshAll();
2591									$isotope.trigger('more-items-loaded');
2592									$(window).trigger('more-items-loaded');
2593								}, 1000);
2594
2595							});
2596						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
2597							var $infinite_isotope = $(isotopeContainersArray[i]),
2598								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
2599							$infinite_isotope.infinitescroll('pause');
2600							$infinite_button.on('click', function(event) {
2601								event.preventDefault();
2602								var $infinite_system = $(event.target).closest('.isotope-system'),
2603								$infinite_isotope = $infinite_system.find('.isotope-container'),
2604								isotopeId = $infinite_system.attr('id');
2605								$(event.currentTarget).html(SiteParameters.loading);
2606								$infinite_isotope.infinitescroll('resume');
2607								$infinite_isotope.infinitescroll('retrieve');
2608								$infinite_isotope.infinitescroll('pause');
2609							});
2610						}
2611					}
2612				}
2613			},
2614			onLayout = function(isotopeObj, startIndex, needsReload) {
2615				var needsReload = needsReload ? true : false;
2616
2617				if (typeof UNCODE.bigText !== 'undefined') {
2618					UNCODE.bigText();
2619				}
2620				isotopeObj.css('opacity', 1);
2621				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
2622
2623				requestTimeout(function() {
2624					if (startIndex > 0) {
2625						reloadIsotope(isotopeObj);
2626						if (SiteParameters.dynamic_srcset_active === '1') {
2627							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
2628							UNCODE.adaptive_srcset(isotopeObj);
2629						}
2630						// window.dispatchEvent(UNCODE.boxEvent);
2631					} else if (needsReload) {
2632						reloadIsotope(isotopeObj);
2633					}
2634
2635					UNCODE.adaptive();
2636					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
2637						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
2638					}
2639					if (typeof MediaElement === "function") {
2640						$(isotopeObj).find('audio,video').each(function() {
2641							$(this).mediaelementplayer({
2642	 							pauseOtherPlayers: false,
2643							});
2644						});
2645					}
2646					if ($(isotopeObj).find('.nested-carousel').length) {
2647						if (typeof UNCODE.carousel !== 'undefined') {
2648							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
2649						}
2650						requestTimeout(function() {
2651							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
2652						}, 200);
2653					} else {
2654						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
2655					}
2656					isotopeObj.trigger('isotope-layout-complete');
2657
2658				}, 100);
2659
2660			},
2661			boxAnimation = function(items, startIndex, sequential, container) {
2662				var $allItems = items.length - startIndex,
2663					showed = 0,
2664					index = 0;
2665				if (container.closest('.owl-item').length == 1) return false;
2666				$.each(items, function(index, val) {
2667					var $this = $(val),
2668						elInner = $('> .t-inside', val);
2669					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
2670						return;
2671					}
2672					if (val[0]) val = val[0];
2673					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
2674						new Waypoint({
2675							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
2676							element: val,
2677							handler: function() {
2678								var element = $('> .t-inside', this.element),
2679									parent = $(this.element),
2680									currentIndex = parent.index();
2681								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
2682									delayAttr = parseInt(element.attr('data-delay'));
2683								if (isNaN(delayAttr)) delayAttr = 100;
2684								delay -= showed;
2685								var objTimeout = requestTimeout(function() {
2686									element.removeClass('zoom-reverse').addClass('start_animation');
2687									showed = parent.index();
2688									if ( container.data('isotope') ) {
2689										container.isotope('layout');
2690									}
2691								}, delay * delayAttr)
2692								parent.data('objTimeout', objTimeout);
2693								if (!UNCODE.isUnmodalOpen) {
2694									this.destroy();
2695								}
2696							},
2697							offset: '100%'
2698						})
2699					} else {
2700						if (elInner.hasClass('force-anim')) {
2701							elInner.addClass('start_animation');
2702						} else {
2703							elInner.css('opacity', 1);
2704						}
2705						container.isotope('layout');
2706					}
2707
2708					index++;
2709				});
2710			},
2711			reloadIsotope = function(isotopeObj) {
2712				var isoIndex = $(isotopeObj).attr('data-iso-index');
2713				var $layoutMode = ($(isotopeObj).data('layout'));
2714				if ($layoutMode === undefined) {
2715					$layoutMode = 'masonry';
2716				}
2717				if (isotopeObj.data('isotope')) {
2718					isotopeObj.isotope({
2719						itemSelector: $itemSelector,
2720						layoutMode: $layoutMode,
2721						transitionDuration: transitionDuration[isoIndex],
2722						masonry: {
2723							columnWidth: colWidth(isoIndex)
2724						},
2725						vertical: {
2726							horizontalAlignment: 0.5,
2727						},
2728						sortBy: 'original-order',
2729						isOriginLeft: isOriginLeft
2730					});
2731				}
2732			}
2733			;
2734		if ($('.isotope-pagination').length > 0) {
2735			$('.isotope-system').on('click', '.pagination a', function(evt) {
2736				evt.preventDefault();
2737
2738				if (SiteParameters.index_pagination_disable_scroll !== '1') {
2739					var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
2740						container = $(this).closest('.isotope-system'),
2741						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
2742					calc_scroll -= UNCODE.get_scroll_offset();
2743
2744					var menu_container = $('.menu-sticky');
2745					var menu = menu_container.find('.menu-container');
2746
2747					if (menu_container.length > 0 && menu.length > 0) {
2748						calc_scroll = calc_scroll - menu.outerHeight();
2749					}
2750
2751					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
2752						delta = bodyTop - calc_scroll,
2753						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
2754					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
2755
2756					if (!UNCODE.isFullPage) {
2757						if (scrollSpeed == 0) {
2758							$('html, body').scrollTop(calc_scroll);
2759						} else {
2760							$('html, body').animate({
2761								scrollTop: calc_scroll
2762							}, {
2763								easing: 'easeInOutQuad',
2764								duration: scrollSpeed,
2765								complete: function () {
2766									UNCODE.scrolling = false;
2767								}
2768							});
2769						}
2770					}
2771				}
2772
2773				loadIsotope($(this), true);
2774			});
2775		}
2776		$filters.on('click', 'a.isotope-nav-link', function(evt) {
2777			if ($(this).hasClass('no-isotope-filter')) {
2778				return;
2779			}
2780			var $filter = $(this),
2781				filterContainer = $filter.closest('.isotope-filters'),
2782				filterValue = $filter.attr('data-filter'),
2783				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
2784				transitionDuration = container.data().isotope.options.transitionDuration,
2785				delay = 300,
2786				filterItems = [];
2787
2788			var filter_items = function(){
2789				if (filterValue !== undefined) {
2790					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
2791						var parent = $(val).parent(),
2792							objTimeout = parent.data('objTimeout');
2793						if (objTimeout) {
2794							$(val).removeClass('zoom-reverse').removeClass('start_animation')
2795							clearRequestTimeout(objTimeout);
2796						}
2797						if (transitionDuration == 0) {
2798							if ($(val).hasClass('animate_when_almost_visible')) {
2799								$(val).addClass('zoom-reverse').removeClass('start_animation');
2800							} else {
2801								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
2802							}
2803						}
2804					});
2805					requestTimeout(function(){
2806						if ( filterValue == '*' ) {
2807							container.removeClass('isotope-filtered');
2808						} else {
2809							container.addClass('isotope-filtered');
2810						}
2811						container.isotope({
2812							filter: function() {
2813								var block = $(this),
2814								filterable = (filterValue == '*') || block.hasClass(filterValue),
2815								lightboxElements = $('[data-lbox^=ilightbox]', block);
2816								if (filterable) {
2817									if (lightboxElements.length) {
2818										lightboxElements.removeClass('lb-disabled');
2819										container.data('lbox', $(lightboxElements[0]).data('lbox'));
2820									}
2821									filterItems.push(block);
2822								} else {
2823									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
2824								}
2825								container.trigger('more-items-loaded');
2826								$(window).trigger('more-items-loaded');
2827								return filterable;
2828							}
2829						});
2830						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
2831
2832					}, delay);
2833
2834					/** once filtered - start **/
2835					container.isotope('once', 'arrangeComplete', function() {
2836						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2837							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
2838							if (typeof getLightbox === 'object') {
2839								getLightbox.refresh();
2840							} else {
2841								UNCODE.lightbox();
2842							}
2843						}
2844						if (transitionDuration == 0) {
2845							requestTimeout(function() {
2846								boxAnimation(filterItems, 0, false, container);
2847							}, 100);
2848						}
2849						requestTimeout(function() {
2850							Waypoint.refreshAll();
2851						}, 2000);
2852					});
2853					/** once filtered - end **/
2854				} else {
2855					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2856						$.each(UNCODE.lightboxArray, function(index, val) {
2857							UNCODE.lightboxArray[index].destroy();
2858						});
2859					}
2860					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
2861						var parent = $(val).parent(),
2862							objTimeout = parent.data('objTimeout');
2863						if (objTimeout) {
2864							$(val).removeClass('zoom-reverse').removeClass('start_animation')
2865							clearRequestTimeout(objTimeout);
2866						}
2867						if (transitionDuration == 0) {
2868							if ($(val).hasClass('animate_when_almost_visible')) {
2869								$(val).addClass('zoom-reverse').removeClass('start_animation');
2870							} else {
2871								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
2872							}
2873						}
2874					});
2875					container.parent().addClass('grid-loading');
2876					loadIsotope($filter);
2877				}
2878			};
2879
2880			if (!$filter.hasClass('active')) {
2881				/** Scroll top with filtering */
2882				if (filterContainer.hasClass('filter-scroll')) {
2883                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
2884                    calc_scroll -= UNCODE.get_scroll_offset();
2885
2886					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
2887						delta = bodyTop - calc_scroll,
2888						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
2889						filterTolerance = false,
2890						filter_timeout;
2891					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
2892
2893					if ( !UNCODE.isFullPage ) {
2894						if (scrollSpeed == 0) {
2895							$('html, body').scrollTop(calc_scroll);
2896							UNCODE.scrolling = false;
2897							filter_items();
2898						} else {
2899
2900							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
2901								filter_items();
2902								filterTolerance = true;
2903							}
2904
2905							$('html, body').animate({
2906								scrollTop: calc_scroll
2907							},{
2908								easing: 'easeInOutQuad',
2909								duration: scrollSpeed,
2910								complete: function(){
2911									UNCODE.scrolling = false;
2912									if ( !filterTolerance ) {
2913										filter_timeout = setTimeout(function(){
2914											clearTimeout(filter_timeout);
2915											filter_items();
2916										}, 200);
2917									}
2918								}
2919							});
2920						}
2921					}
2922				} else {
2923					filter_items();
2924				}
2925			}
2926			evt.preventDefault();
2927		});
2928
2929		$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) {
2930			var params = UNCODE.getURLParams(window.location);
2931			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
2932
2933			UNCODE.lastURL = window.location.href;
2934
2935			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
2936				return;
2937			}
2938
2939			if (params.id === undefined) {
2940				$.each($('.isotope-system'), function(index, val) {
2941					loadIsotope($(val));
2942				});
2943			} else {
2944				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
2945					loadIsotope($('#' + params.id));
2946				}
2947			}
2948		});
2949
2950		var loadIsotope = function($href, $paginating) {
2951			var is_paginating = false;
2952
2953			if (undefined !== $paginating && $paginating) {
2954				var is_paginating = $paginating;
2955			}
2956
2957			var href = ($href.is("a") ? $href.attr('href') : location),
2958				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
2959				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
2960				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
2961				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
2962				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
2963				isotopeId = isotopeSystem.attr('id');
2964			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
2965				UNCODE.lastURL = href;
2966				history.pushState({
2967					myIsotope: true
2968				}, document.title, href);
2969			}
2970			if (is_paginating) {
2971				isotopeWrapper.addClass('grid-filtering');
2972			}
2973			$.ajax({
2974				url: href
2975			}).done(function(data) {
2976				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
2977					$resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0],
2978					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
2979				isotopeWrapper.addClass('isotope-reloaded');
2980				requestTimeout(function() {
2981					isotopeWrapper.removeClass('grid-loading');
2982					isotopeWrapper.removeClass('isotope-reloaded');
2983					isotopeWrapper.removeClass('grid-filtering');
2984				}, 500);
2985				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
2986					var parent = $(val).parent(),
2987						objTimeout = parent.data('objTimeout');
2988					if (objTimeout) {
2989						$(val).removeClass('zoom-reverse').removeClass('start_animation')
2990						clearRequestTimeout(objTimeout);
2991					}
2992					if ($(val).hasClass('animate_when_almost_visible')) {
2993						$(val).addClass('zoom-reverse').removeClass('start_animation');
2994					} else {
2995						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
2996					}
2997				});
2998				requestTimeout(function() {
2999					if (isotopeContainer.data('isotope')) {
3000						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
3001						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
3002						UNCODE.adaptive();
3003						if (SiteParameters.dynamic_srcset_active === '1') {
3004							UNCODE.adaptive_srcset(isotopeContainer);
3005						}
3006						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3007							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
3008							if (typeof getLightbox === 'object') {
3009								getLightbox.refresh();
3010							} else {
3011								UNCODE.lightbox();
3012							}
3013						}
3014					}
3015					isotopeContainer.trigger('more-items-loaded');
3016					$(window).trigger('more-items-loaded');
3017				}, 300);
3018				$('.pagination', isotopeFooter).remove();
3019				isotopeFooter.append($resultPagination);
3020
3021				if (isotopeResultCount.length > 0) {
3022					$('.woocommerce-result-count', isotopeResultCount).remove();
3023					isotopeResultCount.append($resultCount);
3024				}
3025			});
3026		};
3027		$filters.each(function(i, buttonGroup) {
3028			var $buttonGroup = $(buttonGroup);
3029			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
3030				$buttonGroup.find('.active').removeClass('active');
3031				$(this).addClass('active');
3032
3033			});
3034
3035			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
3036				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
3037				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
3038			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
3039				e.preventDefault();
3040				$cats_filters.slideToggle(400, 'easeInOutCirc');
3041			});
3042
3043		});
3044		window.addEventListener('boxResized', function(e) {
3045			if (UNCODE.printDialogOpen !== false) {
3046				return false;
3047			}
3048			$.each($('.isotope-layout'), function(index, val) {
3049				var $layoutMode = ($(this).data('layout'));
3050				if ($layoutMode === undefined) $layoutMode = 'masonry';
3051				if ($(this).data('isotope')) {
3052					$(this).isotope({
3053						itemSelector: $itemSelector,
3054						layoutMode: $layoutMode,
3055						transitionDuration: transitionDuration[index],
3056						masonry: {
3057							columnWidth: colWidth(index)
3058						},
3059						vertical: {
3060							horizontalAlignment: 0.5,
3061						},
3062						sortBy: 'original-order',
3063						isOriginLeft: isOriginLeft
3064					});
3065					$(this).isotope('unbindResize');
3066					if (SiteParameters.dynamic_srcset_active === '1') {
3067						UNCODE.refresh_dynamic_srcset_size($(this));
3068					}
3069				}
3070				$(this).find('.mejs-video,.mejs-audio').each(function() {
3071					$(this).trigger('resize');
3072				});
3073			});
3074		}, false);
3075
3076		init_isotope();
3077	};
3078}
3079
3080UNCODE.lightbox = function() {
3081	if ( SiteParameters.lbox_enhanced ) {
3082		return true;
3083	}
3084	UNCODE.lightboxArray = {};
3085	requestTimeout(function() {
3086		var groupsArr = {};
3087		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() {
3088			var group = this.getAttribute("data-lbox"),
3089				values = $(this).data();
3090			$(this).attr('data-lbox-init','true')
3091			groupsArr[group] = values;
3092		});
3093		for (var i in groupsArr) {
3094			var skin = groupsArr[i].skin || 'black',
3095				path = groupsArr[i].dir || 'horizontal',
3096				thumbs = !groupsArr[i].notmb || false,
3097				arrows = !groupsArr[i].noarr || false,
3098				social = groupsArr[i].social || false,
3099				deeplink = groupsArr[i].deep || false,
3100				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'),
3101				counter = $els.length,
3102				dataAlbum = $els.attr('data-album');
3103			if (social) social = {
3104				facebook: true,
3105				twitter: true,
3106				reddit: true,
3107				digg: true
3108			};
3109			UNCODE.lightboxArray[i] = $els.iLightBox({
3110				selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)',
3111				skin: skin,
3112				path: path,
3113				linkId: deeplink,
3114				infinite: false,
3115				//fullViewPort: 'fit',
3116				smartRecognition: false,
3117				fullAlone: true,
3118				maxScale: 1,
3119				minScale: .02,
3120				//fullStretchTypes: 'flash, video',
3121				overlay: {
3122					opacity: .94
3123				},
3124				controls: {
3125					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
3126					fullscreen: true,
3127					thumbnail: thumbs,
3128					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
3129				},
3130				show: {
3131					speed: 200
3132				},
3133				hide: {
3134					speed: 200
3135				},
3136				social: {
3137					start: false,
3138					buttons: social
3139				},
3140				caption: {
3141					start: false
3142				},
3143				styles: {
3144					nextOpacity: 1,
3145					nextScale: 1,
3146					prevOpacity: 1,
3147					prevScale: 1
3148				},
3149				effects: {
3150					switchSpeed: 400
3151				},
3152				slideshow: {
3153					pauseTime: 5000
3154				},
3155				thumbnails: {
3156					maxWidth: 60,
3157					maxHeight: 60,
3158					activeOpacity: .2
3159				},
3160				html5video: {
3161					preload: true
3162				},
3163				callback: {
3164					onOpen: function(){
3165						$(window).trigger('uncode-custom-cursor');
3166						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3167							iNoBounce.enable();
3168						}
3169					},
3170					onHide: function(){
3171						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3172							iNoBounce.disable()
3173						}
3174					},
3175				}
3176			});
3177
3178			$(document).on('infinite-loaded', function(){
3179				UNCODE.lightboxArray[i].refresh();
3180			});
3181
3182			$(window).on('gdprOpen', function(){
3183				UNCODE.lightboxArray[i].close();
3184			});
3185		};
3186	}, 100);
3187
3188	$(document).on('click', '.lb-disabled', function(e){
3189		e.preventDefault();
3190	});
3191};
3192
3193UNCODE.lightgallery = function( $el ) {
3194	var createSelectors = function(){
3195		$('a[data-lbox]:not([data-lbox-init]):not([data-album])').each(function(){
3196			if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3197				$(this).addClass('lbox-trigger-item');
3198			} else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3199				$(this).addClass('lbox-nested-item');
3200			} else {
3201				$(this).removeClass('lbox-trigger-item');
3202				$(this).removeClass('lbox-nested-item');
3203			}
3204		});
3205	};
3206
3207	createSelectors();
3208
3209	var galleries = [],
3210		nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
3211			return !$(this).closest('.nested-carousel').length;
3212		}),
3213		$_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 *'),
3214		$galleries = $_galleries.filter(function( index ) {
3215			return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
3216		}),
3217		$nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item');
3218
3219	if ( typeof $el === 'undefined' ) {
3220		$el = $galleries.add( $nested );
3221	}
3222
3223	var $disabled = $('a.lb-disabled');
3224	$disabled.on('click', function(e){
3225		e.preventDefault();
3226	});
3227
3228	var beforeSlide = function(event) {
3229		var detail = event.detail,
3230			info = detail.info,
3231			item = detail.item,
3232			$slide = $(detail.currentSlide.selector),
3233			$video = $('video', $slide),
3234			$previous = $(detail.previousSlide.selector),
3235			$prevVideo = $('video', $previous),
3236			isAudio = false;
3237
3238		if ( typeof info.src !== 'undefined' ) {
3239			isAudio = info.src.search(/.mp3|.m4a/i) > -1;
3240		}
3241
3242		if ( ! $video.length && ( info.video || isAudio ) ) {
3243			if ( info.video ) {
3244				if ( typeof info.video === 'object' ) {
3245					var infoJson = info.video;
3246				} else {
3247					var infoJson = JSON.parse(info.video);
3248				}
3249				var src = infoJson.source[0].src,
3250					autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes',
3251					muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes',
3252					loop = $(item).attr('data-loop');
3253
3254			} else if ( isAudio ) {
3255				var src = info.src,
3256					autoplay = true,
3257					loop = false;
3258			}
3259			if ( typeof src !== 'undefined' ) {
3260				$slide.addClass('has-html5');
3261				var video = document.createElement('video');
3262				video.src = src;
3263				video.preload = 'auto';
3264				video.controls = 'controls';
3265				video.controlsList = 'nodownload';
3266				if ( autoplay ) {
3267					video.autoplay = 'autoplay';
3268				}
3269				if ( muted ) {
3270					video.muted = 'muted';
3271				}
3272				if ( loop ) {
3273					video.loop = 'loop';
3274				}
3275				$(video).appendTo($slide);
3276			}
3277		} else {
3278			var $video = $('video', $slide);
3279			if ( $video.length ) {
3280				$video[0].currentTime = 0;
3281				if ( $video[0].autoplay ) {
3282					$video[0].play();
3283				}
3284			}
3285		}
3286		if ( $prevVideo.length ) {
3287			$prevVideo[0].currentTime = 0;
3288			$prevVideo[0].pause();
3289		}
3290	};
3291
3292	var beforeOpen = function(event) {
3293		var detail = event.detail,
3294			items = detail.items,
3295			galleryItems = detail.galleryItems,
3296			outer = detail.outer.selector,
3297			i, ii;
3298		for ( i = 0; i < galleryItems.length; i++ ) {
3299			var item = galleryItems[i];
3300			if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) {
3301				$(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video');
3302			}
3303		}
3304		for ( ii = 0; ii < items.length; ii++ ) {
3305			var item = items[ii];
3306			if ( $(item).attr('data-icon') === 'video' ) {
3307				$(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video');
3308			}
3309		}
3310
3311	};
3312
3313	//caption builder
3314	$el.each( function( index, val ) {
3315		var $gallery = $(this).attr('data-lbox-init','true'),
3316			$_a = '.lbox-trigger-item',
3317			$_nested_a = '.lbox-nested-item';
3318
3319		$gallery.find($_a, $_nested_a).each(function(){
3320			var $a = $(this),
3321				$img = $('img', $a).first(),
3322				imgw = $img.attr('data-width'),
3323				imgh = $img.attr('data-height'),
3324				caption = $a.attr('data-caption'),
3325				title = $a.attr('data-title');
3326
3327			if ( $img.length && $img.attr('data-crop') != true ) {
3328				if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) {
3329					$a.attr('data-external-thumb-image', $img.attr('data-guid'));
3330				} else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) {
3331					$a.attr('data-external-thumb-image', $img[0].src);
3332				}
3333			}
3334
3335			if ( typeof title !== 'undefined' && title !== '' ) {
3336				title = '<h6>' + title + '</h6>';
3337			} else {
3338				title = '';
3339			}
3340
3341			if ( typeof caption !== 'undefined' && caption !== '' ) {
3342				caption = '<p>' + caption + '</p>';
3343				title += caption;
3344			}
3345
3346			if ( title !== '' ) {
3347				$a.attr( 'title', title );
3348			}
3349
3350			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') ) ) {
3351				$a.attr('data-lg-size', imgw + '-' + imgh);
3352			}
3353		});
3354	});
3355
3356	//regular galleries
3357	$el.each( function( index, val ) {
3358		var $gallery = $(this),
3359			$_a = '.lbox-trigger-item',
3360			$_nested_a = '.lbox-nested-item',
3361			$_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(),
3362			galleryID = $_first.attr('data-lbox'),
3363			$_connected_a = $_a + '[data-lbox="' + galleryID + '"]',
3364			tmb = $_first.attr('data-notmb'),
3365			social = $_first.attr('data-social'),
3366			deep = $_first.attr('data-deep'),
3367			zoom = $_first.attr('data-zoom-origin'),
3368			actual = $_first.attr('data-actual-size'),
3369			download = $_first.attr('data-download'),
3370			controls = $_first.attr('data-arrows') !== 'no',
3371			fullScreen = $_first.attr('data-full'),
3372			counter = $_first.attr('data-counter'),
3373			transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide',
3374			containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
3375			connect = $_first.attr('data-connect'),
3376			lgPlugins = [lgVideo],
3377			itemsLoadedTimeOut;
3378
3379		containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3380		containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
3381
3382		if ( typeof tmb == 'undefined' || !tmb ) {
3383			lgPlugins.push(lgThumbnail);
3384		}
3385		if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) {
3386			lgPlugins.push(lgZoom);
3387		}
3388		if ( typeof deep != 'undefined' && deep != '' ) {
3389			lgPlugins.push(lgHash);
3390		}
3391		if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
3392			lgPlugins.push(lgFullscreen);
3393		}
3394		if ( social ) {
3395			lgPlugins.push(lgShare);
3396		}
3397
3398		if ( galleries.indexOf( galleryID ) !== -1 ) {
3399			return true;
3400		}
3401
3402		galleries.push( galleryID );
3403		var $triggerGal = connect ? $('.page-wrapper') : $gallery,
3404			$selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a;
3405		var gallery = lightGallery( $triggerGal[0], {
3406			addClass: containerClass,
3407			plugins: lgPlugins,
3408			mode: transition,
3409			selector: $selector,
3410			galleryId: galleryID,
3411			thumbnail: ( typeof tmb == 'undefined' || !tmb ),
3412			iframeWidth: '848px',
3413			iframeMaxWidth: '90%',
3414			iframeMaxHeight: '90%',
3415			exThumbImage: 'data-external-thumb-image',
3416			loadYouTubeThumbnail: false,
3417			autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' ),
3418			// autoplayFirstVideo: false,
3419			pager: false,
3420			startClass: 'lg-start-opacity',
3421			zoomFromOrigin: zoom,
3422			controls: controls,
3423			download: ( typeof download != 'undefined' && download != '' ),
3424			thumbWidth: 50,
3425			thumbHeight: '50px',
3426			counter: $triggerGal.find($selector).length > 1 ? counter : false,
3427			loadYouTubePoster: false,
3428			enableDrag: $triggerGal.find($selector).length > 1,
3429			mobileSettings: {
3430				showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
3431			},
3432		});
3433
3434		$('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){
3435			e.preventDefault();
3436			var index = $(this).closest('.owl-item.cloned').attr('data-index');
3437			gallery.openGallery(index-1);
3438		});
3439
3440		$triggerGal.on('more-items-loaded', function(e, items) {
3441			clearRequestTimeout(itemsLoadedTimeOut);
3442			itemsLoadedTimeOut = requestTimeout(function(){
3443				createSelectors();
3444				gallery.refresh();
3445			}, 100);
3446		});
3447
3448		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3449			window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
3450				$el = model.view.$el;
3451				if ( $el.find($triggerGal).length ) {
3452					gallery.destroy();
3453				}
3454			});
3455		}
3456
3457		$triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide);
3458		$triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen);
3459		$triggerGal[0].addEventListener('lgAfterOpen', function(){
3460			$(window).trigger('uncode-custom-cursor');
3461		});
3462
3463	});
3464
3465	if ( typeof $el !== 'undefined' ) {
3466
3467		//album galleries
3468		$('a[data-album]:not([data-lbox-init])').each(function(index, val) {
3469			var album = val,
3470				galleryID = index,
3471				$album = $(album),
3472				params = $album.attr('data-album'),
3473				tmb = $(val).attr('data-notmb'),
3474				social = $(val).attr('data-social'),
3475				deep = $(val).attr('data-deep'),
3476				actual = $(val).attr('data-actual-size'),
3477				download = $(val).attr('data-download'),
3478				controls = $(val).attr('data-arrows') !== 'no',
3479				fullScreen = $(val).attr('data-full'),
3480				counter = $(val).attr('data-counter'),
3481				transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide',
3482				containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
3483				lgPlugins = [lgVideo];
3484
3485			$(val).attr('data-lbox-init','true');
3486
3487			containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3488			containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
3489
3490			if ( typeof tmb == 'undefined' || !tmb ) {
3491				lgPlugins.push(lgThumbnail);
3492			}
3493			if ( typeof actual != 'undefined' && actual != '' ) {
3494				lgPlugins.push(lgZoom);
3495			}
3496			if ( typeof deep != 'undefined' && deep != '' ) {
3497				lgPlugins.push(lgHash);
3498			}
3499			if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
3500				lgPlugins.push(lgFullscreen);
3501			}
3502			if ( social ) {
3503				lgPlugins.push(lgShare);
3504			}
3505
3506			var gallery = window.lightGallery(album, {
3507				dynamic: true,
3508				plugins: lgPlugins,
3509				dynamicEl: JSON.parse(params),
3510				galleryId: galleryID,
3511				addClass: containerClass,
3512				mode: transition,
3513				thumbnail: ( typeof tmb == 'undefined' || !tmb ),
3514				iframeWidth: '848px',
3515				iframeMaxWidth: '90%',
3516				iframeMaxHeight: '90%',
3517				loadYouTubeThumbnail: false,
3518				autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ),
3519				// autoplayFirstVideo: false,
3520				pager: false,
3521				startClass: 'lg-start-opacity',
3522				zoomFromOrigin: false,
3523				controls: controls,
3524				download: ( typeof download != 'undefined' && download != '' ),
3525				thumbWidth: 50,
3526				thumbHeight: '50px',
3527				loadYouTubePoster: false,
3528				counter: counter
3529			});
3530
3531			$album.on('click', function(){
3532				gallery.openGallery(0);
3533			});
3534
3535			album.addEventListener('lgBeforeSlide', beforeSlide);
3536			album.addEventListener('lgBeforeOpen', beforeOpen);
3537			album.addEventListener('lgAfterOpen', function(){
3538				$(window).trigger('uncode-custom-cursor');
3539			});
3540
3541			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3542				window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
3543					$el = model.view.$el;
3544					if ( $el.find($album).length ) {
3545						gallery.destroy();
3546					}
3547				});
3548			}
3549
3550		});
3551
3552		//single images
3553		$('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) {
3554			var gallery = lightGallery( $('.page-wrapper')[0], {
3555				selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])',
3556				iframeWidth: '848px',
3557				iframeMaxWidth: '90%',
3558				iframeMaxHeight: '90%',
3559				loadYouTubeThumbnail: false,
3560				// autoplayFirstVideo: false,
3561				startClass: 'lg-start-opacity',
3562				thumbWidth: 50,
3563				thumbHeight: '50px',
3564				download: false,
3565				loadYouTubePoster: false,
3566				counter: false
3567			});
3568
3569			$('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide);
3570			$('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen);
3571		});
3572	}
3573};
3574
3575UNCODE.carousel = function(container) {
3576	var $owlContainers = $('.owl-carousel-container', container);
3577	$owlContainers.each(function() {
3578		var $owlContainer = $(this),
3579			$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
3580			$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
3581			values = {},
3582			tempTimeStamp,
3583			newWidth = UNCODE.wwidth,
3584			$owlInsideEqual = [];
3585		$owlSelector.each(function() {
3586			var itemID = $(this).attr('id'),
3587				$elSelector = $(('#' + itemID).toString());
3588			values['id'] = itemID;
3589			values['items'] = 1;
3590			values['columns'] = 3;
3591			values['fade'] = false;
3592			values['nav'] = false;
3593			values['navmobile'] = false;
3594			values['navskin'] = 'light';
3595			values['navspeed'] = 400;
3596			values['dots'] = false;
3597			values['dotsmobile'] = false;
3598			values['loop'] = false;
3599			values['autoplay'] = false;
3600			values['timeout'] = 3000;
3601			values['autoheight'] = false;
3602			values['stagepadding'] = 0;
3603			values['margin'] = 0;
3604			values['lg'] = 1;
3605			values['md'] = 1;
3606			values['sm'] = 1;
3607			$.each($(this).data(), function(i, v) {
3608				values[i] = v;
3609			});
3610
3611			if ($(this).closest('.uncode-slider').length) {
3612				values['navskin'] = '';
3613				values['navmobile'] = false;
3614				//values['dotsmobile'] = true;
3615			} else {
3616				values['navskin'] = ' style-'+values['navskin']+' style-override';
3617			}
3618
3619			var setIndexActive = function(event, init){
3620				var init = typeof init === 'undefined' ? false : init,
3621					thiis = $(event.currentTarget);
3622				if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
3623					var scrolltop = $(document).scrollTop(),
3624						size = event.page.size,
3625						i;
3626					var setIndex = requestTimeout(function() {
3627						for ( i = 0; i < size; i++ ) {
3628							var itemCont = event.item.index != null ? (event.item.index + i) : i;
3629							var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
3630							if (thiis.closest('.row-slider').length) {
3631								if (currentItem == undefined) {
3632									currentItem = thiis.children()[i];
3633								}
3634								if ($(currentItem).closest('#page-header').length) {
3635									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
3636										UNCODE.switchColorsMenu(scrolltop, 'dark');
3637									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
3638										UNCODE.switchColorsMenu(scrolltop, 'light');
3639									}
3640								}
3641							}
3642							var itendIndex = $(currentItem).attr('data-index');
3643							if ( isNaN(itendIndex) ) {
3644								itendIndex = 1;
3645							}
3646							$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
3647							$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
3648							if ($.fn.counterUp) {
3649								$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){
3650									var $counter = $(this);
3651									$counter.addClass('started').counterUp({
3652										delay: 10,
3653										time: 1500
3654									});
3655								});
3656							}
3657						}
3658						$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
3659					}, 200);
3660				}
3661				tempTimeStamp = event.timeStamp;
3662			}
3663
3664			/** Initialized */
3665			$elSelector.on('initialized.owl.carousel', function(event) {
3666
3667				if ( $('.isotope-container', event.currentTarget).length ) {
3668					window.dispatchEvent(UNCODE.boxEvent);
3669				}
3670
3671				$('.owl-dot.active', $elSelector).on('click', function(){
3672					return false;
3673				});
3674
3675				var thiis = $(event.currentTarget),
3676					// get the time from the data method
3677					time = thiis.data("timer-id"),
3678					rowParent = thiis.closest('.row-parent');
3679
3680				if ( typeof rowParent[0] !== 'undefined' ) {
3681					rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
3682				}
3683
3684				if (time) {
3685					clearRequestTimeout(time);
3686				}
3687
3688				thiis.addClass('showControls');
3689				var new_time = requestTimeout(function() {
3690					thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
3691					if (thiis.hasClass('owl-height-viewport'))
3692						setItemsRelHeight(thiis);
3693					if (thiis.hasClass('owl-height-equal'))
3694						setItemsHeight(thiis);
3695					if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
3696					if (thiis.closest('.unequal, .unexpand').length) {
3697						UNCODE.setRowHeight(rowParent[0], true);
3698					}
3699					if (SiteParameters.dynamic_srcset_active === '1') {
3700						UNCODE.refresh_dynamic_srcset_size(thiis);
3701					}
3702				}, 350);
3703				// save the new time
3704				thiis.data("timer-id", new_time);
3705
3706				var scrolltop = $(document).scrollTop();
3707				thiis.closest('.uncode-slider').find('video').removeAttr('poster');
3708
3709				//if (!UNCODE.isMobile) {
3710					/** fix autoplay when visible **/
3711				$(window).on('load', function(){
3712					if (thiis.data('autoplay')) {
3713						if ( !thiis.closest('.sticky-element').length ) {
3714							thiis.trigger('stop.autoplay.owl');
3715						} else {
3716							thiis.trigger('play.owl.autoplay');
3717						}
3718					}
3719					if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) {
3720						return;
3721					}
3722					if ( ! thiis.closest('.sticky-element').length ) {
3723						var carouselInView = new Waypoint.Inview({
3724							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3725							element: thiis[0],
3726							exited: function() {
3727								var el = $(this.element);
3728								if (el.data('autoplay') ) {
3729									el.trigger('stop.owl.autoplay');
3730									el.data('stopped','true');
3731								}
3732							},
3733							enter: function(direction) {
3734								var el = $(this.element);
3735								requestTimeout(function() {
3736									if (el.data('autoplay')) {
3737										el.trigger('play.owl.autoplay');
3738										el.data('stopped','false');
3739									}
3740								}, 100);
3741							}
3742						});
3743					}
3744				});
3745				//}
3746
3747				// $(window).on('frontend:carousel_updated', function(){
3748				// 	Waypoint.refreshAll();
3749				// });
3750
3751				if (!thiis.closest('.isotope-system').length) {
3752					requestTimeout(function() {
3753						animate_thumb($('.t-inside', el), event);
3754					}, 400);
3755				} else {
3756					requestTimeout(function() {
3757						thiis.closest('.isotope-container').isotope('layout');
3758					}, 400);
3759				}
3760
3761				var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
3762				currentIndex = $(currentItem).attr('data-index');
3763
3764				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
3765					if ($(val).closest('.uncode-slider').length) {
3766						$(val).removeClass('start_animation');
3767					}
3768				});
3769				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
3770					if ($(val).closest('.uncode-slider').length) {
3771						$(val).removeClass('already-animated');
3772					}
3773				});
3774
3775				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
3776					if ($(val).closest('.uncode-slider').length) {
3777						$(val).removeAttr('data-animated');
3778					}
3779				});
3780
3781				$.each($('.owl-item.cloned', thiis), function(index, val) {
3782					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
3783				});
3784
3785				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
3786					if ($(val).attr('data-index') != currentIndex) {
3787						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
3788						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
3789					}
3790					if ($(val).attr('data-index') != currentIndex) {
3791						$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
3792					}
3793					if ($(val).attr('data-index') == currentIndex) {
3794						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
3795					}
3796				});
3797
3798				if (thiis.closest('.uncode-slider').length) {
3799					var el = thiis.closest('.row-parent')[0];
3800					if ($(el).data('imgready')) {
3801						firstLoaded(el, event);
3802					} else {
3803						el.addEventListener("imgLoaded", function(el) {
3804							firstLoaded(el.target, event);
3805						}, false);
3806					}
3807					var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
3808					if (transHeight != null) {
3809						requestTimeout(function() {
3810							thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
3811						}, 100);
3812					}
3813				} else {
3814					var el = thiis;
3815					el.closest('.uncode-slider').addClass('slider-loaded');
3816				}
3817
3818				requestTimeout(function() {
3819					if (typeof UNCODE.bigText !== 'undefined') {
3820						UNCODE.bigText(thiis);
3821					}
3822					if (thiis.closest('.uncode-slider').length) {
3823						if (thiis.data('autoplay')) pauseOnHover(thiis);
3824					}
3825				}, 500);
3826
3827				if (thiis.closest('.unequal').length) {
3828					$owlInsideEqual.push(thiis.closest('.row-parent'));
3829				}
3830
3831				var containerClasses = '',
3832					containerStyle = '';
3833				if ( $('.owl-dots-classes', $owlContainer).length ) {
3834					containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
3835					containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
3836					$('.owl-dots-classes', $owlContainer).remove();
3837				}
3838
3839				if ( containerClasses !== '' ) {
3840					requestTimeout(function() {
3841						if ( containerClasses !== '' )
3842							$('.owl-dots', $owlContainer).attr('style', containerStyle);
3843						if ( containerStyle !== '' )
3844							$('.owl-dots', $owlContainer).addClass(containerClasses);
3845					}, 100);
3846				}
3847
3848				$.each($('.column_child.pos-bottom', thiis), function(index, val) {
3849					$(val).closest('.row-inner').css({
3850						'margin-top': '-1px'
3851					});
3852				});
3853
3854				if ($.fn.isotope) {
3855					if ( thiis.closest('.isotope-container').length ) {
3856						if (thiis.closest('.isotope-container').data('isotope')) {
3857							requestTimeout(function(){
3858								thiis.closest('.isotope-container').isotope('layout');
3859							}, 300);
3860						}
3861						$(window).on('load', function(){
3862							if (thiis.closest('.isotope-container').data('isotope')) {
3863								thiis.closest('.isotope-container').isotope('layout');
3864							}
3865						});
3866					}
3867				}
3868
3869				if (thiis.data('autoplay')) {
3870					$(window).on('menuOpen', function(){
3871						thiis.trigger('stop.owl.autoplay');
3872						thiis.data('stopped','true');
3873					}).on('menuClose', function(){
3874
3875					});
3876				}
3877				$(window).on('menuClose', function(){
3878					if (thiis.data('autoplay')) {
3879						thiis.trigger('play.owl.autoplay');
3880						thiis.data('stopped','false');
3881					}
3882				});
3883
3884				setIndexActive(event, true);
3885
3886				var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
3887						return !$(this).closest('.nested-carousel').length;
3888					}),
3889					$_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),
3890					$galleries = $_galleries.filter(function( index ) {
3891						return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
3892					});
3893
3894				if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
3895					UNCODE.lightgallery( $galleries );
3896				}
3897
3898
3899			});
3900
3901			$elSelector.on('resized.owl.carousel', function(event) {
3902				var thiis = $(event.currentTarget);
3903				// if ($(this).closest('.nested-carousel').length) {
3904				// 	requestTimeout(function() {
3905				// 		window.dispatchEvent(UNCODE.boxEvent);
3906				// 	}, 200);
3907				// }
3908				if ( thiis.hasClass('owl-height-equal') )
3909					setItemsHeight(thiis);
3910
3911				if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
3912					newWidth = UNCODE.wwidth;
3913					setItemsRelHeight($elSelector);
3914				}
3915
3916				setIndexActive(event);
3917
3918				if (SiteParameters.dynamic_srcset_active === '1') {
3919					UNCODE.refresh_dynamic_srcset_size(thiis);
3920				}
3921
3922				if ($.fn.isotope) {
3923					$(window).on('load', function(){
3924						if ($(event.currentTarget).closest('.isotope-container').data('isotope')) {
3925							$(event.currentTarget).closest('.isotope-container').isotope('layout');
3926						}
3927					});
3928				}
3929			});
3930
3931			/** detect resize window for fluid height layout */
3932			var setFluidResize;
3933			function manageFluidCarouseHeight() {
3934				clearRequestTimeout(setFluidResize);
3935				setFluidResize = requestTimeout(function(){
3936					if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
3937						newWidth = UNCODE.wwidth;
3938						setItemsRelHeight($elSelector);
3939					}
3940				}, 100);
3941			}
3942			window.addEventListener('resize', manageFluidCarouseHeight);
3943
3944			/** Change */
3945			$elSelector.on('change.owl.carousel', function(event) {
3946				if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
3947			});
3948
3949			/** Changed */
3950			$elSelector.on('changed.owl.carousel', function(event) {
3951				var $row = $elSelector.parents('.row')[0];
3952				if ( typeof $row !== 'undefined' ) {
3953					$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
3954				}
3955				setIndexActive(event);
3956			});
3957
3958			var checkDrag = function(e) {
3959				$elSelector.addClass('owl-dragging');
3960			};
3961			$elSelector.on('drag.owl.carousel', function(event) {
3962				document.addEventListener("mousemove", checkDrag);
3963			});
3964
3965			$elSelector.on('dragged.owl.carousel', function(event) {
3966				$elSelector.removeClass('owl-dragging');
3967				document.removeEventListener("mousemove", checkDrag);
3968			});
3969
3970			$elSelector.on('translate.owl.carousel', function(event) {
3971				if (UNCODE.isMobile) {
3972					$(event.currentTarget).addClass('owl-translating');
3973				}
3974			});
3975
3976			/** Translated */
3977			$elSelector.on('translated.owl.carousel', function(event) {
3978
3979				var thiis = $(event.currentTarget),
3980					currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
3981					currentIndex = $(currentItem).attr('data-index'),
3982					stagePadding = thiis.data('stagepadding');
3983
3984				stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
3985
3986				if (!UNCODE.isMobile) {
3987					UNCODE.owlPlayVideo(thiis);
3988				}
3989
3990				requestTimeout(function(){
3991					var lastDelayElems = animate_elems($('.owl-item.index-active', thiis));
3992					var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event);
3993					if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) {
3994						if (lastDelayElems == undefined) lastDelayElems = 0;
3995						if (lastDelayThumb == undefined) lastDelayThumb = 0;
3996						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
3997						thiis.trigger('stop.owl.autoplay');
3998						requestTimeout(function() {
3999							if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay');
4000						}, maxDelay);
4001					}
4002				}, 200);
4003
4004				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4005					if ($(val).closest('.uncode-slider').length) {
4006						$(val).removeClass('start_animation');
4007					}
4008				});
4009
4010				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4011					if ($(val).closest('.uncode-slider').length) {
4012						$(val).removeClass('already-animated');
4013					}
4014				});
4015
4016				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4017					if ($(val).closest('.uncode-slider').length) {
4018						$(val).removeAttr('data-animated');
4019					}
4020				});
4021
4022				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4023					if ($(val).attr('data-index') != currentIndex) {
4024						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4025						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4026					}
4027					if ($(val).attr('data-index') != currentIndex) {
4028						$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
4029					}
4030					if ($(val).attr('data-index') == currentIndex) {
4031						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4032					}
4033				});
4034
4035				if (UNCODE.isMobile) {
4036					thiis.removeClass('owl-translating');
4037				}
4038
4039				setIndexActive(event);
4040			});
4041
4042			if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
4043
4044			/** Init carousel */
4045			$elSelector.not('.showControls').owlCarousel({
4046				items: values['items'],
4047				animateIn: (values['fade'] == true) ? 'fadeIn' : null,
4048				animateOut: (values['fade'] == true) ? 'fadeOut' : null,
4049				nav: values['nav'],
4050				dots: values['dots'],
4051				loop: values['loop'],
4052				stagePadding: values['stagepadding'],
4053				margin: 0,
4054				video: true,
4055				autoWidth: false,
4056				autoplay: false,
4057				autoplayTimeout: values['timeout'],
4058				autoplaySpeed: values['navspeed'],
4059				autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true,
4060				autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ),
4061				rtl: $('body').hasClass('rtl') ? true : false,
4062				fluidSpeed: true,
4063				navSpeed: values['navspeed'],
4064				dotsSpeed: values['navspeed'] / values['items'],
4065				navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
4066				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>'],
4067				navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
4068				responsiveClass: true,
4069				responsiveBaseElement: '.box-container',
4070				responsive: {
4071					0: {
4072						items: values['sm'],
4073						nav: values['navmobile'],
4074						dots: values['dotsmobile'],
4075						dotsSpeed: values['navspeed'] / values['sm'],
4076					},
4077					480: {
4078						items: values['sm'],
4079						nav: values['navmobile'],
4080						dots: values['dotsmobile'],
4081						dotsSpeed: values['navspeed'] / values['sm'],
4082					},
4083					570: {
4084						items: values['md'],
4085						nav: values['navmobile'],
4086						dots: values['dotsmobile'],
4087						dotsSpeed: values['navspeed'] / values['md'],
4088					},
4089					960: {
4090						items: values['lg'],
4091						dotsSpeed: values['navspeed'] / values['lg'],
4092					}
4093				}
4094			});
4095
4096			var transDuration = parseFloat(values['navspeed']) * 0.3;
4097			var transDuration2 = parseFloat(values['navspeed']) * 0.8;
4098
4099			$('.owl-item .tmb', $elSelector).css({
4100				'-webkit-transition-delay': transDuration + 'ms',
4101				'-moz-transition-delay': transDuration + 'ms',
4102				'-o-transition-delay': transDuration + 'ms',
4103				'transition-delay': transDuration + 'ms',
4104				'-webkit-transition-duration': transDuration2 + 'ms',
4105				'-moz-transition-duration': transDuration2 + 'ms',
4106				'-o-transition-duration': transDuration2 + 'ms',
4107				'transition-duration': transDuration2 + 'ms',
4108			});
4109
4110			requestTimeout(function() {
4111				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4112					UNCODE.setRowHeight($owlInsideEqual[i]);
4113				};
4114			}, 300);
4115
4116			$(window).on('load', function(){
4117				var $elCarousel = $elSelector.data('owl.carousel');
4118				if ( typeof $elCarousel !== 'undefined' ) {
4119					$elCarousel.trigger('refreshed');
4120					for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4121						UNCODE.setRowHeight($owlInsideEqual[i]);
4122					};
4123				}
4124			});
4125
4126			$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
4127				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4128					$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
4129					$('#' + carousel_id).find('.owl-item').each( function() {
4130						var $item = $(this),
4131							index = ( $item.index() + 1 );
4132						$item.attr('data-index', index);
4133					});
4134				}
4135			});
4136
4137			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4138				window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
4139					if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4140						$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
4141						$('#' + carousel_id).find('.owl-item').each( function() {
4142							var $item = $(this),
4143								index = ( $item.index() + 1 );
4144							$item.attr('data-index', index);
4145						});
4146					}
4147				});
4148			}
4149
4150		});
4151
4152		function firstLoaded(el, event) {
4153			var el = $(el),
4154			uncode_slider = el.find('.uncode-slider');
4155			el.find('.owl-carousel').css('opacity', 1);
4156			uncode_slider.addClass('slider-loaded');
4157			if (typeof UNCODE.bigText !== 'undefined') {
4158				UNCODE.bigText(el.find('.owl-item.active'));
4159			}
4160			//if (!UNCODE.isMobile) {
4161				requestTimeout(function() {
4162					var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
4163					var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
4164					if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
4165						if (lastDelayElems == undefined) lastDelayElems = 0;
4166						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4167						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4168						$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
4169						requestTimeout(function() {
4170							$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
4171						}, maxDelay);
4172					}
4173				}, 500);
4174
4175			//}
4176		}
4177
4178		function navHover(el) {
4179			var $owlCont = el,
4180				$owlPrev = $owlCont.find('.owl-prev'),
4181				$owlNext = $owlCont.find('.owl-next'),
4182				$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
4183				$owlPagination = $owlCont.next(),
4184				owlPrevW = $owlPrev.outerWidth(),
4185				owlNextW = $owlNext.outerWidth(),
4186				owlDotsH = $owlDots.innerHeight(),
4187				owlTime = 400,
4188				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4189			if ( $('body').hasClass('rtl') ) {
4190				$owlPrev.css("margin-right", -owlPrevW);
4191				$owlNext.css("margin-left", -owlNextW);
4192			} else {
4193				$owlPrev.css("margin-left", -owlPrevW);
4194				$owlNext.css("margin-right", -owlNextW);
4195			}
4196			if (!owlNested) $owlDots.css("bottom", -owlDotsH);
4197			$owlCont.mouseenter(function() {
4198				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4199				$owlPrev.add($owlNext).css({
4200					marginLeft: 0,
4201					marginRight: 0
4202				});
4203				if (!owlNested) {
4204					$owlDots.css({
4205						opacity: 1,
4206						bottom: 0
4207					});
4208				}
4209			}).mouseleave(function() {
4210				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4211				if ( $('body').hasClass('rtl') ) {
4212					$owlPrev.css("margin-right", -owlPrevW);
4213					$owlNext.css("margin-left", -owlNextW);
4214				} else {
4215					$owlPrev.css("margin-left", -owlPrevW);
4216					$owlNext.css("margin-right", -owlNextW);
4217				}
4218				if (!owlNested) {
4219					$owlDots.css({
4220						opacity: 1,
4221						bottom: -owlDotsH
4222					});
4223				}
4224			});
4225		};
4226
4227		function animate_elems($this) {
4228			var lastDelay;
4229			$.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) {
4230				var element = $(val),
4231					delayAttr = element.attr('data-delay'),
4232					$first_item = element.closest('.owl-item[data-index="1"]');
4233
4234				if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
4235					return false;
4236				}
4237
4238				if (delayAttr == undefined) delayAttr = 0;
4239				requestTimeout(function() {
4240					element.addClass('start_animation');
4241				}, delayAttr);
4242				lastDelay = delayAttr;
4243			});
4244			return lastDelay;
4245		}
4246
4247		function animate_thumb(items, event) {
4248			var lastDelay,
4249				itemIndex,
4250				thiis = $(event.currentTarget),
4251				tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'),
4252				numActives = $('.owl-item.active', thiis).length,
4253				stagePadding = thiis.data('stagepadding');
4254
4255			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4256
4257			thiis.data('tempIndex', event.item.index);
4258				$.each(items, function(index, val) {
4259					var parent = $(val).closest('.owl-item');
4260					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4261						return;
4262					}
4263					if (!$(val).hasClass('start_animation')) {
4264						if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
4265							var thumbInView = new Waypoint.Inview({
4266							  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4267							  element: val,
4268							  enter: function(direction) {
4269								var element = $(this.element),
4270										delayAttr = parseInt(element.attr('data-delay')),
4271										itemIndex = element.closest('.owl-item').index() + 1,
4272										diffItem = Math.abs(itemIndex - tempIndex) - 1;
4273									if (itemIndex > tempIndex) {
4274										thiis.data('tempIndex', itemIndex);
4275									}
4276									if (isNaN(delayAttr)) delayAttr = 100;
4277									if (stagePadding) {
4278										var objTimeout = requestTimeout(function() {
4279											element.addClass('start_animation');
4280										}, index * delayAttr);
4281										lastDelay = index * delayAttr;
4282									} else {
4283										$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation');
4284										var objTimeout = requestTimeout(function() {
4285											element.addClass('start_animation');
4286										}, diffItem * delayAttr);
4287										lastDelay = diffItem * delayAttr;
4288									}
4289									parent.data('objTimeout', objTimeout);
4290									if (!UNCODE.isUnmodalOpen) {
4291										this.destroy();
4292									}
4293								}
4294							});
4295						}
4296					}
4297				});
4298				return lastDelay;
4299			}
4300
4301		function setItemsHeight(item) {
4302			$.each($('.owl-item', item), function(index, val) {
4303				var availableThumbHeight = $('.t-inside', $(val)).height(),
4304				innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
4305				difference = availableThumbHeight - innerThumbHeight;
4306				if ($('.tmb-content-under', val).length) {
4307					var visualPart = $('.t-entry-visual', val);
4308					if (visualPart.length) {
4309						difference -= $('.t-entry-visual', val).height();
4310					}
4311				}
4312				if (! $('.tmb-content-lateral', val).length)
4313					$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
4314			});
4315		}
4316
4317		function setItemsRelHeight(item) {
4318			$.each($('.owl-item', item), function(index, val) {
4319				var $rowContainer = $(item).parents('.row-parent').eq(0),
4320					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
4321					$colContainer = $(item).parents('.uncell').eq(0),
4322					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
4323					winHeight = UNCODE.wheight,
4324					multiplier_h = parseInt($(item).attr('data-vp-height')),
4325					data_viewport_h,
4326					consider_menu = $(item).data('vp-menu');
4327
4328				if ( consider_menu ) {
4329					winHeight = winHeight - UNCODE.menuHeight;
4330				}
4331
4332				data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
4333				$('.t-inside', val).css( 'height', data_viewport_h );
4334			});
4335		}
4336
4337		function pauseOnHover(slider) {
4338			$('.owl-dots, .owl-prev, .owl-next', slider).on({
4339				mouseenter: function () {
4340					$(slider).addClass('owl-mouseenter');
4341					$(slider).trigger('stop.owl.autoplay');
4342				},
4343				mouseleave: function () {
4344					$(slider).removeClass('owl-mouseenter');
4345					$(slider).trigger('play.owl.autoplay');
4346				}
4347			});
4348		}
4349	});
4350};
4351
4352UNCODE.owlPlayVideo = function(carousel) {
4353	var player, iframe;
4354	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
4355		var content = $(val).html();
4356		if (content == '') {
4357			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
4358			$(val).append(getCloned);
4359		}
4360		if ($(this).attr('data-provider') == 'vimeo') {
4361			iframe = $(this).find('iframe');
4362			player = new Vimeo.Player(iframe[0]);
4363			player.play();
4364		} else if ($(this).attr('data-provider') == 'youtube') {
4365			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
4366		} else {
4367			var player = $(this).find('video');
4368			if (player.length) {
4369				$(this).find('video')[0].volume = 0;
4370				$(this).find('video')[0].play();
4371				$(val).css('opacity', 1);
4372			}
4373		}
4374	});
4375};
4376
4377UNCODE.owlStopVideo = function(carousel) {
4378	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
4379		var player, iframe;
4380		if ($(this).attr('data-provider') == 'vimeo') {
4381			iframe = $(this).find('iframe');
4382			player = new Vimeo.Player(iframe[0]);
4383			player.pause();
4384		} else if ($(this).attr('data-provider') == 'youtube') {
4385			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
4386		} else {
4387			var player = $(this).find('video');
4388			if (player.length) {
4389				$(this).find('video')[0].volume = 0;
4390				$(this).find('video')[0].play();
4391			}
4392		}
4393	});
4394};
4395
4396UNCODE.animations = function() {
4397
4398	var runWaypoints_TO,
4399		runWaypoints_carousel_TO,
4400		runWaypoints_delay = 0,
4401	highlightComplexFunc = function($wrap, ev){
4402
4403		var $lines = $('.heading-line-wrap', $wrap),
4404			not_animate = false;
4405
4406		if ( $wrap.data('animate') === true ) {
4407			not_animate = true;
4408		}
4409
4410		var $rotatingTxt = $('.uncode-rotating-text-start', $wrap);
4411		if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) {
4412			return;
4413		}
4414
4415		$lines.each(function(_key, _value){
4416			var $line = $(_value),
4417				$inners = $('.split-word-inner', $line),
4418				$highlights = $('.heading-text-highlight-inner', $line);
4419
4420			var highlitInnerFunc = function(ev){
4421				var delay = 0;
4422				$highlights.each(function(h_key, high){
4423					var $highlight = $(high),
4424						$split = $highlight.closest('.split-word:not(.uncode-rotating-span)'),
4425						$nextSplit = $split.nextUntil(),
4426						$next = $('.heading-text-highlight-inner', $nextSplit),
4427						countCh = $split.text().length;
4428
4429					$highlight.css({
4430						'-webkit-transition-duration': (30 * countCh) + 'ms',
4431						'-moz-transition-duration': (30 * countCh) + 'ms',
4432						'-o-transition-duration': (30 * countCh) + 'ms',
4433						'transition-duration': (30 * countCh) + 'ms',
4434					});
4435
4436					delay += (30 * countCh);
4437
4438					$next.css({
4439						'-webkit-transition-delay': delay + 'ms',
4440						'-moz-transition-delay': delay + 'ms',
4441						'-o-transition-delay': delay + 'ms',
4442						'transition-delay': delay + 'ms',
4443					});
4444				});
4445				$highlights.removeAttr('data-animated');
4446				if ( _key+1 === $lines.length ) {
4447					$wrap.data('animate', true);
4448				}
4449			};
4450
4451			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
4452				if ( not_animate ) {
4453					$highlights.each(function(h_key, high){
4454						var $highlight = $(high);
4455						$highlight.css({
4456							'-webkit-transition-duration': '0ms',
4457							'-moz-transition-duration': '0ms',
4458							'-o-transition-duration': '0ms',
4459							'transition-duration': '0ms',
4460						});
4461					});
4462					$highlights.removeAttr('data-animated');
4463				} else {
4464					if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) {
4465						highlitInnerFunc();
4466					} else {
4467						$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc);
4468					}
4469				}
4470			}
4471		});
4472	};
4473
4474	$.each($('.header-content-inner'), function(index, val) {
4475		var element = $(val),
4476			transition = '';
4477		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
4478		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
4479		if (element.hasClass('left-t-right')) transition = 'left-t-right';
4480		if (element.hasClass('right-t-left')) transition = 'right-t-left';
4481		if (element.hasClass('zoom-in')) transition = 'zoom-in';
4482		if (element.hasClass('zoom-out')) transition = 'zoom-out';
4483		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
4484		if (transition != '') {
4485			$(val).removeClass(transition);
4486			var container = element,
4487				containerDelay = container.attr('data-delay'),
4488				containerSpeed = container.attr('data-speed'),
4489				items = $('.header-title > *, .post-info', container);
4490			$.each(items, function(index, val) {
4491				var element = $(val),
4492					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
4493					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
4494				if (!element.hasClass('animate_when_almost_visible')) {
4495					delayAttr = Number(delayAttr) + (400 * index);
4496					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
4497					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
4498				}
4499			});
4500			container.css('opacity', 1);
4501		}
4502	});
4503
4504	function animate_css_grids_on_load() {
4505		$('.cssgrid-system').each(function() {
4506			var grid = $(this);
4507			var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false;
4508			UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false);
4509		});
4510	}
4511
4512	window.waypoint_animation = function(ev) {
4513		$.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) {
4514			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 ) ) {
4515				return true;
4516			}
4517			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4518				return;
4519			}
4520			var run = true,
4521				$carousel = $(val).closest('.owl-carousel');
4522			if ( $carousel.length ) {
4523				run = false;
4524			}
4525			if (run) {
4526				new Waypoint({
4527					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4528					element: val,
4529					handler: function() {
4530						var element = $(this.element),
4531							index = element.index(),
4532							delayAttr = element.attr('data-delay');
4533						if (delayAttr == undefined) delayAttr = 0;
4534						requestTimeout(function() {
4535							element.addClass('start_animation');
4536						}, delayAttr);
4537						if (!UNCODE.isUnmodalOpen) {
4538							this.destroy();
4539						}
4540					},
4541					offset: UNCODE.isFullPage ? '100%' : '90%'
4542				});
4543			}
4544		});
4545		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
4546			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4547				return;
4548			}
4549			var run = true,
4550				$carousel = $(val).closest('.owl-carousel');
4551			if ( $carousel.length ) {
4552				run = false;
4553			}
4554			if (run) {
4555				new Waypoint({
4556					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4557					element: val,
4558					handler: function() {
4559						var $element = $(this.element),
4560							$childs = $('.animate_when_parent_almost_visible', $element);
4561						$childs.each(function(key,el){
4562							var $child = $(el),
4563								delaySpeed = $child.attr('data-speed'),
4564								delayAttr = $child.attr('data-delay'),
4565								intervalAttr = $child.attr('data-interval');
4566							if (delayAttr == undefined) {
4567								delayAttr = 50*key;
4568							}
4569							requestTimeout(function() {
4570								$child.addClass('start_animation');
4571								if ( $child.hasClass('anim-line-checker') ) {
4572									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4573										var $line = $child.closest('.heading-line-wrap');
4574									});
4575								}
4576								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
4577								highlightComplexFunc($wrapText, ev);
4578								if ( $child.hasClass('anim-tot-checker') ) {
4579									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4580										if ( $child.hasClass('anim-tot-checker') ) {
4581											$wrapText.addClass('already-animated');
4582											$element.trigger('already-animated');
4583										}
4584									});
4585								}
4586							}, delayAttr );
4587						});
4588						$element.addClass('start_animation');
4589						if (!UNCODE.isUnmodalOpen) {
4590							this.destroy();
4591						}
4592					},
4593					offset: UNCODE.isFullPage ? '100%' : '90%'
4594				});
4595			}
4596		});
4597	}
4598	window.waypoint_carousel_animation = function(ev) {
4599		$.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) {
4600			if ( $(val).hasClass('el-text-split') ) {
4601				return true;
4602			}
4603			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4604				return;
4605			}
4606			var run = true,
4607				$carousel = $(val).closest('.owl-carousel'),
4608				$first_item = $(val).closest('.owl-item[data-index="1"]'),
4609				$all_first = $('.owl-item[data-index="1"]', $carousel);
4610			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
4611				run = false;
4612			}
4613			if (run) {
4614				new Waypoint({
4615					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4616					element: val,
4617					handler: function() {
4618						var element = $(this.element),
4619							index = element.index(),
4620							delayAttr = element.attr('data-delay');
4621						if (delayAttr == undefined) delayAttr = 0;
4622						requestTimeout(function() {
4623							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
4624								$all_first.attr('data-already-reached', 'true');
4625							}
4626							element.addClass('start_animation');
4627						}, delayAttr);
4628						if (!UNCODE.isUnmodalOpen) {
4629							this.destroy();
4630						}
4631					},
4632					offset: UNCODE.isFullPage ? '100%' : '90%'
4633				});
4634			}
4635		});
4636		$.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) {
4637			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4638				return;
4639			}
4640			var run = true,
4641				$carousel = $(val).closest('.owl-carousel'),
4642				$first_item = $(val).closest('.owl-item[data-index="1"]'),
4643				$all_first = $('.owl-item[data-index="1"]', $carousel);
4644			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
4645				run = false;
4646			}
4647			if (run) {
4648				new Waypoint({
4649					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4650					element: val,
4651					handler: function() {
4652						var $element = $(this.element),
4653							$childs = $('.animate_when_parent_almost_visible', $element);
4654						$childs.each(function(key,el){
4655							var $child = $(el),
4656								delaySpeed = $child.attr('data-speed'),
4657								delayAttr = $child.attr('data-delay'),
4658								intervalAttr = $child.attr('data-interval');
4659							if (delayAttr == undefined) {
4660								delayAttr = 50*key;
4661							}
4662							requestTimeout(function() {
4663								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
4664									$all_first.attr('data-already-reached', 'true');
4665								}
4666								$child.addClass('start_animation');
4667								if ( $child.hasClass('anim-line-checker') ) {
4668									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4669										var $line = $child.closest('.heading-line-wrap');
4670									});
4671								}
4672								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
4673								highlightComplexFunc($wrapText, ev);
4674								if ( $child.hasClass('anim-tot-checker') ) {
4675									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4676										if ( $child.hasClass('anim-tot-checker') ) {
4677											$wrapText.addClass('already-animated');
4678										}
4679									});
4680								}
4681							}, delayAttr );
4682						});
4683						$element.addClass('start_animation');
4684						if (!UNCODE.isUnmodalOpen) {
4685							this.destroy();
4686						}
4687					},
4688					offset: UNCODE.isFullPage ? '100%' : '90%'
4689				});
4690			}
4691		});
4692	}
4693
4694	var runWaypoints = function(ev){
4695		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
4696			runWaypoints_delay = 400;
4697		}
4698		clearRequestTimeout(runWaypoints_TO);
4699		runWaypoints_TO = requestTimeout(function() {
4700			window.waypoint_animation(ev);
4701		}, runWaypoints_delay);
4702
4703		clearRequestTimeout(runWaypoints_carousel_TO);
4704		runWaypoints_carousel_TO = requestTimeout(function() {
4705			window.waypoint_carousel_animation(ev);
4706		}, 400);
4707	};
4708	runWaypoints();
4709	animate_css_grids_on_load();
4710
4711	$( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) {
4712		runWaypoints(ev);
4713	});
4714	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4715		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
4716	}
4717};
4718
4719UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) {
4720	var $allItems = elements.length - startIndex,
4721		showed = 0,
4722		index = 0,
4723		use_index = false
4724		;
4725
4726	if (filtering) {
4727		if (sequential) {
4728			use_index = true;
4729		}
4730		sequential = false;
4731	}
4732
4733	$.each(elements, function(index, val) {
4734		var $this = $(val),
4735			elInner = $('> .t-inside', val);
4736
4737		if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4738			return;
4739		}
4740		if (val[0]) val = val[0];
4741
4742		if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
4743			new Waypoint({
4744				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4745				element: val,
4746				handler: function() {
4747					var element = $('> .t-inside', this.element),
4748						parent = $(this.element);
4749					var _index = use_index? index : 0;
4750
4751					var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index),
4752						delayAttr = parseInt(element.attr('data-delay'));
4753					if (isNaN(delayAttr)) delayAttr = 100;
4754					if (sequential || use_index) {
4755						delay -= showed;
4756					}
4757					var objTimeout = requestTimeout(function() {
4758						element.removeClass('zoom-reverse').addClass('start_animation');
4759						showed = index;
4760					}, delay * delayAttr);
4761					parent.data('objTimeout', objTimeout);
4762					if (!UNCODE.isUnmodalOpen) {
4763						this.destroy();
4764					}
4765				},
4766				offset: UNCODE.isFullPage ? '100%' : '90%'
4767			});
4768		}
4769
4770		index++;
4771	});
4772};
4773
4774UNCODE.tapHover = function() {
4775
4776	var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), //.length //html.touch a.btn
4777		elClass = "hover";
4778
4779	$(window).on('click', function() {
4780		$el.removeClass(elClass);
4781	});
4782
4783	$el.on("click", function(e) { // cambia click con touch start 'touchstart'
4784		e.stopPropagation();
4785		var link = $(this);
4786		if ( ! link.hasClass(elClass)) {
4787			e.preventDefault();
4788			link.addClass("hover");
4789			$el.not(this).removeClass(elClass);
4790			return false;
4791		}
4792	});
4793};
4794
4795UNCODE.onePage = function(isMobile) {
4796	var current = 0,
4797		last = 0,
4798		lastScrollTop = 0,
4799		forceScroll = false,
4800		lastScrolled = 0,
4801		isSectionscroller = ($('.main-onepage').length) ? true : false,
4802		isOnePage = false,
4803		getOffset = function () {
4804			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);
4805			return calculateOffset;
4806		}
4807
4808	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
4809	// 	return false;
4810
4811	function init_onepage() {
4812		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
4813			$("<ul class='onepage-pagination'></ul>").prependTo("body");
4814		}
4815		last = $('.onepage-pagination li').last().find('a').data('index');
4816		$.each($('div[data-parent="true"]'), function(index, val) {
4817			$(this).attr('data-section', index);
4818			if (isMobile) return;
4819			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4820				return;
4821			}
4822			var sectionDown = new Waypoint({
4823				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4824				element: val,
4825				handler: function(direction) {
4826					if (direction == 'down') {
4827						changeMenuActive(this.element, index);
4828					}
4829				},
4830				offset: function() {
4831					return 5 + getOffset()
4832				}
4833			});
4834			var sectionUp = new Waypoint({
4835				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4836				element: val,
4837				handler: function(direction) {
4838					if (direction == 'up') {
4839						changeMenuActive(this.element, index);
4840					}
4841				},
4842				offset: function() {
4843					return -5 - getOffset()
4844				}
4845			});
4846
4847			if (isSectionscroller) {
4848				var label;
4849				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
4850				else label = '';
4851				var getName = $(this).attr('data-name');
4852				if (getName == undefined) getName = index;
4853				if (label != '') {
4854					isOnePage = true;
4855					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
4856					$('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>");
4857				}
4858			}
4859		});
4860
4861		if (isSectionscroller) {
4862			$.each($('ul.onepage-pagination li'), function(index, val) {
4863				var $this = $(val),
4864					$a = ('a', $this);
4865				$a.on('click', function(evt) {
4866					if ( $('.is-selected', $this).length ) {
4867						return false;
4868					}
4869					if ( $('body').hasClass('uncode-scroll-no-history') ) {
4870						evt.preventDefault();
4871					}
4872					Waypoint.refreshAll();
4873					var el = $('a', evt.currentTarget);
4874					current = lastScrolled = parseInt(el.attr('data-index'));
4875					lastScrolled += 1;
4876					scrollBody(current);
4877				});
4878			});
4879		}
4880
4881		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
4882		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
4883			goToSection = String(window.location.hash).replace(/^#/, "");
4884			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
4885		}
4886
4887		if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) {
4888			current = lastScrolled = goToSection;
4889			$(window).on('load', function(){
4890				if ( $('.owl-carousel').length ) {
4891					requestTimeout(function(){
4892						scrollBody(goToSection);
4893					}, 400);
4894				} else {
4895					scrollBody(goToSection);
4896				}
4897			});
4898		}
4899
4900	}
4901
4902	function changeMenuActive(section, index) {
4903		current = lastScrolled = parseInt($(section).attr('data-section'));
4904		if (isOnePage) {
4905			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
4906			if (newSection.length) {
4907				$('ul.onepage-pagination li a').removeClass('is-selected');
4908				newSection.addClass('is-selected');
4909			}
4910			var getName = $('[data-section="' + index + '"]').attr('data-name');
4911			if (getName != undefined && getName !== '') {
4912				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
4913					var get_href = $(val).attr('href');
4914					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
4915						$(val).closest('.menu-smart').find('.active').removeClass('active');
4916						$(val).parent().addClass('active');
4917					}
4918				});
4919			}
4920		}
4921	}
4922
4923	if (isOnePage) {
4924		$(window).on('scroll', function() {
4925			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
4926			if (bodyTop == 0) {
4927				$('ul.onepage-pagination li a').removeClass('is-selected');
4928				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
4929				var getName = $('[data-section=0]').attr('data-name');
4930				if (getName != undefined && getName !== '') {
4931					$.each($('.menu-container .menu-item > a'), function(i, val) {
4932						var get_href = $(val).attr('href');
4933						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
4934							$(val).closest('ul').find('.active').removeClass('active');
4935							$(val).parent().addClass('active');
4936						}
4937					});
4938				}
4939			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
4940				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
4941				if (lastSection.length) {
4942					$('ul.onepage-pagination li a').removeClass('is-selected');
4943					lastSection.addClass('is-selected');
4944				}
4945			}
4946		});
4947	}
4948
4949	var scrollBody = function(index) {
4950		$('ul.onepage-pagination li a').removeClass('is-selected');
4951		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
4952
4953		var getSection = $('[data-section=' + index + ']'),
4954			scrollTo;
4955
4956		if (getSection == undefined) return;
4957
4958		var body = $("html, body"),
4959			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
4960			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
4961			getOffset = UNCODE.get_scroll_offset(index);
4962		if ( typeof getSection.offset() === 'undefined' )
4963			return;
4964		scrollTo = getSection.offset().top;
4965
4966		// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
4967		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
4968			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
4969			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
4970				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
4971			}
4972
4973			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
4974				if ( index === 0 ) {
4975					scrollTo = 0;
4976				} else {
4977					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
4978				}
4979			} else {
4980				scrollTo -= getOffset;
4981			}
4982		}
4983
4984		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
4985		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
4986
4987		if (index != 0) {
4988			UNCODE.scrolling = true;
4989		}
4990
4991		if (scrollSpeed == 0) {
4992			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
4993			UNCODE.scrolling = false;
4994		} else {
4995			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
4996				$(this).stop();
4997			}).animate({
4998				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
4999			}, scrollSpeed, 'easeInOutCubic', function() {
5000				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5001				UNCODE.scrolling = false;
5002				if  ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
5003				||
5004				$('.menu-hided').length ) {
5005					scrollTo = getSection.offset().top;
5006					getOffset = UNCODE.get_scroll_offset(index);
5007					scrollTo -= getOffset;
5008					body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5009						$(this).stop();
5010					}).animate({
5011						scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5012						}, scrollSpeed, 'easeInOutCubic', function() {
5013							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5014							UNCODE.scrolling = false;
5015						}
5016					);
5017				}
5018			});
5019		}
5020
5021	};
5022
5023	init_onepage();
5024};
5025
5026UNCODE.stickyElements = function() {
5027	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
5028	if (!isMobile_wide) {
5029
5030		var $pageHeader = $('#page-header'),
5031			$headerRow = $('.vc_row', $pageHeader),
5032			startSticky = false;
5033
5034		if ( $headerRow.hasClass('sticky-element') ) {
5035			$headerRow.removeClass('sticky-element');
5036			$pageHeader.addClass('sticky-element');
5037			startSticky = true;
5038		}
5039
5040		var calculateOffset = function(el) {
5041			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
5042				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
5043				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0,
5044				elTop = window.pageYOffset + el.getBoundingClientRect().top;
5045
5046			sideOffset += UNCODE.bodyBorder;
5047
5048			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
5049			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) {
5050				if ($('.menu-shrink').length) {
5051					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
5052				} else {
5053					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
5054				}
5055			}
5056
5057			return sideOffset;
5058
5059		},
5060
5061		initStickyElement = function() {
5062			$.each($('.sticky-element'), function(index, element) {
5063				if ($(element).closest('.tab-pane').length) {
5064					var $paneParent = $(element).closest('.tab-pane');
5065					if ( !$paneParent.hasClass('active') ) {
5066						return true;
5067					}
5068				}
5069				$(element).stick_in_parent({
5070					sticky_class: 'is_stucked',
5071					offset_top: calculateOffset(element),
5072					bottoming: true,
5073					inner_scrolling: SiteParameters.sticky_elements === 'on'
5074				});
5075			});
5076		};
5077
5078		requestTimeout(function() {
5079			if ($('.sticky-element').length) {
5080
5081				if ($(window).width() > UNCODE.mediaQuery) {
5082					initStickyElement();
5083
5084					if ( startSticky === true ) {
5085						$('#page-header').trigger('sticky_kit:recalc');
5086					}
5087				}
5088
5089				$(window).on('resize lateral_resize', function(event) {
5090					$(".sticky-element").trigger("sticky_kit:detach");
5091					if ($(window).width() > UNCODE.mediaQuery) {
5092						initStickyElement();
5093					}
5094				});
5095			}
5096		}, 1000);
5097
5098		if ($('.sticky-element').length) {
5099			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
5100				requestTimeout(function() {
5101					$(document.body).trigger("sticky_kit:recalc");
5102				}, 100);
5103			});
5104		}
5105
5106		var $panels = $('.panel-collapse');
5107		if ( $panels.length ) {
5108			$panels.each(function(){
5109				var $panel = $(this);
5110				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
5111					$(document.body).trigger("sticky_kit:recalc");
5112				});
5113			});
5114		}
5115
5116		$('.nav-tabs a').on('shown.bs.tab', function(e){
5117			var $tabs = $(e.target).closest('.tab-container'),
5118				$panel = $('.tab-pane.active', $tabs);
5119
5120			$(".sticky-element").trigger("sticky_kit:detach");
5121			initStickyElement();
5122	});
5123	}
5124};
5125
5126UNCODE.twentytwenty = function() {
5127
5128  if (!$('.twentytwenty-container').length) return;
5129
5130// DOM.event.move
5131//
5132// 2.0.0
5133//
5134// Stephen Band
5135//
5136// Triggers 'movestart', 'move' and 'moveend' events after
5137// mousemoves following a mousedown cross a distance threshold,
5138// similar to the native 'dragstart', 'drag' and 'dragend' events.
5139// Move events are throttled to animation frames. Move event objects
5140// have the properties:
5141//
5142// pageX:
5143// pageY:     Page coordinates of pointer.
5144// startX:
5145// startY:    Page coordinates of pointer at movestart.
5146// distX:
5147// distY:     Distance the pointer has moved since movestart.
5148// deltaX:
5149// deltaY:    Distance the finger has moved since last event.
5150// velocityX:
5151// velocityY: Average velocity over last few events.
5152
5153
5154(function(fn) {
5155	if (typeof define === 'function' && define.amd) {
5156        define([], fn);
5157    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
5158        module.exports = fn;
5159	} else {
5160		fn();
5161	}
5162})(function(){
5163	var assign = Object.assign || window.jQuery && jQuery.extend;
5164
5165	// Number of pixels a pressed pointer travels before movestart
5166	// event is fired.
5167	var threshold = 8;
5168
5169	// Shim for requestAnimationFrame, falling back to timer. See:
5170	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
5171	var requestFrame = (function(){
5172		return (
5173			window.requestAnimationFrame ||
5174			window.webkitRequestAnimationFrame ||
5175			window.mozRequestAnimationFrame ||
5176			window.oRequestAnimationFrame ||
5177			window.msRequestAnimationFrame ||
5178			function(fn, element){
5179				return window.setTimeout(function(){
5180					fn();
5181				}, 25);
5182			}
5183		);
5184	})();
5185
5186	// Shim for customEvent
5187	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
5188	(function () {
5189		if ( typeof window.CustomEvent === "function" ) return false;
5190		function CustomEvent ( event, params ) {
5191			params = params || { bubbles: false, cancelable: false, detail: undefined };
5192			var evt = document.createEvent( 'CustomEvent' );
5193			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
5194			return evt;
5195		}
5196
5197		CustomEvent.prototype = window.Event.prototype;
5198		window.CustomEvent = CustomEvent;
5199	})();
5200
5201	var ignoreTags = {
5202			textarea: true,
5203			input: true,
5204			select: true,
5205			button: true
5206		};
5207
5208	var mouseevents = {
5209		move:   'mousemove',
5210		cancel: 'mouseup dragstart',
5211		end:    'mouseup'
5212	};
5213
5214	var touchevents = {
5215		move:   'touchmove',
5216		cancel: 'touchend',
5217		end:    'touchend'
5218	};
5219
5220	var rspaces = /\s+/;
5221
5222
5223	// DOM Events
5224
5225	var eventOptions = { bubbles: true, cancelable: true };
5226
5227	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
5228
5229	function createEvent(type) {
5230		return new CustomEvent(type, eventOptions);
5231	}
5232
5233	function getEvents(node) {
5234		return node[eventsSymbol] || (node[eventsSymbol] = {});
5235	}
5236
5237	function on(node, types, fn, data, selector) {
5238		types = types.split(rspaces);
5239
5240		var events = getEvents(node);
5241		var i = types.length;
5242		var handlers, type;
5243
5244		function handler(e) { fn(e, data); }
5245
5246		while (i--) {
5247			type = types[i];
5248			handlers = events[type] || (events[type] = []);
5249			handlers.push([fn, handler]);
5250			node.addEventListener(type, handler);
5251		}
5252	}
5253
5254	function off(node, types, fn, selector) {
5255		types = types.split(rspaces);
5256
5257		var events = getEvents(node);
5258		var i = types.length;
5259		var type, handlers, k;
5260
5261		if (!events) { return; }
5262
5263		while (i--) {
5264			type = types[i];
5265			handlers = events[type];
5266			if (!handlers) { continue; }
5267			k = handlers.length;
5268			while (k--) {
5269				if (handlers[k][0] === fn) {
5270					node.removeEventListener(type, handlers[k][1]);
5271					handlers.splice(k, 1);
5272				}
5273			}
5274		}
5275	}
5276
5277	function trigger(node, type, properties) {
5278		// Don't cache events. It prevents you from triggering an event of a
5279		// given type from inside the handler of another event of that type.
5280		var event = createEvent(type);
5281		if (properties) { assign(event, properties); }
5282		node.dispatchEvent(event);
5283	}
5284
5285
5286	// Constructors
5287
5288	function Timer(fn){
5289		var callback = fn,
5290		    active = false,
5291		    running = false;
5292
5293		function trigger(time) {
5294			if (active){
5295				callback();
5296				requestFrame(trigger);
5297				running = true;
5298				active = false;
5299			}
5300			else {
5301				running = false;
5302			}
5303		}
5304
5305		this.kick = function(fn) {
5306			active = true;
5307			if (!running) { trigger(); }
5308		};
5309
5310		this.end = function(fn) {
5311			var cb = callback;
5312
5313			if (!fn) { return; }
5314
5315			// If the timer is not running, simply call the end callback.
5316			if (!running) {
5317				fn();
5318			}
5319			// If the timer is running, and has been kicked lately, then
5320			// queue up the current callback and the end callback, otherwise
5321			// just the end callback.
5322			else {
5323				callback = active ?
5324					function(){ cb(); fn(); } :
5325					fn ;
5326
5327				active = true;
5328			}
5329		};
5330	}
5331
5332
5333	// Functions
5334
5335	function noop() {}
5336
5337	function preventDefault(e) {
5338		e.preventDefault();
5339	}
5340
5341	function isIgnoreTag(e) {
5342		return !!ignoreTags[e.target.tagName.toLowerCase()];
5343	}
5344
5345	function isPrimaryButton(e) {
5346		// Ignore mousedowns on any button other than the left (or primary)
5347		// mouse button, or when a modifier key is pressed.
5348		return (e.which === 1 && !e.ctrlKey && !e.altKey);
5349	}
5350
5351	function identifiedTouch(touchList, id) {
5352		var i, l;
5353
5354		if (touchList.identifiedTouch) {
5355			return touchList.identifiedTouch(id);
5356		}
5357
5358		// touchList.identifiedTouch() does not exist in
5359		// webkit yet… we must do the search ourselves...
5360
5361		i = -1;
5362		l = touchList.length;
5363
5364		while (++i < l) {
5365			if (touchList[i].identifier === id) {
5366				return touchList[i];
5367			}
5368		}
5369	}
5370
5371	function changedTouch(e, data) {
5372		var touch = identifiedTouch(e.changedTouches, data.identifier);
5373
5374		// This isn't the touch you're looking for.
5375		if (!touch) { return; }
5376
5377		// Chrome Android (at least) includes touches that have not
5378		// changed in e.changedTouches. That's a bit annoying. Check
5379		// that this touch has changed.
5380		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
5381
5382		return touch;
5383	}
5384
5385
5386	// Handlers that decide when the first movestart is triggered
5387
5388	function mousedown(e){
5389		// Ignore non-primary buttons
5390		if (!isPrimaryButton(e)) { return; }
5391
5392		// Ignore form and interactive elements
5393		if (isIgnoreTag(e)) { return; }
5394
5395		on(document, mouseevents.move, mousemove, e);
5396		on(document, mouseevents.cancel, mouseend, e);
5397	}
5398
5399	function mousemove(e, data){
5400		checkThreshold(e, data, e, removeMouse);
5401	}
5402
5403	function mouseend(e, data) {
5404		removeMouse();
5405	}
5406
5407	function removeMouse() {
5408		off(document, mouseevents.move, mousemove);
5409		off(document, mouseevents.cancel, mouseend);
5410	}
5411
5412	function touchstart(e) {
5413		// Don't get in the way of interaction with form elements
5414		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
5415
5416		var touch = e.changedTouches[0];
5417
5418		// iOS live updates the touch objects whereas Android gives us copies.
5419		// That means we can't trust the touchstart object to stay the same,
5420		// so we must copy the data. This object acts as a template for
5421		// movestart, move and moveend event objects.
5422		var data = {
5423			target:     touch.target,
5424			pageX:      touch.pageX,
5425			pageY:      touch.pageY,
5426			identifier: touch.identifier,
5427
5428			// The only way to make handlers individually unbindable is by
5429			// making them unique.
5430			touchmove:  function(e, data) { touchmove(e, data); },
5431			touchend:   function(e, data) { touchend(e, data); }
5432		};
5433
5434		on(document, touchevents.move, data.touchmove, data);
5435		on(document, touchevents.cancel, data.touchend, data);
5436	}
5437
5438	function touchmove(e, data) {
5439		var touch = changedTouch(e, data);
5440		if (!touch) { return; }
5441		checkThreshold(e, data, touch, removeTouch);
5442	}
5443
5444	function touchend(e, data) {
5445		var touch = identifiedTouch(e.changedTouches, data.identifier);
5446		if (!touch) { return; }
5447		removeTouch(data);
5448	}
5449
5450	function removeTouch(data) {
5451		off(document, touchevents.move, data.touchmove);
5452		off(document, touchevents.cancel, data.touchend);
5453	}
5454
5455	function checkThreshold(e, data, touch, fn) {
5456		var distX = touch.pageX - data.pageX;
5457		var distY = touch.pageY - data.pageY;
5458
5459		// Do nothing if the threshold has not been crossed.
5460		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
5461
5462		triggerStart(e, data, touch, distX, distY, fn);
5463	}
5464
5465	function triggerStart(e, data, touch, distX, distY, fn) {
5466		var touches = e.targetTouches;
5467		var time = e.timeStamp - data.timeStamp;
5468
5469		// Create a movestart object with some special properties that
5470		// are passed only to the movestart handlers.
5471		var template = {
5472			altKey:     e.altKey,
5473			ctrlKey:    e.ctrlKey,
5474			shiftKey:   e.shiftKey,
5475			startX:     data.pageX,
5476			startY:     data.pageY,
5477			distX:      distX,
5478			distY:      distY,
5479			deltaX:     distX,
5480			deltaY:     distY,
5481			pageX:      touch.pageX,
5482			pageY:      touch.pageY,
5483			velocityX:  distX / time,
5484			velocityY:  distY / time,
5485			identifier: data.identifier,
5486			targetTouches: touches,
5487			finger: touches ? touches.length : 1,
5488			enableMove: function() {
5489				this.moveEnabled = true;
5490				this.enableMove = noop;
5491				e.preventDefault();
5492			}
5493		};
5494
5495		// Trigger the movestart event.
5496		trigger(data.target, 'movestart', template);
5497
5498		// Unbind handlers that tracked the touch or mouse up till now.
5499		fn(data);
5500	}
5501
5502
5503	// Handlers that control what happens following a movestart
5504
5505	function activeMousemove(e, data) {
5506		var timer  = data.timer;
5507
5508		data.touch = e;
5509		data.timeStamp = e.timeStamp;
5510		timer.kick();
5511	}
5512
5513	function activeMouseend(e, data) {
5514		var target = data.target;
5515		var event  = data.event;
5516		var timer  = data.timer;
5517
5518		removeActiveMouse();
5519
5520		endEvent(target, event, timer, function() {
5521			// Unbind the click suppressor, waiting until after mouseup
5522			// has been handled.
5523			setTimeout(function(){
5524				off(target, 'click', preventDefault);
5525			}, 0);
5526		});
5527	}
5528
5529	function removeActiveMouse() {
5530		off(document, mouseevents.move, activeMousemove);
5531		off(document, mouseevents.end, activeMouseend);
5532	}
5533
5534	function activeTouchmove(e, data) {
5535		var event = data.event;
5536		var timer = data.timer;
5537		var touch = changedTouch(e, event);
5538
5539		if (!touch) { return; }
5540
5541		// Stop the interface from gesturing
5542		e.preventDefault();
5543
5544		event.targetTouches = e.targetTouches;
5545		data.touch = touch;
5546		data.timeStamp = e.timeStamp;
5547
5548		timer.kick();
5549	}
5550
5551	function activeTouchend(e, data) {
5552		var target = data.target;
5553		var event  = data.event;
5554		var timer  = data.timer;
5555		var touch  = identifiedTouch(e.changedTouches, event.identifier);
5556
5557		// This isn't the touch you're looking for.
5558		if (!touch) { return; }
5559
5560		removeActiveTouch(data);
5561		endEvent(target, event, timer);
5562	}
5563
5564	function removeActiveTouch(data) {
5565		off(document, touchevents.move, data.activeTouchmove);
5566		off(document, touchevents.end, data.activeTouchend);
5567	}
5568
5569
5570	// Logic for triggering move and moveend events
5571
5572	function updateEvent(event, touch, timeStamp) {
5573		var time = timeStamp - event.timeStamp;
5574
5575		event.distX =  touch.pageX - event.startX;
5576		event.distY =  touch.pageY - event.startY;
5577		event.deltaX = touch.pageX - event.pageX;
5578		event.deltaY = touch.pageY - event.pageY;
5579
5580		// Average the velocity of the last few events using a decay
5581		// curve to even out spurious jumps in values.
5582		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
5583		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
5584		event.pageX =  touch.pageX;
5585		event.pageY =  touch.pageY;
5586	}
5587
5588	function endEvent(target, event, timer, fn) {
5589		timer.end(function(){
5590			trigger(target, 'moveend', event);
5591			return fn && fn();
5592		});
5593	}
5594
5595
5596	// Set up the DOM
5597
5598	function movestart(e) {
5599		if (e.defaultPrevented) { return; }
5600		if (!e.moveEnabled) { return; }
5601
5602		var event = {
5603			startX:        e.startX,
5604			startY:        e.startY,
5605			pageX:         e.pageX,
5606			pageY:         e.pageY,
5607			distX:         e.distX,
5608			distY:         e.distY,
5609			deltaX:        e.deltaX,
5610			deltaY:        e.deltaY,
5611			velocityX:     e.velocityX,
5612			velocityY:     e.velocityY,
5613			identifier:    e.identifier,
5614			targetTouches: e.targetTouches,
5615			finger:        e.finger
5616		};
5617
5618		var data = {
5619			target:    e.target,
5620			event:     event,
5621			timer:     new Timer(update),
5622			touch:     undefined,
5623			timeStamp: e.timeStamp
5624		};
5625
5626		function update(time) {
5627			updateEvent(event, data.touch, data.timeStamp);
5628			trigger(data.target, 'move', event);
5629		}
5630
5631		if (e.identifier === undefined) {
5632			// We're dealing with a mouse event.
5633			// Stop clicks from propagating during a move
5634			on(e.target, 'click', preventDefault);
5635			on(document, mouseevents.move, activeMousemove, data);
5636			on(document, mouseevents.end, activeMouseend, data);
5637		}
5638		else {
5639			// In order to unbind correct handlers they have to be unique
5640			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
5641			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
5642
5643			// We're dealing with a touch.
5644			on(document, touchevents.move, data.activeTouchmove, data);
5645			on(document, touchevents.end, data.activeTouchend, data);
5646		}
5647	}
5648
5649	on(document, 'mousedown', mousedown);
5650	on(document, 'touchstart', touchstart);
5651	on(document, 'movestart', movestart);
5652
5653
5654	// jQuery special events
5655	//
5656	// jQuery event objects are copies of DOM event objects. They need
5657	// a little help copying the move properties across.
5658
5659	if (!window.jQuery) { return; }
5660
5661	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
5662
5663	function enableMove1(e) { e.enableMove(); }
5664	function enableMove2(e) { e.enableMove(); }
5665	function enableMove3(e) { e.enableMove(); }
5666
5667	function add(handleObj) {
5668		var handler = handleObj.handler;
5669
5670		handleObj.handler = function(e) {
5671			// Copy move properties across from originalEvent
5672			var i = properties.length;
5673			var property;
5674
5675			while(i--) {
5676				property = properties[i];
5677				e[property] = e.originalEvent[property];
5678			}
5679
5680			handler.apply(this, arguments);
5681		};
5682	}
5683
5684	jQuery.event.special.movestart = {
5685		setup: function() {
5686			// Movestart must be enabled to allow other move events
5687			on(this, 'movestart', enableMove1);
5688
5689			// Do listen to DOM events
5690			return false;
5691		},
5692
5693		teardown: function() {
5694			off(this, 'movestart', enableMove1);
5695			return false;
5696		},
5697
5698		add: add
5699	};
5700
5701	jQuery.event.special.move = {
5702		setup: function() {
5703			on(this, 'movestart', enableMove2);
5704			return false;
5705		},
5706
5707		teardown: function() {
5708			off(this, 'movestart', enableMove2);
5709			return false;
5710		},
5711
5712		add: add
5713	};
5714
5715	jQuery.event.special.moveend = {
5716		setup: function() {
5717			on(this, 'movestart', enableMove3);
5718			return false;
5719		},
5720
5721		teardown: function() {
5722			off(this, 'movestart', enableMove3);
5723			return false;
5724		},
5725
5726		add: add
5727	};
5728});
5729
5730  $.fn.twentytwenty = function(options) {
5731    var options = $.extend({
5732      default_offset_pct: 0.5,
5733      orientation: 'horizontal',
5734      before_label: 'Before',
5735      after_label: 'After',
5736      no_overlay: false,
5737      move_slider_on_hover: false,
5738      move_with_handle_only: true,
5739      click_to_move: false
5740    }, options);
5741
5742    return this.each(function() {
5743
5744      var sliderPct = options.default_offset_pct;
5745      var container = $(this);
5746      var sliderOrientation = options.orientation;
5747      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
5748      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
5749
5750
5751      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
5752      if(!options.no_overlay) {
5753        container.append("<div class='twentytwenty-overlay'></div>");
5754        var overlay = container.find(".twentytwenty-overlay");
5755        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
5756        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
5757      }
5758      var beforeImg = container.find("img:first");
5759      var afterImg = container.find("img:last");
5760      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
5761      var slider = container.find(".twentytwenty-handle");
5762      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
5763      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
5764      container.addClass("twentytwenty-container");
5765      beforeImg.addClass("twentytwenty-before");
5766      afterImg.addClass("twentytwenty-after");
5767
5768      var calcOffset = function(dimensionPct) {
5769        var w = beforeImg.width();
5770        var h = beforeImg.height();
5771        return {
5772          w: w+"px",
5773          h: h+"px",
5774          cw: (dimensionPct*w)+"px",
5775          ch: (dimensionPct*h)+"px"
5776        };
5777      };
5778
5779      var adjustContainer = function(offset) {
5780      	if (sliderOrientation === 'vertical') {
5781          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
5782          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
5783      	}
5784      	else {
5785          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
5786          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
5787    	}
5788        container.css("height", offset.h);
5789      };
5790
5791      var adjustSlider = function(pct) {
5792        var offset = calcOffset(pct);
5793        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
5794        adjustContainer(offset);
5795      };
5796
5797      // Return the number specified or the min/max number if it outside the range given.
5798      var minMaxNumber = function(num, min, max) {
5799        return Math.max(min, Math.min(max, num));
5800      };
5801
5802      // Calculate the slider percentage based on the position.
5803      var getSliderPercentage = function(positionX, positionY) {
5804        var sliderPercentage = (sliderOrientation === 'vertical') ?
5805          (positionY-offsetY)/imgHeight :
5806          (positionX-offsetX)/imgWidth;
5807
5808        return minMaxNumber(sliderPercentage, 0, 1);
5809      };
5810
5811
5812      $(window).on("resize.twentytwenty", function(e) {
5813        adjustSlider(sliderPct);
5814      });
5815
5816      var offsetX = 0;
5817      var offsetY = 0;
5818      var imgWidth = 0;
5819      var imgHeight = 0;
5820      var onMoveStart = function(e) {
5821        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
5822          e.preventDefault();
5823        }
5824        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
5825          e.preventDefault();
5826        }
5827        container.addClass("active");
5828        offsetX = container.offset().left;
5829        offsetY = container.offset().top;
5830        imgWidth = beforeImg.width();
5831        imgHeight = beforeImg.height();
5832      };
5833      var onMove = function(e) {
5834        if (container.hasClass("active")) {
5835          sliderPct = getSliderPercentage(e.pageX, e.pageY);
5836          adjustSlider(sliderPct);
5837        }
5838      };
5839      var onMoveEnd = function() {
5840          container.removeClass("active");
5841      };
5842
5843      var moveTarget = options.move_with_handle_only ? slider : container;
5844      moveTarget.on("movestart",onMoveStart);
5845      moveTarget.on("move",onMove);
5846      moveTarget.on("moveend",onMoveEnd);
5847
5848      if (options.move_slider_on_hover) {
5849        container.on("mouseenter", onMoveStart);
5850        container.on("mousemove", onMove);
5851        container.on("mouseleave", onMoveEnd);
5852      }
5853
5854      slider.on("touchmove", function(e) {
5855        e.preventDefault();
5856      });
5857
5858      container.find("img").on("mousedown", function(event) {
5859        event.preventDefault();
5860      });
5861
5862      if (options.click_to_move) {
5863        container.on('click', function(e) {
5864          offsetX = container.offset().left;
5865          offsetY = container.offset().top;
5866          imgWidth = beforeImg.width();
5867          imgHeight = beforeImg.height();
5868
5869          sliderPct = getSliderPercentage(e.pageX, e.pageY);
5870          adjustSlider(sliderPct);
5871        });
5872      }
5873
5874      $(window).trigger("resize.twentytwenty");
5875    });
5876  };
5877
5878
5879  $(window).on("load", function(e) {
5880  	$('.twentytwenty-container').each(function(){
5881  		var $container = $(this);
5882  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
5883  			$container.twentytwenty();
5884  		}
5885  		$('img', $container).on('async-done', function(){
5886	  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
5887	  			$container.twentytwenty();
5888	  		}
5889	    });
5890  	});
5891  });
5892}
5893
5894UNCODE.justifiedGallery = function() {
5895
5896	var breakPointMe = function( val ) {
5897		val = parseInt( val );
5898		if ( isNaN(val) ) {
5899			return false;
5900		}
5901		if ( val >= 1500 ) {
5902			return 1;
5903		} else if ( val < 1500 && val >= 960 ) {
5904			return 2;
5905		} else if ( val < 960 && val >= 570 ) {
5906			return 3;
5907		} else if ( val < 570 ) {
5908			return 4;
5909		}
5910	}
5911
5912	var gutterByBreakpoint = function( bp, gutter ) {
5913		var ret;
5914		switch(gutter) {
5915		    case 'no-gutter':
5916		    	ret = 0;
5917		        break;
5918		    case 'px-gutter':
5919		    	ret = 1;
5920		        break;
5921		    case 'half-gutter':
5922		    	ret = 18;
5923		        break;
5924		    case 'double-gutter':
5925				switch(bp) {
5926				    case 3:
5927				    case 4:
5928				    	ret = 36;
5929				        break;
5930				    default:
5931				    	ret = 72;
5932				        break;
5933				}
5934		        break;
5935		    case 'triple-gutter':
5936				switch(bp) {
5937				    case 3:
5938				    case 4:
5939				    	ret = 36;
5940				        break;
5941				    default:
5942				    	ret = 108;
5943				        break;
5944				}
5945		        break;
5946		    case 'quad-gutter':
5947				switch(bp) {
5948				    case 2:
5949				    	ret = 108;
5950				        break;
5951				    case 3:
5952				    	ret = 72;
5953				        break;
5954				    case 4:
5955				    	ret = 36;
5956				        break;
5957				    default:
5958				    	ret = 144;
5959				        break;
5960				}
5961		        break;
5962		    default:
5963		    	ret = 36;//single-gutter
5964		}
5965		return ret;
5966	}
5967
5968	if ($('.justified-layout').length > 0) {
5969		var justifiedContainersArray = [],
5970			typeGridArray = [],
5971			layoutGridArray = [],
5972			transitionDuration = [],
5973			$filterItems = [],
5974			$filters = $('.justified-system .isotope-filters'),
5975			$itemSelector = '.tmb',
5976			$items,
5977			itemMargin,
5978			correctionFactor = 0,
5979			firstLoad = true,
5980			isOriginLeft = $('body').hasClass('rtl') ? false : true,
5981			prevW = breakPointMe(UNCODE.wwidth);
5982		$('[class*="justified-container"]').each(function() {
5983			var isoData = $(this).data();
5984			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
5985			if (isoData.type == 'metro') typeGridArray.push(true);
5986			else typeGridArray.push(false);
5987			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
5988			else layoutGridArray.push('justified');
5989			justifiedContainersArray.push($(this));
5990		});
5991		var init_justifiedGallery = function() {
5992			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
5993				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
5994					justifiedId = justifiedSystem.attr('id'),
5995					$layoutMode = layoutGridArray[i],
5996					gutter = $(justifiedContainersArray[i]).data('gutter'),
5997					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
5998					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
5999					lastRow = $(justifiedContainersArray[i]).data('last-row'),
6000					margins;
6001
6002				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
6003				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
6004				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6005
6006				margins = gutterByBreakpoint(prevW, gutter);
6007
6008				$(justifiedContainersArray[i]).justifiedGallery({
6009					rowHeight: rowHeight,
6010					maxRowHeight: maxRowHeight,
6011					margins: margins,
6012					cssAnimation: true,
6013					lastRow: lastRow,
6014					waitThumbnailsLoad: false
6015				}).one('jg.complete', function(){ onLayout($(this), 0); } );
6016
6017				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
6018					$(justifiedContainersArray[i]).infinitescroll({
6019							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
6020							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6021							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
6022							animate: false,
6023							behavior: 'local',
6024							debug: false,
6025							loading: {
6026								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
6027								speed: 0,
6028								finished: undefined,
6029								msg: $('#' + justifiedId + ' .loadmore-button'),
6030							},
6031							errorCallback: function() {
6032								var justified_system = $(this).closest('.justified-system');
6033								$('.loading-button', justified_system).hide();
6034								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
6035							}
6036						},
6037						// append the new items to galleryJustified on the infinitescroll callback function.
6038						function(newElements, opts) {
6039							var $galleryJustified = $(this),
6040								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
6041								filters = new Array(),
6042								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
6043								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
6044								$numPages = $('a', $infinite_button).data('pages'),
6045								delay = 300;
6046							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6047							$infinite_button.show();
6048							$loading_button.hide();
6049							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6050							$('> li', $galleryJustified).remove();
6051							$.each($(newElements), function(index, val) {
6052								$(val).addClass('tmb-iso');
6053								if ($(val).is("li")) {
6054									filters.push($(val)[0]);
6055								}
6056							});
6057							newElements = newElements.filter(function(x) {
6058								return filters.indexOf(x) < 0
6059							});
6060							$.each($(filters), function(index, val) {
6061								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
6062							});
6063							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
6064							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6065								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
6066								if (typeof getLightbox === 'object') {
6067									getLightbox.refresh();
6068								} else {
6069									UNCODE.lightbox();
6070								}
6071							}
6072							if ( typeof twttr !== 'undefined' )
6073								twttr.widgets.load(justifiedContainersArray[i]);
6074
6075							requestTimeout(function() {
6076								$galleryJustified.trigger('more-items-loaded');
6077								$(window).trigger('more-items-loaded');
6078							}, 1000);
6079						});
6080					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
6081						var $infinite_justified = $(justifiedContainersArray[i]),
6082							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
6083						$infinite_justified.infinitescroll('pause');
6084						$infinite_button.on('click', function(event) {
6085							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6086								$.each(UNCODE.lightboxArray, function(index, val) {
6087									UNCODE.lightboxArray[index].destroy();
6088								});
6089							}
6090							event.preventDefault();
6091							var $justified_system = $(event.target).closest('.justified-system'),
6092							$infinite_justified = $justified_system.find('.justified-container'),
6093							justifiedId = $justified_system.attr('id');
6094							$(event.currentTarget).html(SiteParameters.loading);
6095							$infinite_justified.infinitescroll('resume');
6096							$infinite_justified.infinitescroll('retrieve');
6097							$infinite_justified.infinitescroll('pause');
6098							$infinite_justified.trigger('more-items-loaded');
6099							$(window).trigger('more-items-loaded');
6100						});
6101					}
6102				}
6103			}
6104		},
6105		onLayout = function(justifiedObj, startIndex) {
6106			justifiedObj.css('opacity', 1);
6107			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
6108			$('.tmb', justifiedObj).addClass('justified-object-loaded');
6109
6110			requestTimeout(function() {
6111				// window.dispatchEvent(UNCODE.boxEvent);
6112				UNCODE.adaptive();
6113				if (SiteParameters.dynamic_srcset_active === '1') {
6114					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
6115				}
6116				if (typeof MediaElement === "function") {
6117					$(justifiedObj).find('audio,video').each(function() {
6118						$(this).mediaelementplayer({
6119								pauseOtherPlayers: false,
6120						});
6121					});
6122				}
6123				if ($(justifiedObj).find('.nested-carousel').length) {
6124					if (typeof UNCODE.carousel !== 'undefined') {
6125						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
6126					}
6127					requestTimeout(function() {
6128						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6129						justifiedObj.addClass('justified-gallery-finished')
6130						Waypoint.refreshAll();
6131					}, 200);
6132				} else {
6133					requestTimeout(function() {
6134						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6135						justifiedObj.addClass('justified-gallery-finished')
6136						Waypoint.refreshAll();
6137					}, 300);
6138				}
6139			}, 100);
6140
6141		},
6142		boxAnimation = function(items, startIndex, sequential, container) {
6143			var $allItems = items.length - startIndex,
6144				showed = 0,
6145				index = 0;
6146			if (container.closest('.owl-item').length == 1) return false;
6147			$.each(items, function(index, val) {
6148				var elInner = $('> .t-inside', val);
6149				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
6150					return;
6151				}
6152				if (val[0]) val = val[0];
6153				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
6154					new Waypoint({
6155						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
6156						element: val,
6157						handler: function() {
6158							var element = $('> .t-inside', this.element),
6159								parent = $(this.element),
6160								currentIndex = parent.index();
6161							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
6162								delayAttr = parseInt(element.attr('data-delay'));
6163							if (isNaN(delayAttr)) delayAttr = 100;
6164							delay -= showed;
6165							var objTimeout = requestTimeout(function() {
6166								element.removeClass('zoom-reverse').addClass('start_animation');
6167								showed = parent.index();
6168							}, delay * delayAttr);
6169							parent.data('objTimeout', objTimeout);
6170							if (!UNCODE.isUnmodalOpen) {
6171								this.destroy();
6172							}
6173						},
6174						offset: '100%'
6175					})
6176				} else {
6177					elInner.removeClass('animate_when_almost_visible');
6178					$(val).addClass('no-waypoint-animation');
6179					/*if (elInner.hasClass('force-anim')) {
6180						elInner.addClass('start_animation');
6181					} else {
6182						elInner.css('opacity', 1);
6183					}*/
6184				}
6185				index++;
6186			});
6187		};
6188		$filters.on('click', 'a[data-filter]', function(evt) {
6189			var $filter = $(this),
6190				filterContainer = $filter.closest('.isotope-filters'),
6191				filterValue = $filter.attr('data-filter'),
6192				container = $filter.closest('.justified-system').find($('.justified-layout')),
6193				lastRow = container.data('last-row'),
6194				transitionDuration = 0,
6195				delay = 300,
6196				filterItems = [];
6197
6198			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6199
6200			var filter_items = function(){
6201				if (filterValue !== undefined) {
6202					$.each($('> .tmb > .t-inside', container), function(index, val) {
6203						var parent = $(val).parent(),
6204							objTimeout = parent.data('objTimeout');
6205						if (objTimeout) {
6206							$(val).removeClass('zoom-reverse');
6207							clearRequestTimeout(objTimeout);
6208						}
6209						if (transitionDuration == 0) {
6210							if ($(val).hasClass('animate_when_almost_visible')) {
6211								$(val).addClass('zoom-reverse').removeClass('start_animation');
6212							} else {
6213								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6214							}
6215						}
6216					});
6217
6218					requestTimeout(function() {
6219						var $block,
6220							selector,
6221							lightboxElements,
6222							$boxes;
6223
6224						if ( filterValue !== '' && filterValue !== '*' ) {
6225							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
6226							selector = '.' + filterValue;
6227							$.each($(selector, container), function(index, block) {
6228								lightboxElements = $('[data-lbox^=ilightbox]', block);
6229								if (lightboxElements.length) {
6230									lightboxElements.removeClass('lb-disabled');
6231									container.data('lbox', $(lightboxElements[0]).data('lbox'));
6232								}
6233								filterItems.push(block);
6234							});
6235							container.justifiedGallery({
6236								filter: selector,
6237								lastRow: 'nojustify'
6238							});
6239						} else {
6240							container.justifiedGallery({
6241								filter: false,
6242								lastRow: lastRow
6243							});
6244							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
6245							filterItems = $('> .tmb', container);
6246						}
6247						container.trigger('more-items-loaded');
6248						$(window).trigger('more-items-loaded');
6249
6250						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
6251						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6252							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
6253							if (typeof getLightbox === 'object') {
6254								getLightbox.refresh();
6255							} else {
6256								UNCODE.lightbox();
6257							}
6258						}
6259
6260						if (transitionDuration == 0) {
6261							requestTimeout(function() {
6262								boxAnimation(filterItems, 0, false, container);
6263							}, 100);
6264						}
6265						requestTimeout(function() {
6266							Waypoint.refreshAll();
6267							container.trigger('more-items-loaded');
6268							$(window).trigger('more-items-loaded');
6269						}, 2000);
6270
6271					}, delay);
6272				} else {
6273					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6274						$.each(UNCODE.lightboxArray, function(index, val) {
6275							UNCODE.lightboxArray[index].destroy();
6276						});
6277					}
6278					$.each($('> .tmb > .t-inside', container), function(index, val) {
6279						var parent = $(val).parent(),
6280							objTimeout = parent.data('objTimeout');
6281						if (objTimeout) {
6282							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6283							clearRequestTimeout(objTimeout);
6284						}
6285						if (transitionDuration == 0) {
6286							if ($(val).hasClass('animate_when_almost_visible')) {
6287								$(val).addClass('zoom-reverse').removeClass('start_animation');
6288							} else {
6289								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6290							}
6291						}
6292					});
6293					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6294						UNCODE.lightbox();
6295					}
6296					container.parent().addClass('justified-loading');
6297					container.trigger('more-items-loaded');
6298					$(window).trigger('more-items-loaded');
6299				}
6300			};
6301
6302			if (!$filter.hasClass('active')) {
6303				/** Scroll top with filtering */
6304				if (filterContainer.hasClass('filter-scroll')) {
6305                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6306                    calc_scroll -= UNCODE.get_scroll_offset();
6307
6308					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6309						delta = bodyTop - calc_scroll,
6310						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
6311						filterTolerance = false,
6312						filter_timeout;
6313					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6314
6315					if ( !UNCODE.isFullPage ) {
6316						if (scrollSpeed == 0) {
6317							$('html, body').scrollTop(calc_scroll);
6318							UNCODE.scrolling = false;
6319							filter_items();
6320						} else {
6321
6322							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
6323								filter_items();
6324								filterTolerance = true;
6325							}
6326
6327							$('html, body').animate({
6328								scrollTop: calc_scroll
6329							},{
6330								easing: 'easeInOutQuad',
6331								duration: scrollSpeed,
6332								complete: function(){
6333									UNCODE.scrolling = false;
6334									if ( !filterTolerance ) {
6335										filter_timeout = setTimeout(function(){
6336											clearTimeout(filter_timeout);
6337											filter_items();
6338										}, 200);
6339									}
6340								}
6341							});
6342						}
6343					}
6344				} else {
6345					filter_items();
6346				}
6347			}
6348			evt.preventDefault();
6349		});
6350
6351		$filters.each(function(i, buttonGroup) {
6352			var $buttonGroup = $(buttonGroup);
6353			$buttonGroup.on('click', 'a', function() {
6354				$buttonGroup.find('.active').removeClass('active');
6355				$(this).addClass('active');
6356			});
6357
6358			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
6359				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
6360				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
6361			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
6362				e.preventDefault();
6363				$cats_filters.slideToggle(400, 'easeInOutCirc');
6364			});
6365		});
6366		window.addEventListener('boxResized', function(e) {
6367			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
6368				prevW = breakPointMe(UNCODE.wwidth);
6369				$.each($('.justified-layout'), function(index, val) {
6370					var gutter = $(this).data('gutter'),
6371						margins = gutterByBreakpoint( prevW, gutter);
6372					$(this).justifiedGallery({
6373						margins: margins
6374					});
6375					$(this).find('.mejs-video,.mejs-audio').each(function() {
6376						$(this).trigger('resize');
6377					});
6378				});
6379			}
6380		}, false);
6381
6382		init_justifiedGallery();
6383	};
6384};
6385
6386UNCODE.cssGrid = function() {
6387	if ($('.cssgrid-layout').length > 0) {
6388		var cssGridContainersArray = [];
6389		var transitionDuration = [];
6390		var $filters = $('.cssgrid-system .cssgrid-filters');
6391
6392		$('[class*="cssgrid-container"]').each(function() {
6393			cssGridContainersArray.push($(this));
6394			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6395		});
6396
6397		var init_cssGridAjax = function() {
6398			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
6399				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
6400					cssGridId = cssGridSystem.attr('id');
6401
6402				cssGridSystem.data('transitionDuration', transitionDuration[i]);
6403
6404				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
6405					$(cssGridContainersArray[i]).infinitescroll({
6406						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
6407						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6408						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat', // selector for all items you'll retrieve
6409						animate: false,
6410						behavior: 'local',
6411						debug: false,
6412						loading: {
6413							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
6414							speed: 0,
6415							finished: undefined,
6416							msg: $('#' + cssGridId + ' .loadmore-button'),
6417						},
6418						errorCallback: function() {
6419							var cssgrid_system = $(this).closest('.cssgrid-system');
6420							$('.loading-button', cssgrid_system).hide();
6421							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
6422						}
6423					},
6424					// append the new items to cssGrid on the infinitescroll callback function.
6425					function(newElements, opts) {
6426						var $cssGrid = $(this),
6427							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
6428							cssGridId = cssGridSystemCont.attr('id'),
6429							filters = new Array(),
6430							$loading_button = $cssGrid.closest('.cssgrid-system').find('.loading-button'),
6431							$infinite_button = $cssGrid.closest('.cssgrid-system').find('.loadmore-button'),
6432							$numPages = $('a', $infinite_button).data('pages'),
6433							delay = 300;
6434						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6435						$infinite_button.show();
6436						$loading_button.hide();
6437						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6438						$('> li', $cssGrid).remove();
6439						$.each($(newElements), function(index, val) {
6440							$(val).addClass('tmb-grid');
6441							if ($(val).is("li")) {
6442								filters.push($(val)[0]);
6443							}
6444						});
6445						newElements = newElements.filter(function(x) {
6446							return filters.indexOf(x) < 0
6447						});
6448						$.each($(filters), function(index, val) {
6449							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
6450						});
6451
6452						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
6453						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
6454						if (filterValue !== undefined && filterValue != '*') {
6455							$(newElements).hide();
6456							var els_to_show = $();
6457							$(newElements).each(function() {
6458								var el = $(this);
6459								if (el.hasClass(filterValue)) {
6460									els_to_show = els_to_show.add(el);
6461									el.show();
6462								}
6463							});
6464							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
6465						} else {
6466							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
6467						}
6468
6469						UNCODE.adaptive();
6470						if (SiteParameters.dynamic_srcset_active === '1') {
6471							UNCODE.refresh_dynamic_srcset_size($cssGrid);
6472						}
6473						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6474							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
6475							if (typeof getLightbox === 'object') {
6476								getLightbox.refresh();
6477							} else {
6478								UNCODE.lightbox();
6479							}
6480						}
6481						if ( typeof twttr !== 'undefined' ) {
6482							twttr.widgets.load(cssGridContainersArray[i]);
6483						}
6484
6485						UNCODE.carousel($(newElements));
6486						requestTimeout(function() {
6487							$cssGrid.trigger('more-items-loaded');
6488							$(window).trigger('more-items-loaded');
6489						}, 1000);
6490
6491					});
6492					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
6493						var $cssgrid_el = $(cssGridContainersArray[i]),
6494							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
6495						$cssgrid_el.infinitescroll('pause');
6496						$infinite_button.on('click', function(event) {
6497							event.preventDefault();
6498							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
6499							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
6500							cssGridId = $cssgrid_system.attr('id');
6501							$(event.currentTarget).html(SiteParameters.loading);
6502							$cssgrid_el.infinitescroll('resume');
6503							$cssgrid_el.infinitescroll('retrieve');
6504							$cssgrid_el.infinitescroll('pause');
6505						});
6506					}
6507				}
6508			}
6509		};
6510
6511		init_cssGridAjax();
6512
6513		if ($('.cssgrid-pagination').length > 0) {
6514			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
6515				evt.preventDefault();
6516
6517				if (SiteParameters.index_pagination_disable_scroll !== '1') {
6518					var container = $(this).closest('.cssgrid-system'),
6519					calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6520
6521					calc_scroll -= UNCODE.get_scroll_offset();
6522
6523					var menu_container = $('.menu-sticky');
6524					var menu = menu_container.find('.menu-container');
6525
6526					if (menu_container.length > 0 && menu.length > 0) {
6527						calc_scroll = calc_scroll - menu.outerHeight();
6528					}
6529
6530					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6531						delta = bodyTop - calc_scroll,
6532						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
6533					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6534
6535					if ( !UNCODE.isFullPage ) {
6536						if (scrollSpeed == 0) {
6537							$('html, body').scrollTop(calc_scroll);
6538						} else {
6539							$('html, body').animate({
6540								scrollTop: calc_scroll
6541							},{
6542								easing: 'easeInOutQuad',
6543								duration: scrollSpeed,
6544								complete: function(){
6545									UNCODE.scrolling = false;
6546								}
6547							});
6548						}
6549					}
6550				}
6551
6552				loadCssGrid($(this), true);
6553			});
6554		}
6555
6556		$filters.on('click', 'a.grid-nav-link', function(evt) {
6557			if ($(this).hasClass('no-grid-filter')) {
6558				return;
6559			}
6560			var $filter = $(this),
6561				filterContainer = $filter.closest('.cssgrid-filters'),
6562				filterValue = $filter.attr('data-filter'),
6563				containerSystem = $filter.closest('.cssgrid-system'),
6564				container = containerSystem.find($('.cssgrid-layout')),
6565				transitionDuration = containerSystem.data('transitionDuration'),
6566				delay = 300,
6567				filterItems = [],
6568				all_thumbs = container.find('.tmb-grid');
6569
6570			var filter_items = function(){
6571				if (filterValue !== undefined) {
6572					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
6573						var parent = $(val).parent(),
6574							objTimeout = parent.data('objTimeout');
6575						if (objTimeout) {
6576							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6577							clearRequestTimeout(objTimeout);
6578						}
6579						if (transitionDuration == 0) {
6580							if ($(val).hasClass('animate_when_almost_visible')) {
6581								$(val).addClass('zoom-reverse').removeClass('start_animation');
6582							} else {
6583								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6584							}
6585						}
6586					});
6587					requestTimeout(function(){
6588						if ( filterValue == '*' ) {
6589							all_thumbs.show();
6590							all_thumbs.each(function(index, val) {
6591								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
6592								filterItems.push($(this));
6593							});
6594						} else {
6595							all_thumbs.each(function() {
6596								var _tmb = $(this);
6597								if (_tmb.hasClass(filterValue)) {
6598									_tmb.show();
6599									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
6600									filterItems.push(_tmb);
6601								} else {
6602									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
6603									_tmb.hide();
6604								}
6605							});
6606						}
6607
6608						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
6609
6610						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
6611						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
6612						var lightboxElements = $('[data-lbox^=ilightbox]', container);
6613						if (lightboxElements.length) {
6614							container.data('lbox', $(lightboxElements[0]).data('lbox'));
6615							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6616								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
6617								if (typeof getLightbox === 'object') {
6618									getLightbox.refresh();
6619								} else {
6620									UNCODE.lightbox();
6621								}
6622							}
6623						}
6624						container.trigger('more-items-loaded');
6625						$(window).trigger('more-items-loaded');
6626					}, delay);
6627				} else {
6628					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
6629						var parent = $(val).parent(),
6630							objTimeout = parent.data('objTimeout');
6631						if (objTimeout) {
6632							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6633							clearRequestTimeout(objTimeout);
6634						}
6635						if (transitionDuration == 0) {
6636							if ($(val).hasClass('animate_when_almost_visible')) {
6637								$(val).addClass('zoom-reverse').removeClass('start_animation');
6638							} else {
6639								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6640							}
6641						}
6642					});
6643					loadCssGrid($filter);
6644				}
6645			};
6646
6647			if (!$filter.hasClass('active')) {
6648				/** Scroll top with filtering */
6649				if (filterContainer.hasClass('filter-scroll')) {
6650                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6651                    calc_scroll -= UNCODE.get_scroll_offset();
6652
6653					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6654						delta = bodyTop - calc_scroll,
6655						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
6656						filterTolerance = false,
6657						filter_timeout;
6658					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6659
6660					if ( !UNCODE.isFullPage ) {
6661						if (scrollSpeed == 0) {
6662							$('html, body').scrollTop(calc_scroll);
6663							UNCODE.scrolling = false;
6664							filter_items();
6665						} else {
6666
6667							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
6668								filter_items();
6669								filterTolerance = true;
6670							}
6671
6672							$('html, body').animate({
6673								scrollTop: calc_scroll
6674							},{
6675								easing: 'easeInOutQuad',
6676								duration: scrollSpeed,
6677								complete: function(){
6678									UNCODE.scrolling = false;
6679									if ( !filterTolerance ) {
6680										filter_timeout = setTimeout(function(){
6681											clearTimeout(filter_timeout);
6682											filter_items();
6683										}, 200);
6684									}
6685								}
6686							});
6687						}
6688					}
6689				} else {
6690					filter_items();
6691				}
6692			}
6693			evt.preventDefault();
6694		});
6695
6696		$(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) {
6697			var params = UNCODE.getURLParams(window.location);
6698			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
6699
6700			UNCODE.lastURL = window.location.href;
6701
6702			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
6703				return;
6704			}
6705
6706			if (params.id === undefined) {
6707				$.each($('.cssgrid-system'), function(index, val) {
6708					loadCssGrid($(val));
6709				});
6710			} else {
6711				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
6712					loadCssGrid($('#' + params.id));
6713				}
6714			}
6715		});
6716
6717		var loadCssGrid = function($href, $paginating) {
6718			var is_paginating = false;
6719
6720			if (undefined !== $paginating && $paginating) {
6721				var is_paginating = $paginating;
6722			}
6723
6724			var href = ($href.is("a") ? $href.attr('href') : location),
6725				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
6726				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
6727				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
6728				cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')),
6729				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
6730				cssgridId = cssgridSystem.attr('id');
6731			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
6732				UNCODE.lastURL = href;
6733				history.pushState({
6734					myCSSgrid: true
6735				}, document.title, href);
6736			}
6737			cssgridWrapper.addClass('cssgrid-loading');
6738			if (is_paginating) {
6739				cssgridWrapper.addClass('grid-filtering');
6740			}
6741			$.ajax({
6742				url: href
6743			}).done(function(data) {
6744				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
6745					$resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0],
6746					$resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0];
6747				requestTimeout(function() {
6748					cssgridContainer.html($resultItems);
6749					cssgridWrapper.removeClass('cssgrid-loading');
6750					cssgridWrapper.removeClass('grid-filtering');
6751					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
6752					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false);
6753					UNCODE.adaptive();
6754					if (SiteParameters.dynamic_srcset_active === '1') {
6755						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
6756					}
6757					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6758						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
6759						if (typeof getLightbox === 'object') {
6760							getLightbox.refresh();
6761						} else {
6762							UNCODE.lightbox();
6763						}
6764					}
6765					cssgridContainer.trigger('more-items-loaded');
6766					$(window).trigger('more-items-loaded');
6767				}, 300);
6768
6769				$('.pagination', cssgridFooter).remove();
6770				cssgridFooter.append($resultPagination);
6771
6772				if (cssgridResultCount.length > 0) {
6773					$('.woocommerce-result-count', cssgridResultCount).remove();
6774					cssgridResultCount.append($resultCount);
6775				}
6776			});
6777		};
6778
6779		$filters.each(function(i, buttonGroup) {
6780			var $buttonGroup = $(buttonGroup);
6781			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
6782				$buttonGroup.find('.active').removeClass('active');
6783				$(this).addClass('active');
6784
6785			});
6786
6787			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
6788				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
6789				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
6790			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
6791				e.preventDefault();
6792				$cats_filters.slideToggle(400, 'easeInOutCirc');
6793			});
6794
6795		});
6796	};
6797};
6798
6799UNCODE.preventDoubleTransition = function() {
6800	$('.sticky-element .animate_when_almost_visible').each(function(){
6801		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
6802			$el.addClass('do_not_reanimate');
6803		});
6804	});
6805};
6806
6807UNCODE.checkScrollForTabs = function(){
6808	var goToSection = window.location.hash.replace('#', ''),
6809		$index;
6810
6811	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
6812	goToSection = encodeURIComponent(goToSection);
6813	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
6814
6815	$index.attr('data-parent', 'parent-' + goToSection);
6816
6817	if (window.location.hash != undefined && window.location.hash != '') {
6818		requestTimeout(function() {
6819			scrollBody('parent-' + goToSection);
6820		}, 500);
6821	}
6822
6823	$('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
6824		var hash = (e.currentTarget).hash,
6825			index = (e.currentTarget).closest('.uncode-tabs');
6826		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
6827			$('a[href="' + hash + '"][data-tab-history]').click();
6828			scrollBody(index);
6829		}
6830	});
6831
6832	var scrollBody = function(index) {
6833
6834		var getSection = $('a[href="' + index + '"][data-tab-history]'),
6835			scrollTo,
6836			safeGap = 27;
6837
6838		if ( ! getSection.length ) {
6839			getSection = $('div[data-parent="' + index + '"]');
6840
6841			if ( getSection.attr('data-target') == 'row' ) {
6842				getSection = getSection.closest('.vc_row');
6843				safeGap = 0;
6844			}
6845		}
6846
6847		if (typeof getSection === 'undefined' || ! getSection.length ) {
6848			return;
6849		}
6850
6851		var body = $("html, body"),
6852		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6853		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
6854		getOffset = UNCODE.get_scroll_offset();
6855		if ( typeof getSection.offset() === 'undefined' )
6856			return;
6857		scrollTo = getSection.offset().top - safeGap;
6858		scrollTo -= getOffset;
6859
6860		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
6861		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6862
6863		if (index != 0) {
6864			UNCODE.scrolling = true;
6865		}
6866
6867		if (scrollSpeed == 0) {
6868			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
6869			UNCODE.scrolling = false;
6870		} else {
6871			body.animate({
6872				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
6873			}, scrollSpeed, 'easeInOutQuad', function() {
6874				requestTimeout(function() {
6875					UNCODE.scrolling = false;
6876					if (getOffset != UNCODE.get_scroll_offset()) {
6877						scrollBody(index);
6878					}
6879				}, 100);
6880			});
6881		}
6882
6883	};
6884};
6885
6886UNCODE.printScreen = function() {
6887	var inlineMediaStyle = null,
6888		setResize;
6889
6890    function changeMediaStyle() {
6891		clearRequestTimeout(setResize);
6892		setResize = requestTimeout(function(){
6893	        var $head = document.getElementsByTagName('head')[0],
6894	        	$newStyle = document.createElement('style'),
6895	        	winW = window.innerWidth,
6896	        	printH = window.innerHeight;
6897
6898	        $newStyle.setAttribute('type', 'text/css');
6899	        $newStyle.setAttribute('media', 'print');
6900	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
6901
6902	        if (inlineMediaStyle != null) {
6903	            $head.replaceChild($newStyle, inlineMediaStyle)
6904	        } else {
6905	            $head.appendChild($newStyle);
6906	        }
6907	        inlineMediaStyle = $newStyle;
6908	    }, 1000);
6909    }
6910
6911    changeMediaStyle();
6912    window.addEventListener('resize', changeMediaStyle);
6913};
6914
6915UNCODE.fullPage = function() {
6916	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
6917		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
6918		return false;
6919	} else {
6920		requestTimeout(function() {
6921			window.scrollTo(0, 0);
6922		}, 10);
6923	}
6924
6925	var $masthead = $('#masthead'),
6926		$logo = $('#logo-container-mobile'),
6927		$logolink = $('[data-minheight]', $logo),
6928		logoMinScale = $logolink.data('minheight'),
6929		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
6930		$container = $('.main-container .post-content'),
6931		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
6932		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
6933		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
6934		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
6935		headerWithOpacity = $('.header-scroll-opacity', $header).length,
6936		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
6937		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
6938		scrollBar = true,
6939		effect,
6940		animationEndTimeOut,
6941		fp_anim_time = 900,
6942		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
6943		is_scrolling = false,
6944		dataNames = [],
6945		is_first = true,
6946		no_history = $('body').hasClass('uncode-scroll-no-history'),
6947		theres_footer = true;
6948
6949	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
6950		$('> div', $footer).each(function(index, el){
6951			if ( $(el).outerHeight() < 2 )
6952				theres_footer = false;
6953			else
6954				theres_footer = true;
6955		});
6956	}
6957
6958	if ( !$footer.length )
6959		theres_footer = false;
6960
6961	if ( !UNCODE.isFullPageSnap ) {
6962
6963		if ( $('body').hasClass('uncode-fullpage-zoom') )
6964			effect = 'scaleDown';
6965		else if ( $('body').hasClass('uncode-fullpage-parallax') )
6966			effect = 'moveparallax';
6967		else
6968			effect = 'movecurtain';
6969	}
6970
6971	if ( $('body').hasClass('uncode-fullpage-trid') )
6972		fp_anim_time = fp_anim_time*2;
6973
6974	if ( $header.length ) {
6975		if ( headerName !== '' )
6976			$header.attr('data-name', headerName);
6977		if ( headerLabel !== '' )
6978			$header.attr('data-label', headerLabel);
6979		$container.prepend($header);
6980	}
6981	if ( theres_footer ) {
6982		$container.append($footer);
6983		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
6984		$('aside.widget ul', $footer).addClass('no-list');
6985	}
6986
6987	var $all = $rows.add($header);
6988
6989	if ( theres_footer )
6990		$all = $all.add($footer);
6991
6992	$all.each(function(index, row) {
6993		if( index === 0 )
6994			$(row).addClass('uncode-scroll-active');
6995	});
6996
6997	if ( !UNCODE.isMobile && !$('body').hasClass('uncode-scroll-no-dots') )
6998		$("<ul class='onepage-pagination'></ul>").prependTo("body");
6999
7000	$all.each(function(index, val) {
7001		var getName = $(val).data('name'),
7002			label;
7003
7004		if (typeof getName == 'undefined' || getName == 'undefined')
7005			getName = SiteParameters.slide_name + '-' + index;
7006
7007		//if ( dataNames.includes(getName) ) {
7008		if ( dataNames.indexOf(getName) > 0 ) {
7009			getName += '_' + index;
7010			$(val).data('name', getName);
7011		}
7012
7013		dataNames.push(getName);
7014
7015		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
7016
7017		if (typeof $(val).attr('data-label') !== 'undefined')
7018			label = $(val).attr('data-label');
7019		else label = '';
7020
7021		if ( $(val).is($footer) )
7022			return;
7023
7024		if (label != '' ) {
7025			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
7026			$('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>");
7027		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
7028			$('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>");
7029		}
7030	});
7031
7032	var checkVisible = function( el, off ) {
7033		if (typeof jQuery === "function" && el instanceof jQuery) {
7034			el = el[0];
7035		}
7036
7037		off = typeof off=='undefined' ? 50 : off;
7038
7039		var rect = el.getBoundingClientRect();
7040
7041		return (
7042			(
7043				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7044				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7045				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
7046			)
7047		);
7048	};
7049
7050	var animationEndAction = function( index, nextIndex ) {
7051		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
7052			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7053			player, iframe;
7054
7055		if ( !$nextSlide.is($footer) ) {
7056			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
7057		}
7058
7059		if ( !UNCODE.isFullPageSnap ) {
7060			activateKBurns( nextIndex );
7061		}
7062
7063		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
7064			if ($(this).attr('data-provider') == 'vimeo') {
7065				iframe = $(this).find('iframe');
7066				player = new Vimeo.Player(iframe[0]);
7067				player.pause();
7068			} else if ($(this).attr('data-provider') == 'youtube') {
7069				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
7070			} else {
7071				if ($(this).is('video')) {
7072					$(this)[0].volume = 0;
7073					$(this)[0].pause();
7074				}
7075			}
7076		});
7077
7078		if ( ! UNCODE.isMobile && headerWithOpacity ) {
7079			if ( $nextSlide.is($header) )
7080				$header.removeClass('header-scrolled');
7081		}
7082
7083		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
7084		$otherEl.each(function(){
7085			var $otherThis = $(this),
7086				$bgwrapperOther = $('.background-inner', $otherThis);
7087			if ( !checkVisible($otherThis) )
7088				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
7089
7090		});
7091
7092		if ( !checkVisible($currentSlide) ) {
7093			$currentSlide.removeClass('uncode-scroll-visible');
7094			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
7095			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
7096				currentScroll.scrollTo(0, 0, 0);
7097		}
7098
7099		clearRequestTimeout(animationEndTimeOut);
7100		animationEndTimeOut = requestTimeout(function(){
7101			Waypoint.refreshAll();
7102			$( document.body ).trigger('uncode_waypoints');
7103			var eventFP = new CustomEvent('fp-slide-changed');
7104			window.dispatchEvent(eventFP);
7105			is_scrolling = false;
7106
7107			if ( is_first ) {
7108				$('ul.onepage-pagination a').removeClass('is-selected');
7109				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
7110				is_first = false;
7111			}
7112
7113		}, 500);
7114	};
7115
7116	var postLeaveActions = function( nextIndex ){
7117		if ( menuHidden && ! UNCODE.isMobile )
7118			return false;
7119
7120		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7121			$cols = $('.uncol', $el),
7122			anchor = $el.data('anchor');
7123
7124		if ( ! UNCODE.isFullPageSnap ) {
7125			$.each($cols, function(index, val){
7126				if ( $(val).hasClass('style-light') ){
7127					$masthead.removeClass('style-dark-override').addClass('style-light-override');
7128					return false;
7129				} else if ( $(val).hasClass('style-dark') ) {
7130					$masthead.removeClass('style-light-override').addClass('style-dark-override');
7131					return false;
7132				}
7133			});
7134		}
7135
7136		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
7137			$('.menu-item' ).removeClass('active');
7138			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
7139		}
7140
7141		if ( !UNCODE.isFullPageSnap ) {
7142			activateBackWash( nextIndex );
7143		}
7144	};
7145
7146	var activateBackWash = function( nextIndex ){
7147		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7148			$bgwrapper;
7149
7150		if ( $el.length ) {
7151			if ( $el.hasClass('with-zoomout') ) {
7152				$bgwrapper = $('.background-inner:nth-child(1)', $el);
7153			} else if ( $('.with-zoomout', $el).length ) {
7154				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
7155			} else {
7156				return false;
7157			}
7158		} else {
7159			return false;
7160		}
7161
7162		$bgwrapper.addClass('uncode-zoomout');
7163
7164	};
7165
7166	var activateKBurns = function( nextIndex ){
7167		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7168			$bgwrapper;
7169
7170		if ( $el.length ) {
7171			if ( $el.hasClass('with-kburns') ) {
7172				$bgwrapper = $('.background-inner:nth-child(1)', $el);
7173			} else if ( $('.with-kburns', $el).length ) {
7174				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
7175			} else {
7176				return false;
7177			}
7178		} else {
7179			return false;
7180		}
7181
7182		$bgwrapper.addClass('uncode-kburns');
7183
7184	};
7185
7186	var activateParallax = function( nextIndex, direction ){
7187
7188		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7189			$cell = $('.fp-tableCell', $el),
7190			animationEnd = 'webkitAnimationEnd animationend',
7191			cellAnim;
7192
7193		switch( direction ) {
7194			case 'up':
7195				cellAnim = 'moveFromTopInner';
7196				break;
7197			default:
7198				cellAnim = 'moveFromBottomInner';
7199		}
7200
7201		$cell.css({
7202			'animation-name': cellAnim,
7203			'animation-duration': fp_anim_time + 'ms',
7204			'animation-delay': '',
7205			'animation-timing-function': fp_easing,
7206			'animation-fill-mode': 'both',
7207		}).off(animationEnd)
7208		.on(animationEnd, function(event) {
7209			if ( event.originalEvent.animationName === cellAnim ) {
7210				$cell
7211					.css({
7212						'animation-name': '',
7213						'animation-duration': '',
7214						'animation-delay': '',
7215						'animation-timing-function': '',
7216						'animation-fill-mode': '',
7217					});
7218			}
7219		});
7220	};
7221
7222	var scrollHashes = function(){
7223		var hash = window.location.hash.replace('#', '').split('/'),
7224			hashInd;
7225		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
7226			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
7227				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
7228				$.fn.fullpage.moveTo(hashInd+1);
7229			}
7230		} else if( hash[0] === '' ) {
7231			$.fn.fullpage.moveTo(1);
7232		}
7233	};
7234
7235	var hideMenu = function( index, nextIndex ){
7236		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
7237			return false;
7238
7239		var hMenu = UNCODE.menuHeight,
7240			transTime = hMenu * 2;
7241
7242		if ( index === 1 && nextIndex > 1 ) {
7243			hMenu = hMenu * -1;
7244		} else if  ( index !== 1 && nextIndex === 1 ) {
7245			hMenu = 0;
7246		} else {
7247			return false;
7248		}
7249
7250		$masthead.css({
7251			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
7252			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
7253			'-webkit-transition': 'transform 0.5s ease-in-out',
7254			'transition': 'transform 0.5s ease-in-out'
7255		});
7256	};
7257
7258	var shrinkMenu = function( index, nextIndex ){
7259		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
7260			return false;
7261
7262		if ( index === 1 && nextIndex > 1 ) {
7263			$logo.addClass('shrinked');
7264			$('div', $logo).each(function(index, val){
7265				$(val).css({
7266					'height': logoMinScale,
7267					'line-height': logoMinScale
7268				});
7269				if ($(val).hasClass('text-logo')) {
7270					$(val).css({
7271						'font-size': logoMinScale + 'px'
7272					});
7273				}
7274			});
7275			requestTimeout(function() {
7276				UNCODE.menuMobileHeight = $masthead.outerHeight();
7277			}, 300);
7278		} else if ( index !== 1 && nextIndex === 1 ) {
7279			$logo.removeClass('shrinked');
7280			$('div', $logo).each(function(index, val){
7281				$(val).css({
7282					'height': logoMaxScale,
7283					'line-height': logoMaxScale
7284				});
7285				if ($(val).hasClass('text-logo')) {
7286					$(val).css({
7287						'font-size': logoMaxScale + 'px'
7288					});
7289				}
7290			});
7291			requestTimeout(function() {
7292				UNCODE.menuMobileHeight = $masthead.outerHeight();
7293			}, 300);
7294		} else {
7295			return false;
7296		}
7297
7298	};
7299
7300	var anchorLink = function(){
7301
7302		$container.add('.menu-item').find('a[href*="#"]').click(function(e) {
7303			var $this = $(e.currentTarget),
7304				hash = e.currentTarget.href.split('#'),
7305				current = window.location.href.split('#'),
7306				ind,
7307				currentMenuOpened = UNCODE.menuOpened,
7308				go = false;
7309
7310			var hash_url = hash[0].replace(/\/?$/, '/'),
7311				current_url = current[0].replace(/\/?$/, '/');
7312
7313			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
7314				hash = '#'+hash[1];
7315				e.preventDefault();
7316				go = true;
7317			}
7318
7319			if ( go ) {
7320
7321				if ( $(hash).length ) {
7322					ind = $(hash).closest('.fp-section').index();
7323				} else {
7324					hash = hash.slice(1);
7325					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
7326				}
7327
7328				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
7329					ind = $this.closest('.fp-section').index();
7330
7331				UNCODE.menuOpened = false;
7332
7333				$.fn.fullpage.moveTo(ind+1);
7334
7335				UNCODE.menuOpened = currentMenuOpened;
7336				if (UNCODE.menuOpened) {
7337					if (UNCODE.wwidth < UNCODE.mediaQuery) {
7338						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
7339					} else {
7340						$('.mmb-container-overlay .overlay-close').trigger('click');
7341						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
7342					}
7343				}
7344
7345			}
7346
7347		});
7348
7349		$('.header-scrolldown').on('click', function(event) {
7350			event.preventDefault();
7351			var scrollDown = $(this),
7352				ind = scrollDown.closest('.fp-section').index();
7353
7354			$.fn.fullpage.moveTo(ind+2);
7355		});
7356
7357		var anchor = $('.fp-section.active').data('anchor');
7358
7359		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
7360			$('.menu-item').removeClass('active');
7361			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
7362		}
7363
7364	};
7365
7366	var slideLeave = function( index, nextIndex, direction ) {
7367		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
7368			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7369			animationEnd = 'webkitAnimationEnd animationend',
7370			transitionEnd = 'webkitTransitionEnd transitionend',
7371			animOut = effect != 'scaleDown' ? effect + direction : effect,
7372			animIn,
7373			isFooter = false,
7374			isFooterNext = false,
7375			footerH = $footer.outerHeight(),
7376			timeout,
7377			player, iframe,
7378			footerCoeff;
7379		switch( direction ) {
7380			case 'up':
7381				animIn = 'moveFromTop';
7382				break;
7383			default:
7384				animIn = 'moveFromBottom';
7385		}
7386
7387		if ( $('body').hasClass('uncode-fullpage-trid') ) {
7388			animOut = animIn + 'trid';
7389			animIn = animOut + 'In';
7390		} else if ( UNCODE.isFullPageSnap ) {
7391			animIn = animOut = 'none';
7392		}
7393
7394		hideMenu(index, nextIndex);
7395		shrinkMenu(index, nextIndex);
7396
7397		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
7398			if ($(this).attr('data-provider') == 'vimeo') {
7399				iframe = $(this).find('iframe');
7400				player = new Vimeo.Player(iframe[0]);
7401				player.pause();
7402			} else if ($(this).attr('data-provider') == 'youtube') {
7403				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
7404			} else {
7405				if ($(this).is('video')) {
7406					$(this)[0].volume = 0;
7407					$(this)[0].pause();
7408				}
7409			}
7410		});
7411
7412		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
7413			if ($(this).attr('data-provider') == 'vimeo') {
7414				iframe = $(this).find('iframe');
7415				iframe.on('load', function(){
7416					player = new Vimeo.Player(iframe);
7417					player.setVolume(0);
7418					player.play();
7419				});
7420				player = new Vimeo.Player(iframe);
7421				player.setVolume(0);
7422				player.play();
7423			} else if ($(this).attr('data-provider') == 'youtube') {
7424				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
7425			} else {
7426				if ($(this).is('video')) {
7427					$(this)[0].volume = 0;
7428					$(this)[0].play();
7429				}
7430			}
7431		});
7432
7433		if ( $currentSlide.is($footer) )
7434			isFooter = true;
7435
7436		if ( $nextSlide.is($footer) )
7437			isFooterNext = true;
7438
7439		if ( ! UNCODE.isMobile && headerWithOpacity ) {
7440			if ( $currentSlide.is($header) )
7441				$header.addClass('header-scrolled');
7442		}
7443
7444		footerCoeff = footerH;
7445
7446		if ( UNCODE.isFullPageSnap ) {
7447			postLeaveActions( nextIndex );
7448			activateBackWash( nextIndex );
7449			activateKBurns( nextIndex );
7450			requestTimeout(function(){
7451				animationEndAction( index, nextIndex );
7452			}, fp_anim_time+150);
7453		} else {
7454			if ( isFooterNext ) {
7455
7456				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
7457				$iscrollWrapper.addClass('no-scrolloverflow');
7458
7459				$nextSlide
7460				.add($currentSlide)
7461				.addClass('uncode-scroll-front')
7462				.addClass('uncode-scroll-active')
7463				.addClass('uncode-scroll-visible');
7464				$container.css({
7465					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
7466					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
7467					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
7468					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
7469				}).off(transitionEnd)
7470				.one(transitionEnd, function(){
7471					animationEndAction( index, nextIndex );
7472				});
7473
7474			} else if ( isFooter ) {
7475
7476				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
7477				.add($currentSlide)
7478				.addClass('uncode-scroll-front')
7479				.addClass('uncode-scroll-active')
7480				.addClass('uncode-scroll-visible');
7481				$container.css({
7482					'-webkit-transform': 'translate3d(0, 0, 0)',
7483					'transform': 'translate3d(0, 0, 0)',
7484					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
7485					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
7486				})
7487				.one(transitionEnd, function(){
7488					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
7489						clearRequestTimeout(timeout);
7490						timeout = requestTimeout(function(){
7491							$.fn.fullpage.moveTo(nextIndex);
7492							slideLeave( index-1, nextIndex, 'up' );
7493							$container.off(transitionEnd);
7494						}, 50);
7495					}
7496					animationEndAction( index, nextIndex );
7497				});
7498
7499			} else {
7500
7501				postLeaveActions( nextIndex );
7502
7503				if ( !$('body').hasClass('uncode-fullpage-trid') )
7504					activateParallax( nextIndex, direction );
7505
7506				var $outBg = $('.background-wrapper', $currentSlide);
7507
7508				$nextSlide
7509				.addClass('uncode-scroll-front')
7510				.addClass('uncode-scroll-active')
7511				.addClass('uncode-scroll-visible')
7512				.addClass('uncode-scroll-animating-in')
7513				.css({
7514					'z-index':4,
7515					'animation-name': animIn,
7516					'animation-duration': fp_anim_time + 'ms',
7517					'animation-delay': '',
7518					'animation-timing-function': fp_easing,
7519					'animation-fill-mode': 'both',
7520					'transition': 'initial',
7521				}).off(animationEnd)
7522				.on(animationEnd, function(event) {
7523					if ( event.originalEvent.animationName === animIn ) {
7524						$(this)
7525							.addClass('uncode-scroll-already')
7526							.removeClass('uncode-scroll-front')
7527							.removeClass('uncode-scroll-animating-in')
7528							.css({
7529								'animation-name': '',
7530								'animation-duration': '',
7531								'animation-delay': '',
7532								'animation-timing-function': '',
7533								'animation-fill-mode': '',
7534								'transition': 'initial',
7535							});
7536
7537						$currentSlide
7538							.removeClass('uncode-scroll-active')
7539							.add($outBg)
7540							.css({
7541								'animation-name': '',
7542								'animation-duration': '',
7543								'animation-delay': '',
7544								'animation-timing-function': '',
7545								'animation-fill-mode': '',
7546								'transition': 'initial',
7547							});
7548
7549						animationEndAction( index, nextIndex );
7550
7551					}
7552
7553					if ( nextIndex > 1 )
7554						$('body').addClass('window-scrolled');
7555					else
7556						$('body').removeClass('window-scrolled');
7557				});
7558
7559				$currentSlide
7560					.addClass('uncode-scroll-animating-out')
7561					.removeClass('uncode-scroll-front')
7562					.css({
7563						'z-index':'1',
7564						'animation-name': animOut,
7565						'animation-duration': fp_anim_time + 'ms',
7566						'animation-delay': '',
7567						'animation-timing-function': fp_easing,
7568						'animation-fill-mode': 'both',
7569						'transition': 'initial',
7570						'will-change': 'auto'
7571					}).off(animationEnd)
7572					.on(animationEnd, function(event) {
7573						if ( event.originalEvent.animationName === animOut ) {
7574							$currentSlide.removeClass('uncode-scroll-animating-out');
7575						}
7576					});
7577
7578				if ( $('body').hasClass('uncode-fp-opacity') ) {
7579					$currentSlide.find('> div').css({
7580						'animation-name': 'opacityout',
7581						'animation-duration': fp_anim_time + 'ms',
7582						'animation-delay': '',
7583						'animation-timing-function': fp_easing,
7584						'animation-fill-mode': 'both',
7585						'transition': 'initial',
7586					}).off(animationEnd)
7587					.on(animationEnd, function(event) {
7588						if ( event.originalEvent.animationName === 'opacityout' ) {
7589							$(event.currentTarget).css({
7590								'animation-name': '',
7591								'animation-duration': '',
7592								'animation-delay': '',
7593								'animation-timing-function': '',
7594								'animation-fill-mode': '',
7595								'transition': '',
7596							});
7597						}
7598					});
7599				}
7600			}
7601		}
7602
7603		$('.scroll-top').on('click', function(e){
7604			$.fn.fullpage.moveTo(1);
7605			return false;
7606		});
7607
7608	};
7609
7610	var init_fullPage = function(mode){
7611
7612		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
7613		// 	scrollBar = false;
7614		// }
7615
7616		var checkFPeffects;
7617
7618		$container.fullpage({
7619			sectionSelector: '.uncode-scroll-lock',
7620			scrollOverflow: true,
7621			scrollOverflowOptions: {
7622				click: false,
7623				preventDefaultException: { tagName:/.*/ }
7624			},
7625			navigation: false,
7626			scrollBar: scrollBar,
7627			scrollingSpeed: fp_anim_time,
7628			verticalCentered: true,
7629			anchors: no_history ? false : dataNames,
7630			recordHistory: !no_history,
7631			afterRender: function(){
7632				$('body').removeClass('fp-waiting');
7633				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
7634					var $invisible = $(this).addClass('hidden-scroll');//,
7635				});
7636				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
7637					var $visible = $(this).addClass('uncode-scroll-visible'),
7638						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
7639					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
7640				});
7641
7642				$('ul.onepage-pagination a').on('click', function(e){
7643					e.preventDefault();
7644					var $a = $(this),
7645						toIndex = $a.data('index');
7646
7647					$.fn.fullpage.moveTo(toIndex+1);
7648				});
7649
7650				requestTimeout(function(){
7651					scrollHashes();
7652				}, 1000);
7653
7654				$(window).on('hashchange', function(e){
7655					requestTimeout(function(){
7656						scrollHashes();
7657					}, 500);
7658				});
7659
7660				anchorLink();
7661
7662				if ( $('body').hasClass('uncode-fp-opacity') ) {
7663					$all.each(function(index, row) {
7664						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
7665							classBg;
7666
7667						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
7668							classBg = testmatch[0];
7669							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
7670						}
7671					});
7672				}
7673
7674				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
7675					$(window).on('menuOpen gdprOpen', function(){
7676						$.fn.fullpage.setAutoScrolling(false);
7677					}).on('menuClose gdprClose', function(){
7678						$.fn.fullpage.setAutoScrolling(true);
7679					});
7680				}
7681
7682				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
7683					requestTimeout(function(){
7684						$.fn.fullpage.setAutoScrolling(false);
7685					}, 1000);
7686				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
7687					$.fn.fullpage.setAutoScrolling(true);
7688				});
7689
7690				if ( !UNCODE.isFullPageSnap ) {
7691					clearRequestTimeout(checkFPeffects);
7692					checkFPeffects = requestTimeout(function(){
7693						activateBackWash( 1 );
7694						activateKBurns( 1 );
7695					}, 100);
7696				}
7697
7698			},
7699			onLeave: function( index, nextIndex, direction ){
7700
7701				if ( UNCODE.menuOpened || is_scrolling )
7702					return false;
7703
7704				is_scrolling = true;
7705
7706				var event = new CustomEvent('fp-slide-leave');
7707				window.dispatchEvent(event);
7708
7709				slideLeave( index, nextIndex, direction );
7710
7711				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
7712					if ( direction === 'up' ) {
7713						$.fn.fullpage.moveTo(nextIndex-1);
7714					} else {
7715						$.fn.fullpage.moveTo(nextIndex+1);
7716					}
7717					return false;
7718				}
7719
7720				$('ul.onepage-pagination a').removeClass('is-selected');
7721				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
7722
7723			}
7724		});
7725	};
7726
7727	init_fullPage();
7728	$(window).on('load', function(){
7729		requestTimeout(function(){
7730			$.fn.fullpage.reBuild();
7731		}, 3000);
7732	});
7733
7734	var addScrollingClass,
7735		removeScrollingClass;
7736
7737	window.addEventListener("fp-slide-scroll", function(){
7738		addScrollingClass = requestTimeout( function(){
7739			$('body').addClass('fp-slide-scrolling');
7740		}, 10 );
7741
7742		clearRequestTimeout(removeScrollingClass);
7743		removeScrollingClass = requestTimeout( function(){
7744			$('body').removeClass('fp-slide-scrolling');
7745		}, 150 );
7746
7747		Waypoint.refreshAll();
7748	}, false);
7749
7750	var setFPheight = function(){
7751		var $body = document.body,
7752			$footer = document.getElementById('colophon'),
7753			$maincontainer = document.querySelector('.main-wrapper'),
7754			$boxcontainer = document.querySelector('.box-container'),
7755			$sections = document.querySelectorAll('.fp-section'),
7756			rect = $maincontainer.getBoundingClientRect(),
7757			rect2 = $boxcontainer.getBoundingClientRect(),
7758			$masthead = document.getElementById('masthead'),
7759			_hideMenu = false,
7760			menuHeight = UNCODE.menuHeight;
7761		$body.style.height = UNCODE.wheight + 'px';
7762
7763		if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) {
7764			_hideMenu = true;
7765		}
7766		if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) {
7767			menuHeight = 0
7768		}
7769
7770
7771		if ( theres_footer )
7772			$footer.style.top = (rect.height || rect2.height) + 'px';
7773
7774		for (var i = 0; i < $sections.length; i++) {
7775			$sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px';
7776		}
7777	};
7778
7779	setFPheight();
7780
7781	window.addEventListener('resize', setFPheight, false);
7782	window.addEventListener('orientationchange', setFPheight, false);
7783
7784};
7785
7786UNCODE.particles = function() {
7787	$(".vc-particles-background").each(function() {
7788		var $particle = $(this);
7789		var $parent = $particle.closest('[data-parent]');
7790
7791		$parent.prepend($particle);
7792		// $(window).trigger('resize');
7793	})
7794};
7795
7796
7797UNCODE.filters = function() {
7798	var $systems = $('.isotope-system, .cssgrid-system');
7799
7800	$systems.each(function(index, val){
7801		var $system = $(this),
7802			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system),
7803			$widgets = $('.widgetized-cb-wrapper', $system),
7804			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $system),
7805			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system),
7806			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system),
7807			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system);
7808
7809		if ($system.hasClass('isotope-processed')) {
7810			return;
7811		}
7812
7813		$cats_trigger.on('click', function(e) {
7814			if ( ! $('html').hasClass('screen-sm') ) {
7815				// $widgets.add($sorting_dd).slideUp(400);
7816				e.preventDefault();
7817				$widgets.slideUp(400, 'easeInOutCirc');
7818			}
7819		});
7820
7821		$('.filters-toggle-trigger', $system).on('click', function(e) {
7822			e.preventDefault();
7823			var $filters = $('.isotope-filters .menu-horizontal', $system);
7824			$filters.slideToggle(400, 'easeInOutCirc');
7825			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
7826		});
7827
7828		$widget_trgr.on('click', function(e) {
7829			e.preventDefault();
7830			$widgets.slideToggle(400, 'easeInOutCirc');
7831			if (!$('html').hasClass('screen-sm')) {
7832				$cats_filters.slideUp(400, 'easeInOutCirc');
7833			}
7834			window.dispatchEvent(new CustomEvent('boxResized'));
7835		});
7836
7837		$sorting_trgr.on('click', function(e) {
7838			e.preventDefault();
7839			if (!$('html').hasClass('screen-sm')) {
7840				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
7841			}
7842		});
7843
7844		$system.addClass('isotope-processed');
7845	});
7846
7847};
7848
7849UNCODE.widgets = function() {
7850	var widget_collapses = $('.widget-collapse');
7851
7852	widget_collapses.each(function(){
7853		var widget_collapse = $(this),
7854			widget_title = widget_collapse.find('.widget-title'),
7855			widget = widget_title.closest('.widget'),
7856			content = widget.children().not('.widget-title'),
7857			setCTA;
7858
7859		if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
7860			widget_title.toggleClass('open');
7861		}
7862
7863		widget_title.each(function() {
7864			var _this = $(this);
7865			var content = _this.closest('.widget').find('.widget-collapse-content');
7866
7867			$(window).on('load resize', function(){
7868				clearRequestTimeout(setCTA);
7869				setCTA = requestTimeout( function() {
7870					if ( content.is(':visible') ) {
7871						_this.addClass( 'open' );
7872					} else {
7873						_this.removeClass( 'open' );
7874					}
7875				}, 10 );
7876			})
7877
7878			_this.on( 'click', function(){
7879
7880				// Get content of :after element (+ icon) to check the visibility
7881				var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
7882
7883				if (icon_content === 'none' || !icon_content) {
7884					return false;
7885				}
7886
7887				_this.toggleClass('open');
7888				var isOpen = _this.hasClass('open'),
7889					hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27;
7890				content.animate({
7891					height: 'toggle',
7892					padding: 'toggle',
7893					opacity: 'toggle',
7894					top: isOpen ? 0 : hasBorder
7895				}, {
7896					duration: 400,
7897					easing: "easeInOutCirc",
7898				});
7899
7900				return false;
7901
7902			});
7903		});
7904	});
7905
7906	var $widgets_without_title = $('.collapse-init').removeClass('collapse-init');
7907};
7908
7909UNCODE.unmodal = function() {
7910	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
7911		$('.unmodal-overlay').fadeIn();
7912		$('.unmodal-overlay').addClass('loading');
7913		$('body').addClass('uncode-unmodal-overlay-visible');
7914		$(window).trigger('unmodal-open');
7915	});
7916
7917	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
7918		$('.unmodal-overlay').fadeOut();
7919		$('.unmodal').fadeOut();
7920		$('body').removeClass('uncode-unmodal-overlay-visible');
7921		$('body').removeClass('uncode-unmodal-open');
7922		$('html').removeClass('uncode-unmodal-body-disable-scroll');
7923		$(document).trigger('unmodal-close');
7924		UNCODE.isUnmodalOpen = false;
7925	});
7926
7927	$(document).on('uncode-unmodal-show-content', function() {
7928		$('.unmodal-overlay').removeClass('loading');
7929		$('.unmodal').show();
7930		$('.unmodal').addClass('show-unmodal-with-animation');
7931		$('.unmodal-content')[0].scrollTop = 0;
7932		$('body').addClass('uncode-unmodal-open');
7933		UNCODE.isUnmodalOpen = true;
7934
7935		if ($('body').hasClass('qw-body-scroll-disabled')) {
7936			$('html').addClass('uncode-unmodal-body-disable-scroll');
7937		}
7938
7939		if ($('.unmodal').hasClass('auto-height')) {
7940			set_modal_height();
7941		}
7942	});
7943
7944	var set_modal_height = function() {
7945		var modal = $('.unmodal');
7946		var window_height = $(window).outerHeight();
7947		var modal_height = modal.outerHeight();
7948
7949		modal.css('height', 'auto');
7950
7951		if (modal_height > window_height) {
7952			modal.outerHeight(window_height);
7953		}
7954	}
7955
7956	if ($('.unmodal').hasClass('auto-height')) {
7957		var setCTA;
7958
7959		$(window).on('resize', function() {
7960			clearRequestTimeout(setCTA);
7961			setCTA = requestTimeout(function() {
7962				set_modal_height();
7963			}, 100);
7964		});
7965	}
7966};
7967
7968UNCODE.bgChanger = function() {
7969	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
7970		$bg_first = $('.vc_row[data-bg-remove]'),
7971		bg_remove = $bg_first.attr('data-bg-remove'),
7972		$first = $bg_changers.first(),
7973		$last = $bg_changers.last(),
7974		$bg_wrapper = $('#changer-back-color'),
7975		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
7976		setCTA, localH = UNCODE.wheight,
7977		isScrolling;
7978
7979	$bg_first.removeClass(bg_remove);
7980
7981	var bgChange = function($col, bgColor, skin, tmbskin){
7982		$bg_wrapper.attr( 'class', bgColor );
7983		var menuskin;
7984		if ( typeof skin !== 'undefined' ) {
7985			menuskin = skin.replace('style', 'menu')
7986		}
7987
7988		if ( $col.length ) {
7989			$('.uncol[data-skin-change]').each(function(){
7990				var $isoFooter = $('.isotope-footer', this);
7991				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
7992				if ( menuskin !== '' ) {
7993					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
7994				}
7995			});
7996
7997			$('.tmb[data-skin-change]').each(function(){
7998				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
7999			});
8000		}
8001	};
8002
8003	var $masthead = $('#masthead'),
8004		transDesktop,
8005		transMobile,
8006		changeSkin,
8007
8008	checkTransparencyAndChange = function( skin ){
8009		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
8010		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
8011		changeSkin = $masthead.hasClass('menu-change-skin');
8012
8013		if ( ! transDesktop && ! transMobile ) {
8014			return false;
8015		}
8016
8017		if ( ! changeSkin ) {
8018			return false;
8019		}
8020
8021		if ( skin === 'style-light' ){
8022			$masthead.removeClass('style-dark-override').addClass('style-light-override');
8023			return false;
8024		} else if ( skin === 'style-dark' ) {
8025			$masthead.removeClass('style-light-override').addClass('style-dark-override');
8026			return false;
8027		}
8028	};
8029
8030	var bg_waypoints = function(){
8031		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
8032
8033			$.each($bg_changers, function(index, row) {
8034
8035				var $row = $(row),
8036					$col = $('.uncol[data-skin-change]', $row).eq(0),
8037					skin,
8038					$tmbs,
8039					tmbskin,
8040					bgColor = $row.attr('data-bg-color');
8041
8042				if ( ! $row.is(':visible') ) {
8043					return false;
8044				}
8045
8046				if ( $col.length ) {
8047					skin = $col.attr('data-skin-change');
8048					$tmbs = $('.tmb[data-skin-change]', $row);
8049					tmbskin = skin.replace('style', 'tmb');
8050				}
8051
8052				if ( ! $row.hasClass('unscroll-horizontal') ) {
8053					$row.waypoint(function( dir ) {
8054						if ( dir === 'down' ) {
8055							bgChange($col, bgColor, skin, tmbskin);
8056							checkTransparencyAndChange(skin);
8057						} else {
8058							return;
8059						}
8060					}, {
8061						offset: '50%'
8062		  			});
8063
8064					$row.waypoint(function( dir ) {
8065						if ( dir === 'up' ) {
8066							bgChange($col, bgColor, skin, tmbskin);
8067							checkTransparencyAndChange(skin);
8068						} else {
8069							return;
8070						}
8071					}, {
8072						offset: function() {
8073							var clH = this.element.clientHeight,
8074								wH = window.innerHeight,
8075								ret = clH > 200 ? -100 : clH * -0.5;
8076							return ( wH / 2 ) - clH;
8077						}
8078					});
8079				}
8080
8081			});
8082
8083			$('body').addClass('bg-changer-init');
8084
8085		}
8086	};
8087
8088	var body = document.body,
8089	edges = false;
8090
8091	var throttle = function(fn, wait) {
8092		var time = Date.now();
8093		return function() {
8094			if ((time + wait - Date.now()) < 0) {
8095				fn();
8096				time = Date.now();
8097			}
8098		}
8099	}
8100
8101	var $wrapper = document.querySelector(".main-wrapper"),
8102		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
8103
8104	var $title = document.querySelector('#rotating');
8105	if ( $title !== null ) {
8106		$title.style.whiteSpace = 'nowrap';
8107		$title.style.transition = 'transform 200ms linear';
8108	}
8109
8110	window.addEventListener( 'scroll', throttle( function() {
8111		window.clearRequestTimeout( isScrolling );
8112
8113		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
8114
8115			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
8116				body = document.body,
8117				html = document.documentElement,
8118				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
8119				$row = false,
8120				firstOff,
8121				lastOff;
8122
8123			if ( scrolled < 100 && $first.length ) {
8124				firstOff = $first.offset().top;
8125				if ( firstOff < 100 ) {
8126					var $row = $first;
8127				}
8128			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
8129				lastOff = $last.offset().top + $last.outerHeight();
8130				if ( lastOff > ( docH - 100 ) ) {
8131					var $row = $last;
8132				}
8133			}
8134
8135			if ( $row.length ) {
8136				var $col = $('.uncol[data-skin-change]', $row).eq(0),
8137					skin,
8138					$tmbs,
8139					tmbskin,
8140					bgColor = $row.attr('data-bg-color');
8141
8142				if ( $col.length ) {
8143					skin = $col.attr('data-skin-change');
8144					$tmbs = $('.tmb[data-skin-change]', $row);
8145					tmbskin = skin.replace('style', 'tmb');
8146				}
8147
8148				bgChange($col, bgColor, skin, tmbskin);
8149				checkTransparencyAndChange(skin);
8150				edges = true;
8151			}
8152
8153		}, 150);
8154
8155		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
8156			bg_waypoints();
8157			Waypoint.refreshAll();
8158			edges = false;
8159		}
8160
8161	}, 100), false);
8162
8163	$(window).on('resize', function() {
8164		clearRequestTimeout(setCTA);
8165		setCTA = requestTimeout(function() {
8166			if ( localH != UNCODE.wheight ) {
8167				localH = UNCODE.wheight;
8168				bg_waypoints();
8169				Waypoint.refreshAll();
8170			}
8171		}, 100);
8172	});
8173
8174	bg_waypoints();
8175
8176};
8177
8178UNCODE.skewIt = function() {
8179
8180	if ( $('body').hasClass('compose-mode') ) {
8181		return;
8182	}
8183
8184	var justscrolled = false;
8185
8186	var loadSkewIt = function(){
8187
8188		var $pageHeader = $('#page-header'),
8189			$page_body = $('.page-body'),
8190			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
8191
8192		if ( $header_skew.length ) {
8193			$pageHeader.addClass('uncode-skew').css({
8194				position: 'relative',
8195				zIndex: 1
8196			});
8197			$header_skew.removeClass('uncode-skew');
8198			$page_body.css({
8199				position: 'relative',
8200				zIndex: 0
8201			});
8202		}
8203
8204		var $skew = $('.uncode-skew'),
8205			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
8206			horizontal = $horizontal.length,
8207			stopSkewing,
8208			lastOffset = 0,
8209			lastDate = Date.now();
8210
8211		if ( ! $skew.length ) {
8212			return;
8213		}
8214
8215		var dropSkew = function(){
8216			if ( UNCODE.wwidth < UNCODE.mediaQuery )
8217				return;
8218
8219			$skew.each(function(){
8220				var $this = $(this),
8221					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
8222
8223				if ( $drop.length ) {
8224					$this.css({
8225						'transform': 'skew(0)'
8226					});
8227					var bound = $this[0].getBoundingClientRect();
8228					$drop.css({
8229						left: bound.x * -1,
8230						top: bound.y * -1,
8231					});
8232				}
8233			});
8234		};
8235		dropSkew();
8236
8237		$(window).on('resize', dropSkew);
8238
8239		window.addEventListener( 'scroll', function() {
8240
8241			if ( justscrolled !== true ) {
8242				justscrolled = true;
8243				return;
8244			}
8245
8246			window.clearRequestTimeout( stopSkewing );
8247
8248			var now = Date.now(),
8249				delayInMs = now - lastDate,
8250				offset = window.pageYOffset || window.document.documentElement.scrollTop,
8251				newOffset = offset - lastOffset,
8252				speed = Math.pow((newOffset / delayInMs), 3) * -1,
8253				body = document.body,
8254				html = document.documentElement,
8255				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
8256				wait = 50,
8257				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
8258
8259			if ((lastDate + wait - now) < 0) {
8260
8261				lastDate = now;
8262				lastOffset = offset;
8263
8264				if ( speed > 6 ) {
8265					speed = 6;
8266				} else if ( speed < -6 ) {
8267					speed = -6;
8268				}
8269
8270				if ( speed > 2 && offset < UNCODE.wheight ) {
8271					speed = 2;
8272				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
8273					speed = -2;
8274				}
8275
8276				var speedY = speed,
8277					speedX = speed * 1.25;
8278
8279				if ( horizontal ) {
8280					speedY = 0;
8281					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
8282						speedX = 0;
8283						return;
8284					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
8285						speedX = 0;
8286						return;
8287					}
8288				} else {
8289					speedX = 0;
8290				}
8291
8292				if ( ! $skew.closest('.enter-st').length ) {
8293					speedX = 0;
8294				}
8295
8296				gsap.killTweensOf($skew);
8297				gsap.to( $skew, {
8298					duration: 0.2,
8299					skewY: (speedY * maxSpeed) + "deg",
8300					skewX: (speedX * maxSpeed) + "deg",
8301					ease: Power0.easeNone,
8302					transformOrigin: 'center',
8303				});
8304
8305			}
8306
8307			stopSkewing = requestTimeout(function() {
8308				gsap.killTweensOf($skew);
8309				gsap.to( $skew, {
8310					duration: 0.5,
8311					skewY: "0deg",
8312					skewX: "0deg",
8313					transformOrigin: 'center',
8314					ease: Expo.easeOut,
8315				});
8316
8317				$skew.each(function(){
8318					var $this = $(this),
8319						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
8320
8321					if ( $drop.length ) {
8322						var bound = $this[0].getBoundingClientRect()
8323						$drop.css({
8324							left: bound.x * -1,
8325							top: bound.y * -1,
8326						});
8327					}
8328				});
8329
8330			}, 200);
8331
8332		}, false);
8333
8334	};
8335
8336	$(window).on('load', loadSkewIt);
8337
8338};
8339
8340UNCODE.rotateIt = function() {
8341
8342	if ( $('body').hasClass('compose-mode') ) {
8343		return;
8344	}
8345
8346	var loadRotateIt = function(){
8347
8348		var $toRotate = $('.uncode-rotate');
8349
8350		$toRotate.each(function(){
8351			var $rotate = $(this),
8352				deg = 0,
8353				dir = true,
8354				coeff = 1,
8355				lastOffset = 0,
8356				lastDate = Date.now();
8357
8358			var checkScroll = function($rotate){
8359				// if ( ! $rotate.length ) {
8360				// 	return;
8361				// }
8362
8363				var now = Date.now(),
8364					delayInMs = now - lastDate,
8365					offset = window.pageYOffset || window.document.documentElement.scrollTop,
8366					newOffset = offset - lastOffset,
8367					speed = (newOffset / delayInMs) * 5,
8368					body = document.body,
8369					html = document.documentElement,
8370					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
8371
8372				lastDate = now;
8373				lastOffset = offset;
8374
8375				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
8376					deg = 0;
8377				}
8378
8379				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
8380					deg = parseFloat(deg) + parseFloat(speed);
8381				}
8382
8383				if ( $rotate.hasClass('uncode-rotate-hover') ) {
8384					$rotate.hover(function(){
8385						coeff = 1.75;
8386					}, function(){
8387						coeff = 1;
8388					});
8389				}
8390
8391				// if ( speed > 0 ) {
8392				// 	dir = true
8393				// } else if ( speed < 0 ) {
8394				// 	dir = false
8395				// }
8396
8397				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
8398					deg = deg+coeff;
8399					// if ( dir ) {
8400					// 	deg = deg+coeff;
8401					// } else {
8402					// 	deg = deg-coeff;
8403					// }
8404				}
8405
8406				$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
8407
8408				requestAnimationFrame(function() {
8409					checkScroll($rotate);
8410				});
8411
8412			};
8413
8414			checkScroll($rotate);
8415
8416		});
8417
8418	};
8419
8420	$(window).on('load', loadRotateIt);
8421
8422};
8423
8424var marqueeAttempts = 0,
8425	marqueeTO;
8426
8427UNCODE.textMarquee = function( $titles ) {
8428
8429	var initTextMarquee = function( $titles ){
8430
8431		if ( typeof $titles == 'undefined' ) {
8432			$titles = $('.un-text-marquee');
8433		}
8434
8435		if ( ! $titles.length ) {
8436			return;
8437		}
8438
8439		$titles.each(function(){
8440			var $title = $(this),
8441				$span = $('> span', $title),
8442				txt,
8443				first = true,
8444				newW = UNCODE.wwidth;
8445
8446			$('.marquee-clone-wrap', $title).remove();
8447
8448			txt = $title.text();
8449
8450			if ( ! $('.marquee-original-core', $span).length ) {
8451				$span = $('> span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
8452			}
8453
8454			var checkResize,
8455				spanW,
8456				$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
8457				$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
8458				clearSpeed,
8459				speed = 10;
8460
8461			$span.prepend($prepended);
8462			$span.append($appended);
8463
8464			var continuousTextMarquee = function(){
8465				var bound = $title.css({
8466						'transform': 'none',
8467						'opacity': 0
8468					}).offset();
8469
8470				var xStrt = first || $title.hasClass('un-marquee-infinite') ? 0 : UNCODE.wwidth - bound.left,
8471					xEnd = $title.hasClass('un-marquee-infinite') ? spanW : ( spanW + bound.left ),
8472					xSpeed = $title.hasClass('un-marquee-infinite') ? ( spanW + bound.left ) : ( xStrt + ( UNCODE.wwidth + bound.left ) ),
8473					direction = $title.hasClass('un-marquee-opposite') ? 1 : -1;
8474
8475				var marqueeTL = new TimelineMax({paused:true, reversed:true});
8476
8477				var inViewElement = $title.closest('.sticky-trigger').length || $title.closest('.pin-spacer').length ? $title.closest('.vc_row')[0] : $title[0];
8478
8479				var inview = new Waypoint.Inview({
8480					element: inViewElement,
8481					enter: function(direction) {
8482						marqueeTL.play();
8483					},
8484					exited: function(direction) {
8485						marqueeTL.pause();
8486					}
8487				});
8488
8489				//gsap.killTweensOf($title);
8490				marqueeTL.fromTo( $title, {
8491					opacity: 1,
8492					x: xStrt * direction * -1
8493				},
8494				{
8495					duration: xSpeed / UNCODE.wwidth * speed,
8496					x: xEnd * direction,
8497					onComplete: function(){
8498						first = false;
8499						continuousTextMarquee();
8500					},
8501					ease: Linear.easeNone
8502				});
8503			};
8504
8505			var runTextMarquee = function(){
8506				var time = Date.now();
8507
8508				var textMarqueeScroll = function(){
8509					var $row = $title.closest('.vc_row'),
8510						$bound = $title.closest('.pin-spacer').length ? $row : $title,
8511						bound = $bound[0].getBoundingClientRect(),
8512						wait = 100,
8513						direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1;
8514
8515					if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 &&
8516						bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 &&
8517						marqueeAttempts < 2 ) {
8518
8519						clearRequestTimeout(marqueeTO);
8520
8521						marqueeTO = requestTimeout(function(){
8522							marqueeAttempts++;
8523							initTextMarquee();
8524						}, 100);
8525					}
8526
8527					//if ((time + wait - Date.now()) < 0) {
8528						//if ( bound.top > ( bound.height * -4 ) && ( bound.top - bound.height ) < UNCODE.wheight * 2 ) {
8529							// $title[0].style.transform = 'translateX(' + ( UNCODE.wheight * 0.5 - bound.top ) * 0.75 + 'px)';
8530							gsap.killTweensOf($title);
8531							gsap.to( $title, {
8532								duration: 0.24,
8533								x: ( UNCODE.wheight * 0.35 - bound.top ) * 0.5 * direction,
8534								//ease: Expo.easeOut,
8535							});
8536						//}
8537						//time = Date.now();
8538					//}
8539				};
8540
8541				textMarqueeScroll();
8542				$(window).on( 'load scroll', function() {
8543					textMarqueeScroll();
8544				});
8545
8546			};
8547
8548			var cloneSpan = function($_title, cntnt){
8549
8550				if ( $_title.hasClass('un-marquee-infinite') ) {
8551					$('> span.marquee-clone-wrap', $_title).text('');
8552				}
8553
8554				gsap.to( $_title, {
8555					duration: 0,
8556					x: 0
8557				});
8558				spanW = $span.outerWidth();
8559
8560				if ( !spanW ) {
8561					return;
8562				}
8563
8564				var part = Math.ceil( UNCODE.wwidth / spanW ) * 2;
8565
8566				if ( $_title.hasClass('un-marquee-infinite') ) {
8567
8568					for ( var i = 0; i < part; i++ ) {
8569						$prepended[0].textContent += cntnt + "\u00A0";
8570						$appended[0].textContent += cntnt + "\u00A0";
8571					}
8572				}
8573
8574				if ( $('body').hasClass('compose-mode') ) {
8575					return;
8576				}
8577
8578				if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
8579					continuousTextMarquee();
8580				}
8581
8582				if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
8583					runTextMarquee();
8584				}
8585
8586			};
8587
8588			var marqueResize = function(){
8589				clearRequestTimeout(checkResize);
8590				checkResize = requestTimeout(function(){
8591					if ( newW !== UNCODE.wwidth ) {
8592						gsap.killTweensOf($title);
8593						initTextMarquee();
8594						newW = UNCODE.wwidth;
8595					}
8596				}, 1000);
8597			};
8598
8599			$(window).off('resize', marqueResize)
8600			.on( 'resize', marqueResize);
8601
8602			cloneSpan($title, txt);
8603
8604			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
8605				window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
8606					// imageHover();
8607					var $_titles = $('.un-text-marquee',e.view.$el);
8608					initTextMarquee($_titles);
8609				});
8610			}
8611		});
8612	};
8613
8614	$(document).ready(function(){
8615		initTextMarquee();
8616	});
8617
8618};
8619
8620UNCODE.parallax = function() {
8621	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
8622		if ($('.parallax-el').length > 0) {
8623			var parallax_elements = new Rellax('.parallax-el');
8624			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
8625			window.addEventListener('boxResized', function(e) {
8626				parallax_elements.refresh();
8627			}, false);
8628			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
8629				requestTimeout(function() {
8630					parallax_elements.refresh();
8631				}, 100);
8632			});
8633
8634		}
8635	}
8636};
8637
8638UNCODE.magicCursor = function(){
8639	var $customCursor = $('#uncode-custom-cursor'),
8640		$customPilot = $('#uncode-custom-cursor-pilot'),
8641		$postLists = $('.uncode-post-titles'),
8642		currentCursor = 'auto',
8643		setTime,
8644		isScrolling,
8645		mouseEvent;
8646
8647	function delayChangeCursor(cursorType, delayt_time){
8648		clearRequestTimeout(setTime);
8649		setTime = requestTimeout(function() {
8650			$customCursor.attr('data-cursor', cursorType);
8651			if ( $customPilot.length ) {
8652				$customPilot.attr('data-cursor', cursorType);
8653			}
8654			currentCursor = cursorType;
8655		}, delayt_time);
8656	}
8657
8658	function changeCursor($wrap){
8659		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
8660		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]',
8661			$href = $wrap.find(href),
8662			cursorType,
8663			setTime, set_delay;
8664
8665		$href.hover(function(e) {
8666			var $this = $(this),
8667				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
8668				is_frontend_editor = $this.closest('.vc_controls').length,
8669				hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length,
8670				$parent_cursor = $this.closest('[class*="custom-cursor"]');
8671			if ( is_frontend_editor ) {
8672				cursorType = 'auto';
8673			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
8674				cursorType = data_cursor;
8675			} else if ( $parent_cursor.length ) {
8676				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
8677					cursorType = 'icon-light';
8678				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
8679					cursorType = 'icon-diff';
8680				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
8681					cursorType = 'icon-accent';
8682				} else {
8683					cursorType = 'icon-dark';
8684				}
8685			} else {
8686				cursorType = 'pointer';
8687			}
8688			delayChangeCursor(cursorType, 0);
8689		}, function(){
8690			delayChangeCursor('auto', 150);
8691		});
8692
8693		$(window).on('disable-hover', function(event) {
8694			document.addEventListener("mousemove", function(e) {
8695				mouseEvent = e;
8696			});
8697			delayChangeCursor('auto', 0);
8698		});
8699
8700		$(window).on('enable-hover', function(event) {
8701			if ( typeof mouseEvent !== 'undefined' ) {
8702				var x = mouseEvent.clientX,
8703					y = mouseEvent.clientY;
8704
8705				var elements = document.elementsFromPoint(x, y),
8706					$element = $(elements[0]);
8707
8708				$element.closest(href).trigger('mouseenter');
8709			}
8710		});
8711
8712	}
8713
8714	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
8715		changeCursor();
8716	});
8717
8718	$(document).ajaxComplete(function( event, xhr, settings ) {
8719		changeCursor();
8720	});
8721
8722	$('.isotope-container').on('isotope-layout-complete', function() {
8723		var $this = $(this);
8724		changeCursor($this);
8725	});
8726
8727};
8728
8729UNCODE.magneticCursor = function(){
8730	function magneticCursor($wrap){
8731		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
8732		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'));
8733
8734		$magnetics.on('mousemove', function(e){
8735			var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this),
8736				bound = e.currentTarget.getBoundingClientRect(),
8737				coeff = 30,
8738				hor = (bound.width / 2) - (e.clientX - bound.left),
8739				ver = (bound.height / 2) - (e.clientY - bound.top),
8740				toX = hor / bound.width * coeff,
8741				toY = ver / bound.height * coeff,
8742				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
8743				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
8744				toScale = Math.max(scaleX, scaleY);
8745
8746			gsap.killTweensOf($el);
8747			gsap.to( $el, {
8748				duration: 0.75,
8749				x: toX,
8750				y: toY,
8751				scale: toScale,
8752				ease: Power1.easeOut,
8753				transformPerspective: 900,
8754				transformOrigin: 'center',
8755				force3D: true
8756			});
8757		}).on('mouseout', function(e){
8758			var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this);
8759			gsap.killTweensOf($el);
8760			gsap.to( $el, {
8761				duration: 0.6,
8762				y: 0,
8763				x: 0,
8764				scale: 1,
8765				ease: Power1.easeOut,
8766				transformPerspective: 900,
8767				transformOrigin: 'center',
8768				force3D: true
8769			});
8770		});
8771	};
8772
8773	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
8774		magneticCursor();
8775	});
8776
8777	$(document).ajaxComplete(function( event, xhr, settings ) {
8778		magneticCursor();
8779	});
8780
8781	$('.isotope-container').on('isotope-layout-complete', function() {
8782		var $this = $(this);
8783		magneticCursor($this);
8784	});
8785
8786};
8787
8788UNCODE.dropImage = function() {
8789
8790	/****************************
8791	 * Image hover *
8792	****************************/
8793	function imageHover(){
8794		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
8795			return;
8796		}
8797
8798		var $postLists = $('.uncode-post-titles');
8799		$postLists.each(function(){
8800			var $list = $(this),
8801				timing = parseFloat( $list.attr('data-timing') ),
8802				default_image = $list.hasClass('uncode-post-titles-default-image'),
8803				default_title = $list.hasClass('uncode-post-titles-default-title'),
8804				$tmbs = $('.tmb', $list),
8805				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
8806				clientX,
8807				clientY,
8808				$row_parent = $list.closest('.vc_row'),
8809				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
8810				$col_parent = $list.closest('.uncell'),
8811				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
8812				setCTA;
8813
8814			timing *= 0.001;
8815
8816			var drop_bgs = function(){
8817				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
8818					var $drop = $(this),
8819						srcset = $drop.attr('data-bgset'),
8820						setArr = srcset.split(","),
8821						setArrOrder = [],
8822						biggest = 0,
8823						checkBg = false,
8824						desktopBG = $drop.data('[data-background-image]'),
8825						mobileBG = $drop.data('[data-mobile-background-image]');
8826
8827					if ( $drop.hasClass('srcset-bg-async') ) {
8828
8829						if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) {
8830							return;
8831						}
8832						
8833					}
8834
8835					if ( SiteParameters.uncode_adaptive == true ) {
8836						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
8837							$drop.css({
8838								'background-image' : 'url(' + setArr[0] + ')'
8839							});
8840						}
8841					} else {
8842						for ( var i = 0; i < setArr.length; i++ ) {
8843							var setLoop = setArr[i].trim().split(" ");
8844							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
8845								var parseSet = parseFloat(setLoop[1]);
8846								if ( biggest < parseSet ) {
8847									biggest = parseSet;
8848								}
8849								setArrOrder[parseSet] = setLoop[0];
8850								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
8851									checkBg = true;
8852									$drop.css({
8853										'background-image' : 'url(' + setLoop[0] + ')'
8854									});
8855								}
8856							}
8857						}
8858
8859						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
8860							$drop.css({
8861								'background-image' : 'url(' + setArrOrder[biggest] + ')'
8862							});
8863						}
8864					}
8865
8866				});
8867			};
8868
8869			drop_bgs();
8870
8871			var dropMovesSize = function(){
8872				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
8873					return;
8874				}
8875				$drop_moves.each(function(){
8876					var $drop_move = $(this),
8877						dataW = $drop_move.attr('data-w'),
8878						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
8879					if ( typeof dataW !== 'undefined' && dataW !== null ) {
8880						dataW = screenInfo.width / 12 * parseFloat( dataW );
8881					}
8882					$drop_moves.css({
8883						width: dataW
8884					});
8885
8886					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
8887						$anim_parent.on('animationend', function(){
8888							var bound = $anim_parent[0].getBoundingClientRect();
8889							$drop_move.css({
8890								left: bound.x * -1,
8891								top: bound.y * -1,
8892							});
8893						});
8894					}
8895				});
8896
8897
8898			};
8899
8900			dropMovesSize();
8901
8902			$(window).on( 'resize', function(){
8903				clearRequestTimeout(setCTA);
8904				setCTA = requestTimeout( function() {
8905					drop_bgs();
8906					dropMovesSize();
8907				}, 100 );
8908			});
8909
8910			if ( $drop_row_parents.length ) {
8911				$row_parent.addClass( 'drop-added' );
8912			}
8913
8914			$drop_row_parents.each(function(index, val){
8915				var $drop = $(val);
8916				$row_parent.prepend($drop);
8917				manageVideos($drop, false);
8918				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
8919					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
8920				}
8921				if ( default_image && index == 0 ) {
8922					manageVideos($drop, true);
8923					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
8924						image_ph = new Image();
8925					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
8926						image_ph.onload = function() {
8927							$drop.addClass('active');
8928							if ( default_title ) {
8929								$list.addClass('drop-hover');
8930								$tmbs.first().addClass('drop-active');
8931							}
8932						};
8933						image_ph.src = bg_img;
8934					}
8935				}
8936			});
8937
8938			if ( $drop_col_parents.length ) {
8939				$col_parent.addClass( 'drop-added' );
8940			}
8941
8942			$drop_col_parents.each(function(index, val){
8943				var $drop = $(this);
8944				$col_parent.prepend($drop);
8945				manageVideos($drop, false);
8946				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
8947					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
8948				}
8949				if ( default_image && index == 0 ) {
8950					manageVideos($drop, true);
8951					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
8952						image_ph = new Image();
8953					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
8954						image_ph.onload = function() {
8955							$drop.addClass('active');
8956							if ( default_title ) {
8957								$list.addClass('drop-hover');
8958								$tmbs.first().addClass('drop-active');
8959							}
8960						};
8961						image_ph.src = bg_img;
8962					}
8963				}
8964			});
8965
8966			function manageVideos( $el, start ) {
8967				var videoElem = $('video', $el),
8968					$iframe = $('iframe', $el),
8969					iframeID = $iframe.attr('id');
8970				if ( videoElem.length ) {
8971					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
8972						if ( start ) {
8973							videoElem[0].setCurrentTime(0);
8974							videoElem[0].play();
8975						} else {
8976							videoElem[0].pause();
8977							videoElem[0].setCurrentTime(0);
8978						}
8979					} else {
8980						if ( start ) {
8981							videoElem[0].currentTime = 0;
8982							videoElem[0].play();
8983						} else {
8984							videoElem[0].pause();
8985							videoElem[0].currentTime = 0;
8986						}
8987					}
8988				}
8989
8990				$el.data('active', start);
8991
8992				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
8993					var iframeIDv = iframeID.replace('okplayer-', ''),
8994						optionsV = $(window).data('okoptions-' + iframeIDv),
8995						vimeo = $iframe[0],
8996						playerV = new Vimeo.Player(vimeo),
8997						timeV = 0;
8998
8999					if (optionsV.time != null) {
9000						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
9001						for ( var i = 0; i < timeArr.length; i++ ) {
9002							if ( timeArr[i] === 'h' ) {
9003								timeV += parseFloat(timeArr[i-1]) * 3600;
9004							} else if ( timeArr[i] === 'm' ) {
9005								timeV += parseFloat(timeArr[i-1]) * 60;
9006							} else if ( timeArr[i] === 's' ) {
9007								timeV += parseFloat(timeArr[i-1]);
9008							}
9009						}
9010					}
9011					playerV.setCurrentTime(timeV);
9012					if ( start ) {
9013						playerV.setVolume(0);
9014						playerV.play();
9015					} else {
9016						playerV.pause();
9017					}
9018				} else if ( $el.attr('data-provider') === 'youtube' ) {
9019					if ( start ) {
9020						$el.trigger('uncode-resume');
9021					} else {
9022						$el.trigger('uncode-pause');
9023					}
9024				}
9025
9026			}
9027
9028			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
9029
9030				document.addEventListener("mousemove", function(e) {
9031					$drop_moves.each(function(){
9032						var $drop_move = $(this),
9033							duration = 0.4;
9034
9035						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
9036							duration = 0.8;
9037						}
9038
9039						clientX = e.clientX;
9040						clientY = e.clientY;
9041
9042						gsap.to( $drop_move, {
9043							duration: duration,
9044							x: clientX,
9045							y: clientY,
9046							ease: Power1.easeOut,
9047						});
9048					});
9049				});
9050
9051			} else {
9052
9053				$(window).on("touchend scroll", function(e) {
9054					$list.removeClass('drop-hover');
9055					$drop_moves.removeClass('active');
9056					$tmbs.removeClass('drop-active');
9057				});
9058
9059				$drop_moves.each(function(){
9060					var $drop_move = $(this),
9061						$tmb = $drop_move.closest('.tmb'),
9062						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
9063
9064					if ( $anim_parent.hasClass('uncode-skew') ) {
9065						$anim_parent.css({
9066							'transform': 'skew(0)'
9067						});
9068					}
9069
9070					$tmb.on('touchend', function(e){
9071						e.stopPropagation();
9072
9073						$drop_moves.removeClass('active');
9074						$tmbs.removeClass('drop-active');
9075
9076						$list.addClass('drop-hover');
9077						$tmb.addClass('drop-active');
9078						$drop_move.addClass('active');
9079						manageVideos($drop_move, true);
9080						clientX = e.changedTouches[0].clientX;
9081						clientY = e.changedTouches[0].clientY;
9082
9083						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
9084							var bound = $anim_parent[0].getBoundingClientRect();
9085							clientX = clientX - bound.x;
9086							clientY = clientY - bound.y;
9087						}
9088
9089						$drop_move.css({
9090							left: clientX,
9091							top: clientY
9092						});
9093					});
9094				});
9095
9096			}
9097
9098			$tmbs.each(function(e){
9099				var $tmb = $(this),
9100					// $trgr = $('a', $tmb),
9101					$trgr = $tmb,
9102					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
9103					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
9103(.t-inside), .parallax-el'),
9104					$video = $('video', $tmb),
9105					$iframe = $('iframe', $tmb),
9106					$entryTxt = $('.t-entry-text', $tmb),
9107					stopBounding;
9108
9109				$entryTxt.add($drop_move).css({
9110					'transition-duration': timing + 's'
9111				});
9112
9113				if ( $video.length ) {
9114					var vidH = $video[0].videoHeight,
9115						vidW = $video[0].videoWidth;
9116					$video.css({
9117						'height': vidH,
9118						'width': vidW
9119					});
9120				}
9121
9122				if ( $iframe.length ) {
9123					var vidH = $drop_move.attr('data-height'),
9124						vidW = $drop_move.attr('data-width');
9125					$iframe.css({
9126						'height': vidH,
9127						'width': vidW
9128					});
9129				}
9130
9131				$iframe.each(function(){
9132					var $video = $(this),
9133						vidH = $video[0].videoHeight,
9134						vidW = $video[0].videoWidth;
9135					$video.css({
9136						'height': vidH,
9137						'width': vidW
9138					});
9139				});
9140
9141				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
9142					$trgr.on('mouseenter',function(e){
9143						$list.addClass('drop-hover');
9144						$tmbs.removeClass('drop-active');
9145						$tmb.addClass('drop-active');
9146						$drop_move.addClass('active');
9147						manageVideos($drop_move, true);
9148
9149						var clientX = e.clientX,
9150							clientY = e.clientY;
9151						$drop_move.css({
9152							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
9153						});
9154
9155					})
9156					.on('mouseleave', function(e){
9157						$list.removeClass('drop-hover');
9158						$drop_move.css({
9159							'transition-duration': ( timing*1.25 ) + 's'
9160						});
9161						$drop_move.removeClass('active');
9162						$tmb.removeClass('drop-active');
9163						$drop_move.on('transitionend', function(e){
9164							$drop_move.off('transitionend');
9165							$drop_move.css({
9166								'transition-duration': timing + 's'
9167							});
9168							manageVideos($drop_move,false);
9169						});
9170					});
9171
9172					document.addEventListener('visibilitychange', function(){
9173						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
9174							$drop_move.css({
9175								'transition-duration': '0s'
9176							});
9177							$drop_move.removeClass('active');
9178							manageVideos($drop_move, false);
9179						}
9180					});
9181
9182					document.addEventListener('scroll', function(){
9183						window.clearRequestTimeout( stopBounding );
9184
9185						if ( $drop_move.hasClass('active') ) {
9186							$list.removeClass('drop-hover');
9187							$tmbs.removeClass('drop-active');
9188							$drop_move.removeClass('active');
9189							$drop_move.on('transitionend', function(e){
9190								$drop_move.off('transitionend');
9191								$drop_move.css({
9192									'transition-duration': timing + 's'
9193								});
9194								manageVideos($drop_move,false);
9195							});
9196						}
9197
9198						stopBounding = requestTimeout(function() {
9199							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
9200								var bound = $anim_parent[0].getBoundingClientRect();
9201								$drop_move.css({
9202									left: bound.x * -1,
9203									top: bound.y * -1,
9204								});
9205							}
9206						}, 200);
9207
9208					});
9209				}
9210
9211				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
9212					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
9213
9214				$drop.css({
9215					'transition-duration': timing + 's'
9216				});
9217
9218				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
9219					$trgr.on('mouseenter',function(e){
9220						$row_parent.add($col_parent).addClass('drop-list-loaded');
9221						$list.addClass('drop-hover');
9222
9223						if ( !$tmb.hasClass('drop-active') ) {
9224							$tmbs.removeClass('drop-active');
9225							$tmb.addClass('drop-active');
9226							if ( default_image && !$drop.hasClass('active') ) {
9227								var $prev = $('[data-drop].active', $row_parent);
9228								$prev.css({
9229									'transition-duration': (timing*1.5) + 's'
9230								});
9231								$prev.removeClass('active');
9232								$prev.on('transitionend', function(e){
9233									$prev.off('transitionend');
9234									manageVideos($prev,false);
9235								});
9236							}
9237							$drop.css({
9238								'transition-duration': timing + 's'
9239							});
9240							$drop.off('transitionend');
9241							$drop.addClass('active');
9242							manageVideos($drop, true);
9243						}
9244					})
9245					.on('mouseleave', function(e){
9246						if ( ( default_image && !default_title ) || !default_image ) {
9247							$list.removeClass('drop-hover');
9248							$tmb.removeClass('drop-active');
9249						}
9250						if ( ! default_image ) {
9251							$drop.css({
9252								'transition-duration': (timing*1.5) + 's'
9253							});
9254							$drop.removeClass('active');
9255
9256							$drop.on('transitionend', function(e){
9257								$drop.off('transitionend');
9258								manageVideos($drop,false);
9259							});
9260						}
9261					});
9262
9263					document.addEventListener('visibilitychange', function(){
9264						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
9265							$drop.css({
9266								'transition-duration': '0s'
9267							});
9268							$drop.removeClass('active');
9269							manageVideos($drop, false);
9270						}
9271					});
9272				}
9273			});
9274
9275		});
9276	};
9277
9278	$(window).on('load', function(event) {
9279		imageHover();
9280	});
9281
9282	var drop_wp_animation = function() {
9283		var $postLists = $('.uncode-post-titles');
9284		$postLists.each(function(){
9285			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
9286				new Waypoint({
9287					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
9288					element: val,
9289					handler: function() {
9290						var element = $(this.element),
9291							parent = element.closest('.tmb'),
9292							currentIndex = parent.index(),
9293							delay = currentIndex,
9294							delayAttr = parseInt(element.attr('data-delay'));
9295						if (isNaN(delayAttr)) delayAttr = 100;
9296						var objTimeout = requestTimeout(function() {
9297							element.addClass('start_animation');
9298
9299							var nextTimeout = requestTimeout(function() {
9300								$('.drop-image-separator', parent).addClass('start_animation');
9301							}, 50);
9302
9303						}, delay * delayAttr);
9304						if (!UNCODE.isUnmodalOpen) {
9305							this.destroy();
9306						}
9307					},
9308					offset: UNCODE.isFullPage ? '100%' : '90%'
9309				})
9310			});
9311		});
9312	}
9313
9314	var runWaypoints_TO,
9315		runWaypoints_delay = 0;
9316
9317	var runWaypoints = function(){
9318		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
9319			runWaypoints_delay = 400;
9320		}
9321		clearRequestTimeout(runWaypoints_TO);
9322		runWaypoints_TO = requestTimeout(function() {
9323			drop_wp_animation();
9324		}, runWaypoints_delay);
9325	};
9326	runWaypoints();
9327	$( document.body ).on( 'uncode_waypoints', runWaypoints );
9328	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9329		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
9330			// imageHover();
9331			runWaypoints();
9332		});
9333	}
9334};
9335
9336UNCODE.postTable = function() {
9337
9338	var clickRow = function(){
9339		var $postLists = $('.uncode-post-table');
9340
9341		$postLists.each(function(){
9342			var $postList = $(this),
9343				$tmbClicks = $('.tmb.tmb-click-row', $postList);
9344
9345			$tmbClicks.each(function(){
9346				var $tmb = $(this),
9347					$click = $('.table-click-row', $tmb);
9348				$('*:not(.table-click-row)', $tmb).on('click', function(e){
9349					e.preventDefault();
9350					e.stopPropagation();
9351					$click[0].click();
9352					return false;
9353				});
9354			});
9355
9356		})
9357	};
9358
9359	clickRow();
9360
9361	var hoverRow = function(){
9362		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
9363
9364		$postLists.on('mouseenter', function(){
9365			$(this).addClass('post-table-hover');
9366		});
9367		$postLists.on('mouseleave', function(){
9368			$(this).removeClass('post-table-hover');
9369		});
9370	}
9371
9372	hoverRow();
9373
9374	var drop_wp_animation = function() {
9375		var $postLists = $('.uncode-post-table');
9376		$postLists.each(function(){
9377			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
9378				new Waypoint({
9379					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
9380					element: val,
9381					handler: function() {
9382						var element = $(this.element),
9383							parent = element.closest('.tmb'),
9384							currentIndex = parent.index(),
9385							delay = currentIndex,
9386							delayAttr = parseInt(element.attr('data-delay'));
9387						if (isNaN(delayAttr)) delayAttr = 100;
9388						var objTimeout = requestTimeout(function() {
9389							element.addClass('start_animation');
9390						}, delay * delayAttr);
9391						if (!UNCODE.isUnmodalOpen) {
9392							this.destroy();
9393						}
9394					},
9395					offset: UNCODE.isFullPage ? '100%' : '90%'
9396				})
9397			});
9398		});
9399	}
9400
9401	var runWaypoints_TO,
9402		runWaypoints_delay = 0;
9403
9404	var runWaypoints = function(){
9405		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
9406			runWaypoints_delay = 400;
9407		}
9408		clearRequestTimeout(runWaypoints_TO);
9409		runWaypoints_TO = requestTimeout(function() {
9410			drop_wp_animation();
9411		}, runWaypoints_delay);
9412	};
9413	runWaypoints();
9414	$( document.body ).on( 'uncode_waypoints', runWaypoints );
9415	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9416		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
9417			runWaypoints();
9418			// clickRow();
9419		});
9420	}
9421};
9422
9423UNCODE.rotatingTxt = function($ctxt) {
9424
9425	if ( $('body').hasClass('compose-mode') ) {
9426		return;
9427	}
9428
9429	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
9430	var setCTA;
9431
9432	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
9433		var $heading = $(this),
9434			// debug = 0,
9435			cycle = 0,
9436			$trgt,
9437			$toMove,
9438			$highl,
9439			$col = $heading.closest('.uncont'),
9440			txt,
9441			arrTxt,
9442			textFadeIn, textFadeOut,
9443			removeWraps;
9444
9445		var defineObjs = function() {
9446			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
9447				var $rtx = $(this),
9448					fx = $rtx.attr('data-fx'),
9449					wait = $rtx.attr('data-wait'),
9450					$prev = $(this).prev().addClass('prev-rotating-start'),
9451					splitToMove = [],
9452					splitArray = [],
9453					lineArray = [],
9454					lineIndex = 0,
9455					lineStart = true,
9456					lineEnd = false,
9457					startSplit = false,
9458					$line_wrap = $rtx.closest('.heading-line-wrap'),
9459					same_line = true,
9460					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
9461					indexRtx = $splits.index($rtx);
9462
9463				fx = typeof fx === 'undefined' ? '' : fx;
9464				wait = typeof wait === 'undefined' ? '' : wait;
9465
9466				$splits.each(function(key, val){
9467					var $split = $(this),
9468						$new_line_wrap = $split.closest('.heading-line-wrap');
9469
9470					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
9471						splitArray.push( $split );
9472					}
9473
9474					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
9475						startSplit = false;
9476					}
9477
9478					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
9479						splitArray.push( $split );
9480
9481						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
9482							same_line = true;
9483						} else {
9484							same_line = false;
9485						}
9486					}
9487
9488					if ( key == indexRtx ) {
9489						if ( /\S/.test($split.text()) ) {
9490							startSplit = true;
9491							$line_wrap = $split.closest('.heading-line-wrap');
9492							splitArray.push( $split );
9493						} else {
9494							indexRtx++;
9495						}
9496					}
9497
9498					$line_wrap = $new_line_wrap;
9499				});
9500
9501				$toMove = $($.map(splitToMove, function(el){return el.get();}));
9502				$trgt = $($.map(splitArray, function(el){return el.get();}));
9503
9504				if ( same_line ) {
9505					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
9506					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
9507				}
9508
9509				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
9510					$prev.addClass('empty-span-hidden');
9511				}
9512
9513				$highl = $('.heading-text-highlight-inner', $trgt);
9514
9515				$rtx.attr('data-animated', 'true');
9516				if ( cycle == 0 ) {
9517					$( document.body ).trigger('defer-highlights');
9518					cycle++;
9519					defineObjs();
9520					return;
9521				}
9522				cycle++;
9523
9524				txt = $rtx.attr('data-text');
9525				arrTxt = txt.split("|");
9526
9527				textFadeOut($trgt);
9528
9529			});
9530		};
9531
9532		removeWraps = function(){
9533
9534			// if ( debug == 1 ) return;
9535			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
9536			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
9537
9538
9539				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
9540					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
9541
9542				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
9543
9544				$splitFlow.each(function(){
9545					$(this).append($temp_highl);
9546				});
9547
9548				var $line_wrap = $wraps[wrap_k];
9549				var $parent_wrap = $line_wrap.parentNode;
9550				if ( $parent_wrap !== null ) {
9551					while ( $line_wrap.firstChild ) {
9552						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
9553					}
9554					$parent_wrap.removeChild($line_wrap);
9555				}
9556			}
9557			// debug++;
9558			defineObjs();
9559		};
9560
9561		var loop = 0;
9562		textFadeIn = function($trgt){
9563			var word = arrTxt[loop].split(" "),
9564				worsSpan = '',
9565				$wrap = $trgt.closest('.uncode-rotating-wrap'),
9566				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
9567				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
9568
9569			for (var w = 0; w < word.length; w++) {
9570				var highl;
9571				if ( $highl.length ) {
9572					highl = $highl[0].outerHTML;
9573				} else {
9574					highl = '';
9575				}
9576
9577				if ( w > 0 ) {
9578					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
9579				}
9580				var charachters = word[w].split('');
9581				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
9582				for (var c = 0; c < charachters.length; c++) {
9583					worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
9584				}
9585				worsSpan += '</span>' + highl + '</span></span>';
9586			}
9587
9588			if ( $wrap.length && $wrap_inner.length ) {
9589				var words_w = $wrap_inner.outerWidth();
9590				$wrap.css({
9591					width: words_w
9592				});
9593
9594				$highl = $('.heading-text-highlight-inner', $wrap);
9595				$highl.prependTo($wrap);
9596
9597				$wrap_inner.css({
9598					opacity: 0
9599				});
9600
9601				$wrap_inner.html(worsSpan);
9602				$('.heading-text-highlight-inner', $wrap_inner).remove();
9603				words_w = $wrap_inner.innerWidth();
9604
9605				var duration = 0.45;
9606
9607				$heading.removeClass('auto-width');
9608				if ( words_w > $col.width() ) {
9609					$heading.addClass('auto-width');
9610					words_w = 'auto';
9611					duration = 0;
9612				}
9613
9614				$wrap.css({
9615					'width': words_w,
9616					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
9617				});
9618
9619				var $word_inner = $('.split-word-inner', $wrap_inner),
9620					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
9621
9622				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
9623
9624				if ( !$target_fx.length ) {
9625					return;
9626				}
9627
9628				gsap.killTweensOf($target_fx);
9629
9630				if ( fx !== 'zoom' ) {
9631					gsap.fromTo( $target_fx, {
9632						y: fx === 'opacity' ? '0%' : '-10%'
9633					},{
9634						delay: duration,
9635						duration: 0.25,
9636						y: '0%',
9637						ease: Circ.easeOut,
9638					});
9639
9640					if ( !$wrap_inner.length ) {
9641						return;
9642					}
9643
9644					gsap.fromTo( $wrap_inner, {
9645						opacity: 0,
9646					},{
9647						delay: duration,
9648						duration: 0.25,
9649						opacity: 1,
9650						ease: Circ.easeOut,
9651						onComplete: function(){
9652							$('> .heading-text-highlight-inner', $wrap).remove();
9653							$wrap_inner.html(worsSpan);
9654							removeWraps();
9655						}
9656					})
9657
9658				} else {
9659					gsap.fromTo( $target_fx, {
9660						transformOrigin: '50%',
9661						opacity: 0,
9662						scale: 0.875,
9663					},{
9664						opacity: 1,
9665						delay: duration,
9666						duration: 0.25,
9667						scale: 1,
9668						ease: Circ.easeOut,
9669						onComplete: function(){
9670							$('> .heading-text-highlight-inner', $wrap).remove();
9671							$wrap_inner.html(worsSpan);
9672							removeWraps();
9673						}
9674					});
9675				}
9676
9677			} else {
9678
9679				if ( !$wrap_inner.length ) {
9680					return;
9681				}
9682
9683				gsap.to( $wrap_inner, {
9684					duration: 0.4,
9685					opacity: 0,
9686					ease: Power1.easeOut,
9687					onComplete: function(){
9688						$wrap_inner.html(worsSpan);
9689						words_w = $wrap_inner.innerWidth();
9690
9691						gsap.to( $wrap_inner, {
9692							duration: 0.2,
9693							opacity: 1,
9694							ease: Power1.easeOut,
9695							onComplete: function(){
9696								$('> .heading-text-highlight-inner', $wrap).remove();
9697								$wrap_inner.html(worsSpan);
9698								removeWraps();
9699							}
9700						})
9701					}
9702				});
9703			}
9704
9705			if ( loop < arrTxt.length-1 ) {
9706				loop++;
9707			} else {
9708				loop = 0;
9709			}
9710
9711		};
9712
9713		textFadeOut = function($trgt){
9714			var $word_inner = $('.split-word-inner', $trgt),
9715				$wrap = $trgt.closest('.uncode-rotating-wrap'),
9716				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
9717				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
9718				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
9719
9720			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
9721
9722			var gsap_param = {
9723					delay: wait,
9724					duration: 0.25,
9725					y: fx === '' ? '10%' : '0%',
9726					opacity: 0,
9727					ease: Circ.easeOut,
9728					onStart: function(){
9729						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
9730							$highl = $('.heading-text-highlight-inner', $wrap);
9731							$highl.prependTo($wrap);
9732						}
9733					},
9734					onComplete: textFadeIn,
9735					onCompleteParams: [$trgt]
9736				};
9737
9738			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
9739
9740			if ( fx === '' ) {
9741				gsap_param.y = '10%';
9742			} else if ( fx === 'zoom' ) {
9743				gsap_param.scale = '1.045';
9744			}
9745
9746			if ( !$target_fx.length ) {
9747				return;
9748			}
9749
9750			if ( $heading.data('waypoint') !== true ) {
9751				var textInView = new Waypoint.Inview({
9752					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
9753					element: $heading[0],
9754					enter: function(direction) {
9755						$heading.data('waypoint',true);
9756						gsap.fromTo( $target_fx, {
9757							transformOrigin: '50%'
9758						}, gsap_param );
9759					}
9760				});
9761			} else {
9762				gsap.fromTo( $target_fx, {
9763					transformOrigin: '50%'
9764				}, gsap_param );
9765			}
9766		};
9767
9768		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9769			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
9770				var $el = model.view.$el,
9771					shortcode = model.attributes.shortcode;
9772
9773				UNCODE.rotatingTxt($el);
9774			});
9775		} else {
9776			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
9777				$heading.on('already-animated', function(){
9778					removeWraps();
9779					window.addEventListener('removeOldLines', function(){
9780						clearRequestTimeout(setCTA);
9781						setCTA = requestTimeout( removeWraps, 150 );
9782					});
9783				});
9784			} else {
9785				$(window).on('load', function(){
9786					removeWraps();
9787					window.addEventListener('removeOldLines', function(){
9788						clearRequestTimeout(setCTA);
9789						setCTA = requestTimeout( removeWraps, 150 );
9790					});
9791				});
9792			}
9793		}
9794	});
9795
9796};
9797
9798UNCODE.verticalText = function() {
9799	$(window).on('menuCanvasOpen', function(){
9800		$('.vertical-text--fixed').fadeOut(500);
9801		$('.horizontal-text--fixed').fadeOut(500);
9802	}).on('menuCanvasClose', function(){
9803		$('.vertical-text--fixed').fadeIn(500);
9804		$('.horizontal-text--fixed').fadeIn(500);
9805	});
9806
9807	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
9808	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
9809	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
9810	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
9811
9812	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
9813		window.addEventListener('scroll', function(e) {
9814			var totalPageHeight = document.body.scrollHeight;
9815			var scrollPoint = window.scrollY + window.innerHeight;
9816
9817			if (window.scrollY > 0) {
9818				showOnTopVerticalTexts.fadeOut();
9819				showOnTopHorizontalTexts.fadeOut();
9820			} else {
9821				showOnTopVerticalTexts.fadeIn();
9822				showOnTopHorizontalTexts.fadeIn();
9823			}
9824
9825			if (scrollPoint >= totalPageHeight) {
9826				hideOnBottomVerticalTexts.fadeOut();
9827				hideOnBottomHorizontalTexts.fadeOut();
9828			} else {
9829				hideOnBottomVerticalTexts.fadeIn();
9830				hideOnBottomHorizontalTexts.fadeIn();
9831			}
9832		}, false);
9833	}
9834};
9835
9836UNCODE.stickyScroll = function( $el ) {
9837	if ( typeof $el === 'undefined' || $el === null ) {
9838		$el = $('body');
9839	}
9840	var checkVisible = function( el, dir ) {
9841		if (typeof jQuery === "function" && el instanceof jQuery) {
9842			el = el[0];
9843		}
9844
9845		var off = 50;
9846		dir = typeof dir=='undefined' ? 'right' : dir;
9847		var rect = el.getBoundingClientRect();
9848
9849		return (
9850			(
9851				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
9852				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
9853				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
9854			) &&
9855			(
9856				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
9857				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
9858				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
9859				( rect.right <= window.innerWidth && rect.left >= 0 )
9860			)
9861		);
9862	};
9863
9864	var setItemsRelHeight = function(reset) {
9865		var $_el = $el;
9866		if ( $el.is('.index-scroll') ) {
9867			var $_el = $el.closest('.uncont');
9868		}
9869		$('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
9870			$.each($('.tmb', item), function(index, val) {
9871				if ( reset === true ) {
9872					$(val).css( 'visibility', 'hidden' );
9873				} else {
9874					$(val).css( 'visibility', 'visible' );
9875				}
9876			});
9877		});
9878		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
9879			$.each($('.tmb', item), function(index, val) {
9880				if ( reset === true ) {
9881					$(val).css( 'visibility', 'hidden' );
9882					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
9883				} else {
9884					var $rowParent = $(item).closest('.row-parent'),
9885						rowRatio = $rowParent.attr('data-height-ratio'),
9886						$rowInner = $(item).closest('.row-child'),
9887						rowRatioInner = $rowInner.attr('data-height'),
9888						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
9889						$colContainer = $(item).closest('.uncell'),
9890						$uncont = $(item).closest('.uncont'),
9891						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
9892						safe_heigth = $(item).data('safe-height'),
9893						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
9894						offSet = $(item).offset().top - $uncont.offset().top,
9895						multiplier_h,
9896						data_viewport_h,
9897						body_border = $('.body-borders .top-border').outerHeight() * 2,
9898						remove_menu = $(item).data('vp-menu');
9899
9900					if ( rowRatio === 'full' || rowRatio === '' ) {
9901						rowRatio = 1;
9902					} else {
9903						rowRatio = rowRatio / 100;
9904					}
9905
9906					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
9907						rowRatio = rowRatio;
9908					} else {
9909						rowRatio = rowRatio * rowRatioInner / 100;
9910					}
9911
9912					winHeight = winHeight * rowRatio;
9913
9914					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
9915						multiplier_h = parseInt($(item).attr('data-vp-height'));
9916					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
9917						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
9918					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
9919						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
9920					}
9921
9922					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
9923						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
9924						if ( remove_menu === true ) {
9925							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
9926						}
9927						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
9928					} else {
9929						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
9930					}
9931
9932				}
9933			});
9934		});
9935		$('.index-scroll', $_el).each(function(i, item){
9936			var $uncoltable = $(item).closest('.uncoltable'),
9937				$rowParent = $(item).closest('.row-parent'),
9938				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
9939				body_border = $('.body-borders .top-border').outerHeight() * 2,
9940				$index_row = $('.index-row', item),
9941				safe_heigth = $index_row.data('safe-height'),
9942				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
9943			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
9944				var data_viewport_h = winHeight - ( paddingRow + body_border );
9945				$uncoltable.css({
9946					'min-height': data_viewport_h
9947				});
9948			} else {
9949				$uncoltable.css({
9950					'min-height': 'auto'
9951				});
9952			}
9953		});
9954
9955	}
9956	setItemsRelHeight();
9957
9958	var $index_scrolls = $('.index-scroll', $el);
9959
9960	$index_scrolls.each(function(key, value){
9961		var $index = $(this),
9962			$parent_row = $index.closest('.vc_row[data-parent]'),
9963			$index_row = $('.index-row', $index),
9964			dir = $index_row.attr('data-direction');
9965		dir = typeof dir === 'undefined' ? 'right' : dir;
9966
9967		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
9968	});
9969
9970	var $horScrolls = $('.unscroll-horizontal', $el);
9971
9972	if ( $horScrolls.length ) {
9973
9974		$('body').addClass('scrolling-trigger');
9975
9976		$horScrolls.each(function(key, value){
9977			var $section = $(this),
9978				$index_scroll = $('.index-scroll', $section),
9979				$index_row = $('.index-row', $index_scroll),
9980				dir = $section.attr('data-direction'),
9981				wrap = $index_row.attr('data-wrap'),
9982				$pinWrap,
9983				$pinTrigger;
9984
9985			dir = typeof dir === 'undefined' ? 'right' : dir;
9986			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
9987			$pinWrap = $('<div class="pin-wrap" />');
9988			if ( SiteParameters.is_frontend_editor ) {
9989				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
9990				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
9991			} else {
9992				if ( wrap === 'column' ) {
9993					$index_scroll.wrapInner( $pinWrap );
9994				} else {
9995					$('> .row', $section).wrap( $pinWrap );
9996				}
9997				$section.wrapInner( $pinTrigger );
9998			}
9999
10000		});
10001
10002		var $pinWraps = $('.pin-wrap', $el);
10003
10004		var horScrollSizes = function(){
10005
10006			$pinWraps.each(function(key, val){
10007				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
10008					$pinTrigger = $pinWrap.closest('.pin-trigger'),
10009					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
10010					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
10011					$boxContainer = $('.box-container'),
10012					box_m = $boxContainer.css('margin-left'),
10013					st_active = true;
10014
10015				var setHorW,
10016				horWidth = function(){
10017					$index_scroll.each(function(){
10018						var $this = $(this),
10019							$index_row = $('.index-row', $this),
10020							$rowContainer = $index_row.closest('.vc_row'),
10021							$rowInner = $index_row.closest('.wpb_row'),
10022							$rowParent = $index_row.closest('.row-parent'),
10023							$tmbs = $('.tmb', $index_row),
10024							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
10025							$uncont = $index_row.closest('.uncont'),
10026							$parent_col = $index_row.closest('.wpb_column'),
10027							col_w = $uncont.width(),
10028							data_lg = parseFloat( $index_row.attr('data-lg') ),
10029							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
10030							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
10031							tmb_w;
10032
10033						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
10034						tmb_w = ( col_w + padding_tmb ) / data_lg;
10035
10036						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
10037							tmb_w = ( col_w + padding_tmb ) / data_sm;
10038						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
10039							tmb_w = ( col_w + padding_tmb ) / data_md;
10040						}
10041
10042						if ( !isNaN(tmb_w) ) {
10043							$tmbs.css({
10044								'width': tmb_w
10045							});
10046						}
10047
10048						$tmbs.css({
10049							'visibility': 'visible'
10050						});
10051
10052					});
10053				};
10054
10055				horWidth();
10056				clearRequestTimeout(setHorW);
10057				setHorW = requestTimeout( function(){
10058					setItemsRelHeight();
10059					horWidth();
10060				}, 100 );
10061
10062				if ( SiteParameters.is_frontend_editor ) {
10063					return;
10064				}
10065
10066				var $vmenu = $('body.vmenu .vmenu-container'),
10067					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
10068					winWidth = window.innerWidth - vmenuW,
10069					$tmb = $('.tmb', $index_scroll).eq(0),
10070					paddingRight = parseFloat( $tmb.css('padding-right') ),
10071					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_scroll.width() + paddingRight ) ),
10072					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
10073					scroll_anim;
10074
10075				if ( $('body').hasClass('rtl') ) {
10076					if ( dir === 'left' ) {
10077						scroll_anim = gsap.fromTo( $pinWrap, {
10078							x: stickyScrollLength
10079						},{
10080							x: 0,
10081							ease: "none"
10082						});
10083					} else {
10084						scroll_anim = gsap.fromTo( $pinWrap, {
10085							x: 0
10086						},{
10087							x: stickyScrollLength,
10088							ease: "none"
10089						});
10090					}
10091				} else {
10092					if ( dir === 'left' ) {
10093						scroll_anim = gsap.fromTo( $pinWrap, {
10094							x: -stickyScrollLength
10095						},{
10096							x: 0,
10097							ease: "none"
10098						});
10099					} else {
10100						scroll_anim = gsap.fromTo( $pinWrap, {
10101							x: 0
10102						},{
10103							x: -stickyScrollLength,
10104							ease: "none"
10105						});
10106					}
10107				}
10108
10109				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
10110					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
10111				}
10112
10113				var animationIncrease;
10114
10115				var checkForAnimations = function(){
10116					animationIncrease = 0
10117					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
10118						var _this = this,
10119							isScrolling;
10120						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
10121							var delayAttr = parseFloat( $(_this).attr('data-delay') );
10122							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
10123							requestTimeout(function() {
10124								$(_this).addClass('start_animation');
10125							}, delayAttr + animationIncrease);
10126							animationIncrease += 150;
10127						}
10128					});
10129				};
10130				checkForAnimations();
10131
10132				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
10133				var start = 0;
10134
10135				var horST = ScrollTrigger.create({
10136					id: "stickySectionScrolling" + key,
10137					scrub: true,
10138					trigger: $pinTrigger[0],
10139					pin: true,
10140					anticipatePin: 1,
10141					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
10142					end: function() { return "+="+stickyScrollLength; },
10143					animation: scroll_anim,
10144					ease: Sine.easeOut,
10145					onUpdate: checkForAnimations,
10146					invalidateOnRefresh: true,
10147					onEnter: function(){
10148						$pinTrigger.addClass('enter-st');
10149					},
10150					onEnterBack: function(){
10151						$pinTrigger.addClass('enter-st');
10152					},
10153					onLeave: function(){
10154						$pinTrigger.removeClass('enter-st');
10155					},
10156					onLeaveBack: function(){
10157						$pinTrigger.removeClass('enter-st');
10158					}
10159				});
10160
10161				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
10162				window.dispatchEvent(new CustomEvent('boxResized'));
10163
10164				var testSecondTrigger = function(){
10165					animationIncrease = 0
10166					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
10167						var _this = this;
10168						if ( checkVisible(_this) ) {
10169							var delayAttr = parseFloat( $(_this).attr('data-delay') );
10170							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
10171							requestTimeout(function() {
10172								$(_this).addClass('start_animation');
10173							}, delayAttr + animationIncrease);
10174							animationIncrease += 150;
10175						}
10176					});
10177
10178				};
10179
10180				var verST = ScrollTrigger.create({
10181					id: "verticalSectionScrolling" + key,
10182					trigger: $pinTrigger[0],
10183					start: "top center",
10184					end: function() { return "+="+UNCODE.wheight; },
10185					onUpdate: testSecondTrigger,
10186					invalidateOnRefresh: true
10187				});
10188
10189				var setCTA,
10190
10191				dis_enable_ST = function(){
10192					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
10193						horST.kill();
10194						verST.kill();
10195						$pinTrigger.addClass('disabled');
10196						st_active = false;
10197					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
10198						horST.kill();
10199						verST.kill();
10200						$pinTrigger.addClass('disabled');
10201						st_active = false;
10202					}
10203				};
10204
10205				$(window).on('resize load', function() {
10206					clearRequestTimeout(setCTA);
10207					setCTA = requestTimeout(function() {
10208						dis_enable_ST();
10209						checkForAnimations();
10210					}, 500);
10211				});
10212
10213			});
10214		};
10215
10216		$(window).on( 'load', function(){
10217			horScrollSizes();
10218		});
10219		var setResize,
10220			setReLayout,
10221			doubleResize = true,
10222			oldW = UNCODE.wwidth;
10223		$(window).on( 'resize orientationchange', function(){
10224			if ( 'onorientationchange' in window && oldW === UNCODE.wwidth ) {
10225				return;
10226			} else {
10227				oldW = UNCODE.wwidth;
10228			}
10229			setItemsRelHeight(true);
10230			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
10231			Array.prototype.forEach.call($row_inners, function(el) {
10232				el.style.height = '';
10233				el.style.marginBottom = '';
10234			});
10235			clearRequestTimeout(setResize);
10236			setResize = requestTimeout( function(){
10237				setItemsRelHeight();
10238				horScrollSizes();
10239				ScrollTrigger.refresh();
10240				if ( doubleResize === true ) {
10241					window.dispatchEvent(new Event('resize'));
10242					doubleResize = false;
10243				} else {
10244					doubleResize = true;
10245				}
10246				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true);
10247			}, 100 );
10248		});
10249
10250		var show_pins = function(){
10251			$('.index-scroll').css({'opacity':'1'});
10252			setResize = requestTimeout( function(){
10253			}, 10 );
10254		};
10255		ScrollTrigger.addEventListener("refresh", show_pins);
10256		$(window).on( 'uncode.re-layout', function(){
10257			//$('.index-scroll').css({'opacity':'0'});
10258			$('.pin-spacer').each(function(){
10259				var space_h = $(this).outerHeight(),
10260					$row = $(this).closest('.row-container');
10261				$row.css({
10262					'height': space_h,
10263					'overflow': 'hidden'
10264				});
10265			});
10266			ScrollTrigger.refresh(true);
10267			clearRequestTimeout(setReLayout);
10268			setReLayout = requestTimeout( function(){
10269				$('.row-container').each(function(){
10270					$(this).css({
10271						'height': '',
10272						'overflow': ''
10273					});
10274				});
10275			}, 1000);
10276		});
10277	}
10278
10279};
10280
10281UNCODE.stickyTrigger = function( $el ) {
10282	if ( SiteParameters.is_frontend_editor ) {
10283		return false;
10284	}
10285
10286	var stickyTrigger = function(){
10287		var stickyTrick = $('.sticky-trigger').each(function(){
10288			var $sticky = $(this),
10289				$inside = $('> div', $sticky),
10290				insideH = $inside.outerHeight(),
10291				$row = $sticky.closest('.vc_row'),
10292				$uncont = $sticky.closest('.uncont'),
10293				rowBottom,
10294				uncontBottom ,
10295				diffBottom;
10296
10297			ScrollTrigger.create({
10298				trigger: $sticky,
10299				start: function(){ return "top center-=" + insideH/2; },
10300				endTrigger: $row,
10301				end:  function(){
10302					rowBottom = $row.offset().top + $row.outerHeight();
10303					uncontBottom = $uncont.offset().top + $uncont.outerHeight();
10304					diffBottom = rowBottom - uncontBottom;
10305					return "bottom center+=" + ( insideH/2 + diffBottom );
10306				},
10307				anticipatePin: true,
10308				pin: true,
10309				pinSpacing: false,
10310				scrub: true,
10311				invalidateOnRefresh: true,
10312			});
10313
10314		});
10315	},
10316	setResizeSticky;
10317
10318	$(window).on( 'load', function(){
10319		stickyTrigger();
10320	});
10321
10322	var oldW = UNCODE.wwidth;
10323	$(window).on( 'resize uncode.re-layout', function(e){
10324		clearRequestTimeout(setResizeSticky);
10325		if ( e.type === 'resize' && oldW === UNCODE.wwidth ) {
10326			return;
10327		} else {
10328			oldW = UNCODE.wwidth;
10329		}
10330		setResizeSticky = requestTimeout( function(){
10331			stickyTrigger();
10332			ScrollTrigger.refresh();
10333		}, 1000 );
10334	});
10335
10336};
10337
10338UNCODE.revslider = function() {
10339	var revSliderIn = function(){
10340		$('rs-module').each(function(){
10341			var $slider = $(this);
10342
10343			$slider.on('revolution.slide.onloaded', function(e, data){
10344				if ( $(e.currentTarget).closest(".header-revslider").length ) {
10345					var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"),
10346						scrolltop = $(document).scrollTop();
10347					if ( style != undefined ) {
10348						UNCODE.switchColorsMenu(scrolltop, style);
10349					}
10350				}
10351			});
10352
10353			$slider.on('revolution.slide.onchange', function(e, data){
10354				if ( $(e.currentTarget).closest(".header-revslider").length ) {
10355					var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"),
10356						scrolltop = $(document).scrollTop();
10357					if ( style != undefined ) {
10358						UNCODE.switchColorsMenu(scrolltop, style);
10359					}
10360				}
10361			});
10362
10363		});
10364	};
10365	revSliderIn();
10366	$(window).on("load", revSliderIn );
10367};
10368UNCODE.layerslider = function() {
10369	$(window).on("load", function() {
10370
10371		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
10372
10373			var slideData = slider.slides.current.data,
10374				scrolltop = $(document).scrollTop();
10375			if( slideData && slideData.skin ) {
10376
10377				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
10378
10379			}
10380		});
10381
10382	});
10383};
10384
10385UNCODE.ajax_filters = function() {
10386
10387/*************************
10388 *
10389 * Filters Menu and Widgets Area
10390 *
10391 ************************/
10392
10393 	var clear_clicked = false;
10394
10395 	var init_ajax_grid = function(){
10396
10397		var $grids = $('.ajax-grid-system:not(.init-ajax-grid)');
10398		$grids.each(function(index, val){
10399			var $body = $('body'),
10400				$grid = $(val).addClass('init-ajax-grid'),
10401				starting_point = $grid.attr('data-toggle'),
10402				$trigger = $('.uncode-toggle-ajax-filters', $grid),
10403				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid),
10404				$isotope_wrapper = $('.isotope-wrapper', $grid),
10405				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper),
10406				$sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid),
10407				$footprint = $('.ajax-filter-footprint', $grid),
10408				sidebar_w,
10409				data_w = parseFloat( $sidebar.attr('data-max-width') ),
10410				$firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'),
10411				skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark',
10412				$positioned_top = $('.ajax-filter-position-horizontal', $grid),
10413				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
10414				$close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper),
10415				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0),
10416				sidew,
10417				$inside_row = $('> .row-parent', $vc_row),
10418				bg_row,
10419				$side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper),
10420				$side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper),
10421				$apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
10422				sidebar_overlay = false,
10423				sidebar_hover = false,
10424				switchMobile = false,
10425				scrollTop;
10426
10427			if ( $vc_row.attr('class') ) {
10428				bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/);
10429			}
10430
10431			if ( bg_row != null ) {
10432				$side_header.add($side_footer).addClass(bg_row[0]);
10433			}
10434
10435			$trigger.add($apply_filters).on('click', function(e){
10436				e.preventDefault();
10437				e.stopPropagation();
10438				$grid = $('.ajax-grid-system').eq(0);
10439				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
10440				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
10441				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
10442				sidebar_w = $sidebar_wrapper.width();
10443				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
10444				if ($(this).hasClass('ajax-filter-sidebar__button--clear')) {
10445					$(this).trigger('uncode-ajax-clear-filters');
10446				}
10447				if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
10448					$grid.toggleClass('ajax-hide-filters-blanks');
10449					$sidebar.slideToggle({
10450						duration: 400,
10451						easing: 'easeOutQuad',
10452					});
10453				} else {
10454					$grid.removeClass('ajax-hide-filters-blanks');
10455					$grid.toggleClass('ajax-hide-filters');
10456					if ( $grid.hasClass('ajax-hide-filters') ) {
10457						$body.addClass('ajax-hide-filters');
10458					} else {
10459						scrollTop = $('html, body').scrollTop();
10460						$body.removeClass('ajax-hide-filters');
10461					}
10462				}
10463				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
10464					$('html, body').scrollTop(scrollTop);
10465				}
10466				return false;
10467			});
10468
10469			$close_btn.on('click', function(e){
10470				e.preventDefault();
10471				$grid = $('.ajax-grid-system').eq(0);
10472				$grid.addClass('ajax-hide-filters');
10473				if ( $grid.hasClass('ajax-hide-filters') ) {
10474					$body.addClass('ajax-hide-filters');
10475				} else {
10476					scrollTop = $('html, body').scrollTop();
10477					$body.removeClass('ajax-hide-filters');
10478				}
10479				$('html, body').scrollTop(scrollTop);
10480			});
10481
10482			$sidebar_wrapper.on('mouseover',function(){
10483				sidebar_hover = true;
10484			}).on('mouseout', function(){
10485				sidebar_hover = false;
10486			});
10487
10488			$body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){
10489				if ( $(e.target).closest('.ajax-filter-sidebar').length ) {
10490					return;
10491				}
10492				if (undefined !== from && from === 'select_active_attributes') {
10493					return;
10494				}
10495				if ($(e.target).closest('.select2-container--open').length ) {
10496					return;
10497				}
10498				if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) {
10499					$grid.add($body).addClass('ajax-hide-filters');
10500				}
10501			});
10502
10503			$sorting_trgr.on('click', function(e) {
10504				e.preventDefault();
10505			});
10506
10507			var inside_width = function(){
10508				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
10509				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
10510				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
10511				$inside_row = $('> .row-parent', $vc_row);
10512				if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) {
10513					sidew = $sidebar.width();
10514					$inside_row.css({
10515						width: sidew
10516					});
10517				} else {
10518					$inside_row.css({
10519						width: ''
10520					});
10521				}
10522			};
10523			inside_width();
10524
10525			var ajax_sidebar_position = function(e, f_editor){
10526				$grid = $('.ajax-grid-system').eq(0);
10527				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
10528				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
10529				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
10530				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
10531				$inside_row = $('> .row-parent', $vc_row);
10532				scrollTop = $('html, body').scrollTop();
10533				if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) {
10534					$grid.add($body).addClass('ajax-hide-filters');
10535					$sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />');
10536					$body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
10537					sidebar_overlay = true;
10538					$body.addClass('ajax-filter-sidebar-overlay');
10539					$sidebar_wrapper.addClass(skin);
10540					var sideHeadH = $side_header.outerHeight(),
10541						sideFooterH = $side_footer.outerHeight();
10542					if ( data_w !== '' && data_w > 0 ) {
10543						if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
10544							$sidebar.css({
10545								'max-width': data_w
10546							});
10547						} else {
10548							$sidebar.css({
10549								'max-width':'none'
10550							});
10551						}
10552					}
10553					$vc_row.css({
10554						'padding-top':sideHeadH,
10555						'padding-bottom':sideFooterH
10556					});
10557					var sidew = $sidebar.width();
10558					$inside_row.css({
10559						width: sidew
10560					});
10561					switchMobile = true;
10562				} else {
10563					if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) {
10564						scrollTop = $('html, body').scrollTop();
10565						$grid.add($body).removeClass('ajax-hide-filters');
10566					}
10567					if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) {
10568						$grid.addClass('ajax-hide-filters-blanks');
10569						$sidebar.hide();
10570					}
10571					$('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas'));
10572					$('.ajax-sidebar-placeholder', $grid).remove();
10573					sidebar_overlay = false;
10574					$body.removeClass('ajax-filter-sidebar-overlay');
10575					$sidebar_wrapper.removeClass(skin);
10576					if ( data_w !== '' && data_w > 0 ) {
10577						$sidebar.css({
10578							'max-width':'none'
10579						});
10580					}
10581					$vc_row.css({
10582						'padding-top':0,
10583						'padding-bottom':0,
10584					});
10585
10586					$inside_row.css({
10587						width: ''
10588					});
10589
10590					if ( f_editor === true ) {
10591						UNCODE.ajax_filters();
10592					}
10593
10594					switchMobile = false;
10595				}
10596				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
10597					$('html, body').scrollTop(scrollTop);
10598				}
10599			};
10600
10601			var sidebar_width = function(){
10602				if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
10603					sidebar_w = $footprint.width();
10604					$sidebar.css({ width: sidebar_w });
10605				} else {
10606					$sidebar.css({ width: '' });
10607				}
10608			};
10609			sidebar_width();
10610
10611			if ( SiteParameters.is_frontend_editor ) {
10612				ajax_sidebar_position();
10613			}
10614
10615			$(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){
10616				if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) {
10617					ajax_sidebar_position(e);
10618				}
10619				sidebar_width();
10620			});
10621
10622			$(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){
10623				ajax_sidebar_position(e, true);
10624			});
10625
10626			$isotope_wrapper.on('transitionend', function(e){
10627				if ( $(e.target).hasClass('isotope-wrapper') ) {
10628					window.dispatchEvent(new CustomEvent('boxResized'));
10629				}
10630				return false;
10631			});
10632
10633			if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) {
10634				var $grid = $('.ajax-grid-system').eq(0);
10635				$grid.addClass('ajax-hide-filters');
10636			}
10637
10638		});
10639	};
10640
10641	init_ajax_grid();
10642	$(document).on('uncode-ajax-filtered', init_ajax_grid);
10643
10644/*************************
10645 *
10646 * Hover hack
10647 *
10648 ************************/
10649 	var widget_hover_hack = function() {
10650 		$('.widget, .uncode_widget').each(function(){
10651			var $widget = $(this),
10652				class_w = $widget.attr('class'),
10653				$lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'),
10654				$footer = $widget.closest('#colophon');
10655
10656			if ( class_w.indexOf('widget_yith') > 0 ) {
10657				return true;
10658			}
10659
10660			$lis.each(function(){
10661 				var $li = $(this),
10662 					$a = $('a', $li),
10663 					$label = $a.closest('label');
10664
10665				if ( !$footer.length ) {
10666					$li.addClass('no-evts');
10667				}
10668
10669				if ( ! $('span', $a).length ) {
10670 					$li.addClass( 'li-hover' );
10671 				}
10672
10673 				$('li', $li).hover(function(e){
10674 					$(e.target).parents('li').each(function(){
10675 						$(this).addClass( 'parent-li-hover' );
10676 					});
10677					}, function (e) {
10678 					$(e.target).parents('li').each(function(key, val){
10679 						if ( key === 0) {
10680	 						$(val).removeClass( 'parent-li-hover' );
10681	 					}
10682 					});
10683 				});
10684
10685				$li.off('mouseup').on('mouseup', function (e) {
10686					if (e.which !== 3) {
10687						e.stopPropagation();
10688						var $a = $('a', this).first();
10689						$a[0].click();
10690					}
10691	 			});
10692 			});
10693 		});
10694 	}
10695	if (SiteParameters.disable_hover_hack !== '1') {
10696		widget_hover_hack();
10697		$(document).on('uncode-ajax-filtered', widget_hover_hack);
10698	}
10699
10700/*************************
10701 *
10702 * Init Filters
10703 *
10704 ************************/
10705
10706	function init_filters() {
10707		$(document).on('click', '.term-filter-link', function(e) {
10708			var _this = $(this);
10709			var widget = _this.closest('.uncode_widget');
10710			var container = get_filters_container();
10711
10712			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
10713				return true;
10714			}
10715
10716			e.preventDefault();
10717
10718			if (widget.hasClass('widget-ajax-filters--checkbox')) {
10719				_this.parent().find('input[type="checkbox"]').trigger('click');
10720			} else {
10721				if (_this.hasClass('term-filter-link--active')) {
10722					_this.removeClass('term-filter-link--active');
10723				} else {
10724					_this.addClass('term-filter-link--active');
10725
10726					if (widget.hasClass('widget-ajax-filters--single')) {
10727						widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active');
10728					}
10729				}
10730
10731				var url = _this.attr('href');
10732
10733				reload_items(container, url, true);
10734			}
10735		});
10736
10737		$(document).on('click', '.term-filter input[type="checkbox"]', function(e) {
10738			var _this = $(this);
10739			var widget = _this.closest('.uncode_widget');
10740			var link = _this.closest('.term-filter').find('.term-filter-link');
10741			var url = link.attr('href');
10742			var container = get_filters_container();
10743
10744			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
10745				window.location = url;
10746				return;
10747			}
10748
10749			if (widget.hasClass('widget-ajax-filters--single')) {
10750				widget.find('input[type="checkbox"]').each(function() {
10751					if (_this.attr('id') !== $(this).attr('id')) {
10752						$(this).prop('checked', false);
10753						$(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active');
10754					}
10755				});
10756			}
10757
10758			if (_this.prop('checked')) {
10759				link.addClass('term-filter-link--active');
10760			} else {
10761				link.removeClass('term-filter-link--active');
10762			}
10763
10764			reload_items(container, url, true);
10765		});
10766
10767		$(document).on('change', 'select.select--term-filters', function(e) {
10768			var _this = $(this);
10769			var selected = _this.find('option:selected');
10770			var option = $(selected);
10771			var url = option.attr('data-term-filter-url');
10772			var container = get_filters_container();
10773			var widget = _this.closest('.uncode_widget');
10774
10775			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
10776				window.location = url;
10777			} else {
10778				reload_items(container, url, true);
10779			}
10780		});
10781
10782		$(document).on('click', '.filter-list__link', function(e) {
10783			if (SiteParameters.is_frontend_editor) {
10784				return false;
10785			}
10786
10787			e.preventDefault();
10788
10789			var _this = $(this);
10790			var container = get_filters_container();
10791			var url = _this.attr('href');
10792			reload_items(container, url, true);
10793		});
10794
10795		$('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) {
10796			var _this = $(this);
10797			var container = get_filters_container();
10798			var url = _this.attr('href');
10799			reload_items(container, url, true);
10800		});
10801
10802		$(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) {
10803
10804			var _this = $(this);
10805			var container = get_filters_container();
10806			var url = _this.attr('href');
10807
10808			if ( container.length ) {
10809				e.preventDefault();
10810				reload_items(container, url, true);
10811			}
10812		});
10813
10814		$(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) {
10815			var _this = $(this);
10816			var container = get_filters_container();
10817
10818			if (container.length > 0) {
10819				e.preventDefault();
10820
10821				var min_price = $('#min_price').val();
10822				var max_price = $('#max_price').val();
10823				var location = window.location;
10824				var url = location.href;
10825				var page_uri = location.origin + location.pathname;
10826				var is_filtered = page_uri !== url;
10827
10828				if (is_filtered) {
10829					url = remove_parameter_from_url(url, 'min_price');
10830					url = remove_parameter_from_url(url, 'max_price');
10831				}
10832
10833				var concat = page_uri === url ? '?' : '&';
10834				var params = {'min_price': min_price, 'max_price': max_price};
10835
10836				url = url + concat + $.param(params);
10837
10838				reload_items(container, url, true);
10839			}
10840		});
10841
10842		var search_timer;
10843
10844		$(document).on('keyup', '.term-filters-search-input', function(e) {
10845			var _this = $(this);
10846			var container = get_filters_container();
10847			var value = _this.val();
10848
10849			if (search_timer) {
10850				clearTimeout(search_timer);
10851			}
10852
10853			search_timer = setTimeout(function() {
10854				update_search_url(container, value);
10855			}, 500);
10856		});
10857	}
10858
10859	function update_search_url(container, search_value) {
10860		var location = window.location;
10861		var url = location.href;
10862		var page_uri = location.origin + location.pathname;
10863		var is_filtered = page_uri !== url;
10864		var key_search = SiteParameters.ajax_filter_key_search;
10865		var key_unfilter = SiteParameters.ajax_filter_key_unfilter;
10866
10867		if (is_filtered) {
10868			url = remove_parameter_from_url(url, key_search);
10869			url = remove_parameter_from_url(url, key_unfilter);
10870		}
10871
10872		if (search_value) {
10873			var concat = page_uri === url ? '?' : '&';
10874			var params = {};
10875
10876			params[key_search] = search_value;
10877			params[key_unfilter] = 1;
10878			url = url + concat + $.param(params);
10879		} else {
10880			url = remove_parameter_from_url(url, key_search);
10881		}
10882
10883		reload_items(container, url, true);
10884	}
10885
10886	function remove_parameter_from_url(url, parameter) {
10887		return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
10888	}
10889
10890	function get_filters_container() {
10891		var container = $('.ajax-grid-system');
10892
10893		if (container.length == 0) {
10894			container = $('.ajax-filters');
10895		}
10896
10897		return container;
10898	}
10899
10900	function update_widgets_state(widgets_states, container) {
10901		for (var i = widgets_states.length - 1; i >= 0; i--) {
10902			var state = widgets_states[i];
10903
10904			if (!state.collapse) {
10905				continue;
10906			}
10907
10908			var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"');
10909
10910			if (state.open) {
10911				new_widget.find('.widget-title').addClass('open');
10912				if (state.css) {
10913					new_widget.find('.widget-collapse-content').attr('style', state.css);
10914				}
10915			} else {
10916				new_widget.find('.widget-title').removeClass('open');
10917				if (state.css) {
10918					new_widget.find('.widget-collapse-content').attr('style', state.css);
10919				}
10920			}
10921		}
10922	}
10923
10924	// Reload items via AJAX
10925	function reload_items(container, url, push) {
10926		container.addClass('grid-filtering');
10927
10928		$.ajax({
10929			url     : url,
10930			success : function(response) {
10931				if (!response) {
10932					return;
10933				}
10934
10935				$(document).trigger('uncode-ajax-pre-filtered');
10936
10937				var container_id = container.attr('id');
10938				var pagination = $('.row-navigation');
10939
10940				if (container_id) {
10941					var container_to_append = $(response).find('#' + container_id);
10942					var pagination_to_append = $(response).find('.row-navigation');
10943					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
10944
10945					// Remember open/closed widgets
10946					var widgets = $('.uncode_widget');
10947					var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append;
10948					var widgets_states = [];
10949
10950					widgets.each(function() {
10951						var widget = $(this);
10952						var id = widget.attr('data-id');
10953						var state = {
10954							'id': id,
10955							'collapse': false,
10956							'open': false,
10957							'css': false,
10958						};
10959
10960						var collapse_wrapper = widget.find('.widget-collapse-content');
10961
10962						if (collapse_wrapper.length > 0) {
10963							state.collapse = true;
10964
10965							var collapse_wrapper_css = collapse_wrapper.attr('style');
10966							var title = widget.find('.widget-title');
10967
10968							state.css = collapse_wrapper_css;
10969
10970							if (title.hasClass('open')) {
10971								state.open = true;
10972							} else {
10973								state.open = false;
10974							}
10975						}
10976
10977						widgets_states.push(state);
10978					});
10979
10980					// Update widgets state
10981					if (offcanvas_sidebar_wrapper.length === 0) {
10982						update_widgets_state(widgets_states, container_to_append);
10983					}
10984
10985					// Update default sidebar state
10986					if (!container.hasClass('ajax-hide-filters')) {
10987						container_to_append.removeClass('ajax-hide-filters');
10988					}
10989
10990					// Update horizontal sidebar
10991					if (!container.hasClass('ajax-hide-filters-blanks')) {
10992						container_to_append.removeClass('ajax-hide-filters-blanks');
10993					}
10994					var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal');
10995					if (horizontal_sidebar_wrapper.length > 0) {
10996						var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar');
10997						var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style');
10998						var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0);
10999						var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style');
11000
11001						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style);
11002						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style);
11003					}
11004
11005					// Append container
11006					container.replaceWith(container_to_append);
11007
11008					// Hide first thumbnail until the new srcset is loaded
11009					if (SiteParameters.dynamic_srcset_active === '1') {
11010						container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations');
11011					}
11012
11013					// Remove loading attribute to images
11014					container_to_append.find('img').attr('loading', '');
11015
11016					// Append pagination
11017					if (pagination.length > 0) {
11018						if (pagination_to_append.length > 0) {
11019							pagination.html(pagination_to_append.html());
11020						} else {
11021							pagination.html('');
11022						}
11023					} else {
11024						if (pagination_to_append.length > 0) {
11025							$('.post-wrapper').append(pagination_to_append);
11026						}
11027					}
11028
11029					// Update off canvas sidebar (mobile and overlay)
11030					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
11031
11032					if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) {
11033						var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0);
11034						var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0);
11035						container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />');
11036						container_to_append.find('.ajax-filter-sidebar-wrapper').remove();
11037
11038						// Update widgets state
11039						update_widgets_state(widgets_states, sidebar_to_append);
11040
11041						// Update sidebar
11042						sidebar_container.html(sidebar_to_append.html());
11043					}
11044
11045					if (push) {
11046						UNCODE.lastURL = url;
11047						window.history.pushState(
11048							{ pageTitle: document.title },
11049							'',
11050							url
11051						);
11052					}
11053
11054					if (typeof UNCODE.isotopeLayout !== 'undefined') {
11055						UNCODE.isotopeLayout();
11056					}
11057					if (typeof UNCODE.justifiedGallery !== 'undefined') {
11058						UNCODE.justifiedGallery();
11059					}
11060					if (typeof UNCODE.cssGrid !== 'undefined') {
11061						UNCODE.cssGrid();
11062					}
11063					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
11064						UNCODE.lightbox();
11065					}
11066					if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
11067						UNCODE.lightgallery();
11068					}
11069					if (typeof UNCODE.carousel !== 'undefined') {
11070						UNCODE.carousel($('body'));
11071					}
11072					UNCODE.animations();
11073					if (typeof UNCODE.filters !== 'undefined') {
11074						UNCODE.filters();
11075					}
11076					if (typeof UNCODE.widgets !== 'undefined') {
11077						UNCODE.widgets();
11078					}
11079
11080					if (SiteParameters.dynamic_srcset_active === '1') {
11081						UNCODE.refresh_dynamic_srcset_size();
11082					}
11083
11084					if (typeof UNCODE.menuSmartInit !== 'undefined') {
11085						UNCODE.menuSmartInit();
11086					}
11087
11088					if (typeof UNCODE.parallax !== 'undefined') {
11089						UNCODE.parallax();
11090					}
11091
11092					maybe_scroll_to_top();
11093
11094					var woo_select2_cats = $('.dropdown_product_cat');
11095
11096					if (woo_select2_cats.length > 0) {
11097						woo_select2_cats.on( 'change', function() {
11098							if ( $(this).val() != '' ) {
11099								var this_page = '';
11100								var home_url  = UncodeWCParameters.uncode_wc_widget_product_categories_home_url;
11101								if ( home_url.indexOf( '?' ) > 0 ) {
11102									this_page = home_url + '&product_cat=' + $(this).val();
11103								} else {
11104									this_page = home_url + '?product_cat=' + $(this).val();
11105								}
11106								location.href = this_page;
11107							} else {
11108								location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url;
11109							}
11110						});
11111
11112						if ( $().selectWoo ) {
11113							var wc_product_cat_select = function() {
11114								woo_select2_cats.selectWoo( {
11115									placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder,
11116									minimumResultsForSearch: 5,
11117									width: '100%',
11118									allowClear: true,
11119									language: {
11120										noResults: function() {
11121											return UncodeWCParameters.uncode_wc_widget_product_categories_no_results;
11122										}
11123									}
11124								} );
11125							};
11126							wc_product_cat_select();
11127						}
11128					}
11129
11130					$(document).trigger('uncode-ajax-filtered');
11131					$(document.body).trigger('init_price_filter');
11132				}
11133			},
11134			error: function() {
11135				container.removeClass('grid-filtering');
11136
11137				if (SiteParameters.enable_debug == true) {
11138					// This console log is disabled by default
11139					// So nothing is printed in a typical installation
11140					//
11141					// It can be enabled for debugging purposes setting
11142					// the 'uncode_enable_debug_on_js_scripts' filter to true
11143					console.log('There was an error retrieving the products');
11144				}
11145			}
11146		});
11147	}
11148
11149	// Scroll to top after filtering
11150	function maybe_scroll_to_top() {
11151		var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
11152
11153		if (offcanvas_sidebar_wrapper.length > 0) {
11154			return;
11155		}
11156
11157		var container = get_filters_container();
11158		var bound = container[0].getBoundingClientRect();
11159
11160		if (bound.y < 0) {
11161			$(window).scrollTop(container.offset().top);
11162		}
11163	}
11164
11165	// Back/forward browser buttons
11166	$(window).on("popstate.ajaxfilters", function(e) {
11167		var location = window.location;
11168		var url = location.href;
11169		var params = UNCODE.getURLParams(window.location);
11170		var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
11171
11172		UNCODE.lastURL = url;
11173
11174		if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
11175			return;
11176		}
11177
11178		var container = get_filters_container();
11179
11180		reload_items(container, url, false);
11181	});
11182
11183	// Destroy load more before to init a new one
11184	$(window).on('uncode-ajax-pre-filtered', function() {
11185		if ($.fn.infinitescroll) {
11186			$('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy');
11187		}
11188	});
11189
11190	init_filters();
11191};
11192
11193UNCODE.videoThumbs = function() {
11194	var checkResize,
11195		newW = UNCODE.wwidth;
11196	var checkForVideos = function(){
11197
11198		$(window).on('okevents.y.change', function(e, y){
11199			var $video = $(y.target.g),
11200				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
11201				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
11202				restart = !$video_wrap.hasClass('play-pause'),
11203				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual'),
11204				setTime;
11205			if ( newW >= UNCODE.mediaQuery ) {
11206
11207				if( $video_wrap.length && $video_wrap.data('hovered') !== true ) {
11208					$video_wrap.data('hovered', true);
11209					$video_wrap.addClass('played-on');
11210					y.target.pauseVideo();
11211					$tmb.on('mouseenter', function(){
11212						if ( restart ) {
11213							y.target.seekTo(0);
11214						}
11215						y.target.playVideo();
11216					}).on('mouseleave', function(){
11217						clearTimeout(setTime);
11218						setTime = setTimeout(function(){
11219							y.target.pauseVideo();
11220						}, 300);
11221					});
11222				}
11223
11224			} else {
11225				if( $mobile_video_wrap.length ) {
11226					$video_wrap.addClass('played-on');
11227					y.target.playVideo();
11228				}
11229			}
11230
11231		});
11232
11233		$(window).on('okevents.v.loaded', function(e, playerV){
11234			var $video = $(playerV.element),
11235				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
11236				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
11237				restart = !$video_wrap.hasClass('play-pause'),
11238				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual'),
11239				setTime;
11240
11241			if ( newW >= UNCODE.mediaQuery ) {
11242				
11243				if( $video_wrap.length ) {
11244
11245					var playPromise = playerV.play();
11246					if (playPromise !== undefined) {
11247						playPromise.then(function( value ) {
11248							playerV.pause();
11249						});
11250					}
11251					$video_wrap.addClass('played-on');
11252					$tmb.on('mouseenter', function(){
11253						if ( restart ) {
11254							playerV.setCurrentTime(0)
11255						}
11256						playerV.play();
11257					}).on('mouseleave', function(){
11258						clearTimeout(setTime);
11259						setTime = setTimeout(function(){
11260							playerV.pause();
11261						}, 300);
11262					});
11263				}
11264
11265			} else {
11266
11267				if( $mobile_video_wrap.length ) {
11268					var playPromise = playerV.play();
11269					if (playPromise !== undefined) {
11270						playPromise.then(function( value ) {
11271							playerV.play();
11272						});
11273					}
11274					$video_wrap.addClass('played-on');
11275				}
11276			}
11277		});
11278
11279		$('.fluid-object.self-video.is-no-control video').each(function(key, video){
11280			var $video = $(video),
11281				$noscript = $('noscript', $video),
11282				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
11283				restart = !$video_wrap.hasClass('play-pause'),
11284				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
11285				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') 
11285: $video.closest('.t-entry-visual'),
11286				setTime,
11287			manageVideo = function(){
11288				video.currentTime = 0;
11289				video.pause();
11290				if ( newW >= UNCODE.mediaQuery ) {
11291					if ( $video_wrap.length ) {
11292						$video_wrap.addClass('played-on');
11293						$tmb.on('mouseenter', function(){
11294							if ( restart ) {
11295								video.currentTime = 0;
11296							}
11297							video.play();
11298						}).on('mouseleave', function(){
11299							clearTimeout(setTime);
11300							setTime = setTimeout(function(){
11301								video.pause();
11302							}, 300);
11303						});
11304					} else {
11305						video.play();
11306					}
11307				} else {
11308					if ( $mobile_video_wrap.length ) {
11309						$mobile_video_wrap.addClass('played-on');
11310						video.play();
11311					}
11312				}
11313
11314			};
11315			if ( $noscript.length && newW >= UNCODE.mediaQuery ) {
11316				$noscript.each(function(key, val){
11317					$noscript.after(val.textContent || val.innerText);
11318					$noscript.remove();
11319				});
11320			}
11321
11322			if (typeof MediaElement === "function") {
11323				$video.has('source[src]').mediaelementplayer({
11324					pauseOtherPlayers: false,
11325				});
11326			}
11327			if (video.readyState > 0) {
11328				manageVideo();
11329			} else {
11330				$video.on("loadedmetadata", function(_event) {
11331					manageVideo();
11332				});
11333			};
11334		});
11335	
11336	};
11337	
11338	checkForVideos();
11339
11340	var checkVideoResize = function(){
11341		clearRequestTimeout(checkResize);
11342		checkResize = requestTimeout(function(){
11343			if ( newW !== UNCODE.wwidth ) {
11344				checkForVideos();
11345				newW = UNCODE.wwidth;
11346			}
11347		}, 1000);
11348	};
11349
11350	$(window).off('resize.videos', checkVideoResize)
11351	.on( 'resize.videos', checkVideoResize);
11352
11353};
11354UNCODE.lottie = function() {
11355    if ( SiteParameters.is_frontend_editor ) {
11356        var $lottie_wraps = $('div.uncode-lottie-wrap');
11357        $lottie_wraps.each(function(){
11358            var $lottie_wrap = $(this),
11359                $div_player = $('div.uncode-lottie-player', $lottie_wrap),
11360                $player_clone = $div_player.clone(),
11361                player_id = $div_player.attr('data-id'),
11362                $lottie_players = $('lottie-player', $lottie_wrap).remove();
11363            if ( $div_player.attr('data-init') !== true && $player_clone.length ) {
11364                if ( $('#'+player_id).length ) {
11365                    player_id += '_' + Math.floor(Math.random() * 10000000000000000);
11366                }
11367                $player_clone.attr('id', player_id);
11368                $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player");
11369                $div_player.after($player_clone);
11370                $div_player.attr('data-init',true);
11371            }
11372        });
11373    }
11374    var $players = $('.uncode-lottie-wrap lottie-player');
11375    $players.each(function(){
11376        var player = this,
11377            this_id = $(player).attr('id'),
11378            _player = document.getElementById(this_id),
11379            trigger = $(player).attr('data-trigger'),
11380            pFrames = $(player).attr('data-frames').split(','),
11381            srcPlayer = $(player).attr('src');
11382
11383        _player.load(srcPlayer);
11384
11385        _player.addEventListener("ready", function() {
11386
11387            var $_shadow = _player.shadowRoot;
11388            $($_shadow).find('.error').remove();
11389
11390            var tFrames = _player.getLottie().totalFrames / 100,
11391                pFrame_from = Math.round(tFrames * pFrames[0]),
11392                pFrame_to = Math.round( tFrames * pFrames[1] ) - 1,
11393                loop = $(player).attr('loop'),
11394                mode,
11395                actions;
11396
11397            if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) {
11398                if ( trigger === 'scroll' ) {
11399                    mode = 'scroll';
11400                    actions = [
11401                        {
11402                            visibility:[0, 1.0],
11403                            type: "seek",
11404                            frames: [pFrame_from, pFrame_to],
11405                        }
11406                    ];
11407                } else if ( trigger === 'viewport') {
11408                    mode = 'scroll';
11409                    actions = [
11410                        {
11411                            visibility: [0.20, 1.0],
11412                            frames: [pFrame_from, pFrame_to],
11413                            type: loop ? "loop" : "play"
11414                        }
11415                    ];
11416                } else if ( trigger === 'hover') {
11417                    $(player).on('mouseenter', function(){
11418                        _player.play();
11419                    }).on('mouseleave', function(){
11420                        _player.pause();
11421                    });
11422                    if ( pFrame_from > 0 && pFrame_from < 99 ) {
11423                        _player.seek(pFrame_from);
11424                        _player.addEventListener("frame", function(){
11425                            if ( _player.getLottie().currentFrame >= pFrame_to ) {
11426                                _player.seek(pFrame_from);
11427                            }
11428                        });
11429                    }
11430                }
11431                LottieInteractivity.create({
11432                    player: '#' + this_id,
11433                    mode: mode,
11434                    actions: actions
11435                });
11436            } else {
11437                if ( pFrame_from > 0 && pFrame_from < 99 ) {
11438                    _player.seek(pFrame_from);
11439                    _player.addEventListener("frame", function(){
11440                        if ( _player.getLottie().currentFrame >= pFrame_to ) {
11441                            _player.seek(pFrame_from);
11442                        }
11443                    });
11444                }
11445            }
11446        });
11447
11448        $(window).on('unlottie-destroy', function(){
11449            _player.destroy();
11450        });
11451    });
11452};
11453
11454	UNCODE.init = function() {
11455		var wfl_check = false, wfl_request, waypoint_request;
11456		UNCODE.preventDoubleTransition();
11457		UNCODE.betterResize();
11458		UNCODE.utils();
11459		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
11460			UNCODE.changeSkinOnScroll();
11461		}
11462		if (typeof UNCODE.share !== 'undefined') {
11463			UNCODE.share();
11464		}
11465		if (typeof UNCODE.tooltip !== 'undefined') {
11466			UNCODE.tooltip();
11467		}
11468		if (typeof UNCODE.counters !== 'undefined') {
11469			UNCODE.counters();
11470		}
11471		if (typeof UNCODE.countdowns !== 'undefined') {
11472			UNCODE.countdowns();
11473		}
11474		if (typeof UNCODE.tabs !== 'undefined') {
11475			UNCODE.tabs();
11476		}
11477		if (typeof UNCODE.collapse !== 'undefined') {
11478			UNCODE.collapse();
11479		}
11480		if (typeof UNCODE.bigText !== 'undefined') {
11481			UNCODE.bigText();
11482		}
11483		UNCODE.menuSystem();
11484		if (typeof UNCODE.bgChanger !== 'undefined') {
11485			UNCODE.bgChanger();
11486		}
11487		if (typeof UNCODE.magicCursor !== 'undefined') {
11488			UNCODE.magicCursor();
11489		}
11490		if (typeof UNCODE.magneticCursor !== 'undefined') {
11491			UNCODE.magneticCursor();
11492		}
11493		if (typeof UNCODE.dropImage !== 'undefined') {
11494			UNCODE.dropImage();
11495		}
11496		if (typeof UNCODE.postTable !== 'undefined') {
11497			UNCODE.postTable();
11498		}
11499		if (typeof UNCODE.rotatingTxt !== 'undefined') {
11500			UNCODE.rotatingTxt();
11501		}
11502		if (typeof UNCODE.okvideo !== 'undefined') {
11503			UNCODE.okvideo();
11504		}
11505		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
11506			UNCODE.backgroundSelfVideos();
11507		}
11508		UNCODE.tapHover();
11509		if (typeof UNCODE.isotopeLayout !== 'undefined') {
11510			UNCODE.isotopeLayout();
11511		}
11512		if (typeof UNCODE.justifiedGallery !== 'undefined') {
11513			UNCODE.justifiedGallery();
11514		}
11515		if (typeof UNCODE.cssGrid !== 'undefined') {
11516			UNCODE.cssGrid();
11517		}
11518		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
11519			UNCODE.lightbox();
11520		}
11521		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
11522			$(window).on('load more-items-loaded',function(){
11523				UNCODE.lightgallery();
11524			});
11525		}
11526		if (typeof UNCODE.carousel !== 'undefined') {
11527			UNCODE.carousel($('body'));
11528		}
11529		if (typeof UNCODE.lettering !== 'undefined') {
11530			UNCODE.lettering();
11531		}
11532		UNCODE.animations();
11533		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
11534			UNCODE.stickyElements();
11535		}
11536		if (typeof UNCODE.twentytwenty !== 'undefined') {
11537			UNCODE.twentytwenty();
11538		}
11539		UNCODE.disableHoverScroll();
11540		UNCODE.printScreen();
11541		if (typeof UNCODE.particles !== 'undefined') {
11542			UNCODE.particles();
11543		}
11544		if (typeof UNCODE.filters !== 'undefined') {
11545			UNCODE.filters();
11546		}
11547		if (typeof UNCODE.ajax_filters !== 'undefined') {
11548			UNCODE.ajax_filters();
11549		}
11550		if (typeof UNCODE.widgets !== 'undefined') {
11551			UNCODE.widgets();
11552		}
11553		if (typeof UNCODE.unmodal !== 'undefined') {
11554			UNCODE.unmodal();
11555		}
11556		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
11557			if ( !UNCODE.isFullPage ) {
11558				UNCODE.checkScrollForTabs();
11559			}
11560		}
11561		if (typeof UNCODE.onePage !== 'undefined') {
11562			UNCODE.onePage(UNCODE.isMobile);
11563		}
11564		if (typeof UNCODE.fullPage !== 'undefined') {
11565			$(document).ready(function(){
11566				UNCODE.fullPage();
11567			});
11568		}
11569		if (typeof UNCODE.skewIt !== 'undefined') {
11570			UNCODE.skewIt();
11571		}
11572		if (typeof UNCODE.rotateIt !== 'undefined') {
11573			UNCODE.rotateIt();
11574		}
11575		if (typeof UNCODE.textMarquee !== 'undefined') {
11576			UNCODE.textMarquee();
11577		}
11578		if (typeof UNCODE.stickyScroll !== 'undefined') {
11579			UNCODE.stickyScroll();
11580		}
11581		if (typeof UNCODE.stickyTrigger !== 'undefined') {
11582			UNCODE.stickyTrigger();
11583		}
11584		if (typeof UNCODE.verticalText !== 'undefined') {
11585			UNCODE.verticalText();
11586		}
11587		if (typeof UNCODE.videoThumbs !== 'undefined') {
11588			UNCODE.videoThumbs();
11589		}
11590		if (typeof UNCODE.revslider !== 'undefined') {
11591			UNCODE.revslider();
11592		}
11593		if (typeof UNCODE.layerslider !== 'undefined') {
11594			UNCODE.layerslider();
11595		}
11596		if (typeof UNCODE.lottie !== 'undefined') {
11597			UNCODE.lottie();
11598		}
11599		$(window).on('load',function(){
11600			clearRequestTimeout(waypoint_request);
11601			waypoint_request = requestTimeout( function(){
11602				Waypoint.refreshAll();
11603			}, 1000);
11604
11605			if (typeof UNCODE.parallax !== 'undefined') {
11606				UNCODE.parallax();
11607			}
11608		});
11609	}
11610
11611	if ( ! SiteParameters.is_frontend_editor ) {
11612		UNCODE.init();
11613	}
11614
11615
11616})(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.