PageSourceSearch

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

js theparlour.net collected 2026-09-26 09:00:45 UTC 372,679 bytes, 11,666 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		if (!$(this).hasClass('star')) {
78			$(this).attr('data-title', $(this).attr('title'));
79			$(this).removeAttr('title');
80		}
81	});
82	$(document).on('mouseout', 'a', function () {
83		if (!$(this).hasClass('star')) {
84			$(this).attr('title', $(this).attr('data-title'));
85			$(this).removeAttr('data-title');
86		}
87	});
88
89	this.get_scroll_offset = function(e) {
90
91		var scroll_offset = 0,
92			target,
93			trigger;
94
95		if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) {
96			target = e.target;
97			trigger = e.currentTarget;
98		}
99
100		if ($('.menu-hide').length || $('.menu-hide-vertical').length) {
101			if (UNCODE.bodyTop > UNCODE.wheight / 2) {
102				UNCODE.hideMenu(100);
103			}
104		}
105
106		if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery  ) {
107			// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
108			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
109				if ( ( $('.menu-sticky').length && !$('.menu-hide').length && !UNCODE.isMobile ) || ( $('.menu-sticky-mobile').length && UNCODE.isMobile ) ) {
110					if ( !$('.menu-hided').length ) {
111						scroll_offset += $('.logo-container:visible').outerHeight();
112					}
113				} else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) {
114					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
115					scroll_offset += $('.menu-sticky .menu-container').outerHeight() - ( $('.navbar-brand').data('minheight') + shrink );
116				} else {
117					if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) {
118						scroll_offset += UNCODE.menuMobileHeight;
119					} else {
120						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 ) {
121							//scroll_offset += $('.main-menu-container > div:first-child()').height() - 2;
122						} else {
123							if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) {
124								scroll_offset += UNCODE.menuMobileHeight;
125							}
126						}
127					}
128				}
129			}
130
131		}
132
133		scroll_offset += UNCODE.bodyBorder;
134
135		return scroll_offset;
136	}
137
138	if ( !UNCODE.isFullPage ) {
139		$(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) {
140
141			var hash = (e.currentTarget).hash,
142			is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false,
143			anchor = '';
144			if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return;
145			if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) {
146				e.preventDefault();
147				if (!$('#tab-reviews').is(':visible')) {
148					$('a[href="#tab-reviews"]').trigger('click');
149				}
150				var calc_scroll = $('.wootabs .tab-content').offset().top;
151				calc_scroll -= UNCODE.get_scroll_offset(e);
152
153				if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
154					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
155
156					if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
157						scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
158					}
159				}
160
161				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
162					delta = bodyTop - calc_scroll,
163					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
164				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
165
166				requestTimeout(function(){
167					if (scrollSpeed == 0) {
168						$('html, body').scrollTop(calc_scroll);
169						UNCODE.scrolling = false;
170					} else {
171   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
172							$(this).stop();
173						}).animate({
174								scrollTop: calc_scroll
175							}, scrollSpeed, 'easeInOutCubic', function() {
176								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
177								UNCODE.scrolling = false;
178							}
179						);
180					}
181				}, 200);
182				return;
183			}
184			if (hash != undefined) {
185				var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
186				var anchor = this.hash.slice(1);
187				if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) {
188			  		if ( !specialFormat.test(hash) ) {
189			  			if ( $(hash).length )
190			  				anchor = $(hash);
191			  		}
192				}
193			}
194
195			if (is_scrolltop || anchor != '') {
196				if (is_scrolltop) {
197					e.preventDefault();
198					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
199					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
200					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
201
202					if (scrollSpeed == 0) {
203						$('html, body').scrollTop(0);
204						UNCODE.scrolling = false;
205					} else {
206   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
207							$(this).stop();
208						}).animate({
209							scrollTop: 0
210						}, scrollSpeed, 'easeInOutCubic', function() {
211							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
212							UNCODE.scrolling = false;
213						});
214					}
215				} else {
216					var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor;
217					$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) {
218						var get_href = $(val).attr('href');
219						if (get_href != undefined) {
220							if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active');
221							else $(val).parent().removeClass('active');
222						}
223					});
224					if (scrollSection.length) {
225						if ( $('body').hasClass('uncode-scroll-no-history') ) {
226							e.preventDefault();
227						}
228
229						if (UNCODE.menuOpened) {
230							if (UNCODE.wwidth < UNCODE.mediaQuery) {
231								window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
232							} else {
233								$('.mmb-container-overlay .overlay-close').trigger('click');
234								$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
235							}
236						}
237
238						var calc_scroll = scrollSection.offset().top,
239							getOffset = UNCODE.get_scroll_offset(e),
240							$logo = $('.logo-container:visible'),
241							logoH,
242							$menu = $('#masthead .menu-container'),
243							menuH;
244
245						calc_scroll -= isNaN(getOffset) ? 0 : getOffset;
246
247						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
248							delta = bodyTop - calc_scroll,
249							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
250						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
251
252						if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
253							if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) {
254								logoH = $logo.outerHeight(),
255								menuH = $menu.outerHeight();
256								if ( calc_scroll < ( logoH + menuH ) ) {
257									calc_scroll = 0;
258								}
259							}
260						}
261
262						if ( UNCODE.menuStickyMobileOverlay === false && UNCODE.isMobile ) {
263							calc_scroll = calc_scroll - parseFloat( $('.overlay.overlay-menu').outerHeight() );
264						}
265
266						if (scrollSpeed == 0) {
267							$('html, body').scrollTop(calc_scroll);
268							UNCODE.scrolling = false;
269						} else {
270	   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
271								$(this).stop();
272							}).animate({
273								scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
274							}, scrollSpeed, 'easeInOutCubic', function() {
275								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
276								UNCODE.scrolling = false;
277								if  ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
278								||
279								$('.menu-hided').length ) {
280									calc_scroll = scrollSection.offset().top;
281									getOffset = UNCODE.get_scroll_offset(e);
282									calc_scroll -= getOffset;
283									$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
284										$(this).stop();
285									}).animate({
286										scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
287										}, scrollSpeed, 'easeInOutCubic', function() {
288											$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
289											UNCODE.scrolling = false;
290										}
291									);
292								}
293							});
294						}
295					}
296				}
297			}
298		});
299		$('.header-scrolldown').on('click', function(event) {
300
301			event.preventDefault();
302
303			var pageHeader = $(event.target).closest('#page-header'),
304				pageHeaderTop = pageHeader.offset().top,
305				pageHeaderHeight = pageHeader.outerHeight(),
306				scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
307			if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
308
309			var calc_scroll = pageHeaderTop + pageHeaderHeight,
310			getOffset = UNCODE.get_scroll_offset(event);
311			calc_scroll -= getOffset;
312
313			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
314				var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
315
316				if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
317					scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
318				}
319			}
320
321			if (scrollSpeed == 0) {
322				$('html, body').scrollTop(calc_scroll);
323				UNCODE.scrolling = false;
324			} else {
325					$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
326						$(this).stop();
327					}).animate({
328						scrollTop: calc_scroll
329					}, scrollSpeed, 'easeInOutCubic', function() {
330						$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
331						UNCODE.scrolling = false;
332						if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) {
333							calc_scroll = pageHeaderTop + pageHeaderHeight;
334							getOffset = UNCODE.get_scroll_offset(event);
335							calc_scroll -= getOffset;
336								$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
337									$(this).stop();
338								}).animate({
339									scrollTop: calc_scroll
340								}, scrollSpeed, 'easeInOutCubic', function() {
341									$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
342									UNCODE.scrolling = false;
343								}
344							);
345						}
346					}
347				);
348			}
349		});
350	}
351
352	// Colomun hover effect
353	// =================
354	$(document).on('mouseenter', '.col-link', function(e) {
355		var uncol = $(e.target).prev('.uncol'),
356		el = uncol.find('.column-background');
357		if (el) {
358			$('.btn-container .btn', uncol).toggleClass('active');
359			var elOverlay = $(el[0]).find('.block-bg-overlay');
360			if (elOverlay.length) {
361				var getOpacity = $(elOverlay).css('opacity');
362				if (getOpacity != 1) {
363					getOpacity = Math.round(getOpacity * 100) / 100;
364					var newOpacity = getOpacity + .1;
365					$(elOverlay).data('data-opacity', getOpacity);
366					$(elOverlay).css('opacity', newOpacity);
367				}
368			}
369		}
370	}).on('mouseleave', '.col-link', function(e) {
371		var uncol = $(e.target).prev('.uncol'),
372		el = uncol.find('.column-background');
373		$('.btn-container .btn', uncol).toggleClass('active');
374		if (el) {
375			var elOverlay = $(el[0]).find('.block-bg-overlay');
376			if (elOverlay.length) {
377				var getOpacity = $(elOverlay).data('data-opacity');
378				$(elOverlay).css('opacity', getOpacity);
379			}
380		}
381	});
382
383	// Admin bar
384	// ============
385	var fixAdminBar = function() {
386		if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) {
387			var getAdminBar = $('#wpadminbar');
388			if (getAdminBar.length) {
389				if (getAdminBar.css('position') !== 'hidden') {
390					var getAdminBarHeight = getAdminBar.height();
391					if (getAdminBar.css('position') === 'fixed') {
392						$('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'});
393						$('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'});
394					} else {
395						$('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'});
396						$('.body-borders .top-border').css({'margin-top':'0px'});
397					}
398				}
399			}
400		}
401	};
402	window.addEventListener('load', fixAdminBar);
403	window.addEventListener('resize', fixAdminBar);
404	// Print
405	// ===========
406	var beforePrint = function() {
407		window.dispatchEvent(new CustomEvent('resize'));
408		window.dispatchEvent(UNCODE.boxEvent);
409	};
410
411	if (window.matchMedia) {
412		var mediaQueryList = window.matchMedia('print');
413		mediaQueryList.addListener(function(mql) {
414			if (mql.matches) {
415				beforePrint();
416			}
417		});
418	}
419
420	window.onbeforeprint = beforePrint;
421
422	// Safari srcset
423	var safariSrcSet = function(){
424		if ( !SiteParameters.is_frontend_editor ) {
425			$('html.safari img[sizes]').each(function(){
426				var $img = $(this),
427					sizeImg = parseInt($img.attr('sizes'));
428				if ( typeof(sizeImg) === 'number' ) {
429					$img.attr('sizes', (sizeImg) + 'px');
430				}
431			});
432		}
433	};
434	window.addEventListener('load', safariSrcSet);
435}
436
437UNCODE.lettering = function() {
438
439	var setCTA;
440	var highlightStill = function(){
441
442		var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)');
443
444		$.each($heading_texts, function(key, el) {
445			var $heading = $(el);
446
447			if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) {
448				return;
449			}
450
451			if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) {
452				return;
453			}
454
455			var waypoint = new Waypoint({
456				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
457				element: el,
458				handler: function() {
459					var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element),
460						anims_l = $anims.length;
461					$anims.each(function(_key_, _el_){
462						var $anim = $(_el_);
463
464						if ( ! $anim.hasClass('heading-text-highlight-animated') ) {
465							$anim.addClass('heading-text-highlight-animated');
466
467							if ( $heading.data('animate') === true ) {
468								$anim.css({
469									'-webkit-transition-duration': '0ms',
470									'-moz-transition-duration': '0ms',
471									'-o-transition-duration': '0ms',
472									'transition-duration': '0ms',
473								});
474							} else {
475								$anim.css({
476									'-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms',
477									'-moz-transition-delay': ((_key_ + 2) * 200) + 'ms',
478									'-o-transition-delay': ((_key_ + 2) * 200) + 'ms',
479									'transition-delay': ((_key_ + 2) * 200) + 'ms',
480								});
481							}
482						}
483
484					});
485					$anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) {
486						$heading.data('animate', true);
487					});
488					$anims.removeAttr('data-animated');
489				},
490				offset: '100%'
491			});
492
493		});
494
495		Waypoint.refreshAll();
496		$( document.body ).trigger('uncode_waypoints');
497
498	}
499
500	requestTimeout(function(){
501		highlightStill();
502		$(window).on( 'resize', function(){
503			clearRequestTimeout(setCTA);
504			setCTA = requestTimeout( highlightStill, 100 );
505		});
506	}, 400);
507
508};
509
510UNCODE.isUnmodalOpen = false;
511
512var manageVideoSize = function(){
513
514	var setVideoFit;
515	$('.wp-block-embed').each(function(){
516
517		var $this = $(this);
518
519		if ( $('iframe', $this).length ) {
520
521			var $iframe = $('> iframe, > a > iframe', $this),
522				w = parseFloat($iframe.attr('width')),
523				h = parseFloat($iframe.attr('height')),
524				url = $iframe.attr('src'),
525				ratio, frW;
526
527			if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0  ) {
528
529				ratio = h / w;
530				var setResizeiFto,
531					resizeiFrame = function(){
532					frW = $iframe.width();
533					$iframe.css({
534						height: frW * ratio
535					});
536				};
537				resizeiFrame();
538				$(window).on( 'resize load', function(){
539					clearRequestTimeout(setResizeiFto);
540					setResizeiFto = requestTimeout( function() {
541						resizeiFrame();
542					}, 10 );
543				});
544
545			}
546
547		}
548
549	});
550
551};
552
553manageVideoSize();
554
555UNCODE.vivus = function(icon, time, delay, file) {
556	if (typeof Vivus !== 'undefined') {
557		var icon_options = {
558			type: 'delayed',
559			pathTimingFunction: Vivus.EASE_OUT,
560			animTimingFunction: Vivus.LINEAR,
561			duration: time,
562		}
563
564		if (delay) {
565			icon_options.delayStart = delay;
566		}
567
568		if (file) {
569			icon_options.file = file;
570		}
571
572		new Vivus(icon, icon_options);
573	}
574};
575
576UNCODE.lastURL = '';
577
578UNCODE.getURLParams = function(current_location, is_string) {
579	var params = {};
580	if (is_string) {
581		var url = current_location.split('?')[1];
582	} else {
583		var url = current_location.search;
584		url = url.substring(1);
585	}
586	if (url) {
587		var parts = url.split('&');
588		for (var i = 0; i < parts.length; i++) {
589			var nv = parts[i].split('=');
590			if (!nv[0]) {
591				continue;
592			}
593			params[nv[0]] = nv[1] || true;
594		}
595	}
596	return params;
597}
598
599UNCODE.hasEqualURLParams = function(obj1, obj2) {
600	for (var i in obj1) {
601		if (obj1.hasOwnProperty(i)) {
602			if (!obj2.hasOwnProperty(i)) {
603				return false;
604			}
605			if (obj1[i] != obj2[i]) {
606				return false;
607			}
608		}
609	}
610	for (var i in obj2) {
611		if (obj2.hasOwnProperty(i)) {
612			if (!obj1.hasOwnProperty(i)) {
613				return false;
614			}
615			if (obj1[i] != obj2[i]) {
616				return false;
617			}
618		}
619	}
620    return true;
621}
622
623UNCODE.changeSkinOnScroll = function(){
624	if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) {
625		return;
626	}
627	var $masthead = $('#masthead'),
628		transDesktop,
629		transMobile,
630		changeSkin,
631
632	checkTransparencyAndChange = function( $col ){
633		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
634		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
635		changeSkin = $masthead.hasClass('menu-change-skin');
636
637		if ( ! transDesktop && ! transMobile ) {
638			return false;
639		}
640
641		if ( ! changeSkin ) {
642			return false;
643		}
644
645		if ( $col.hasClass('style-light') ){
646			$masthead.removeClass('style-dark-override').addClass('style-light-override');
647			return false;
648		} else if ( $col.hasClass('style-dark') ) {
649			$masthead.removeClass('style-light-override').addClass('style-dark-override');
650			return false;
651		}
652	};
653
654	var prev_row = 'normal',
655		odd = true,
656		$rows = $('.vc_row[data-parent]:visible');
657	$.each($rows, function(index, row){
658		var $row = $(row),
659			$col = $('.uncol', $row).first(),
660			$slider = $('.uncode-slider', $row);
661
662		var wayDown = new Waypoint({
663			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
664			element: row,
665			handler: function(direction) {
666				if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
667					if ( $slider.length ) {
668						$col = $('.owl-item.index-active .uncol', $slider).first();
669					}
670					checkTransparencyAndChange($col);
671				}
672				if ( odd === false ) {
673					if ( row.hasAttribute('data-bg-changer') ) {
674						prev_row = 'bg-changer';
675					} else {
676						prev_row = 'normal';
677					}
678					odd = true;
679				} else {
680					odd = false;
681				}
682			},
683			offset: function() {
684				return UNCODE.menuHeight / 2
685			}
686		});
687		var wayUp = new Waypoint({
688			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
689			element: row,
690			handler: function(direction) {
691				if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
692					if ( $slider.length ) {
693						$col = $('.owl-item.index-active .uncol', $slider).first();
694					}
695					checkTransparencyAndChange($col);
696				}
697				if ( odd === false ) {
698					if ( row.hasAttribute('data-bg-changer') ) {
699						prev_row = 'bg-changer';
700					} else {
701						prev_row = 'normal';
702					}
703					odd = true;
704				} else {
705					odd = false;
706				}
707			},
708			offset: function() {
709				return -row.clientHeight + ( UNCODE.menuHeight / 2 )
710			}
711		});
712	});
713
714};
715
716UNCODE.share = function() {
717	if (typeof Share !== 'undefined') {
718		var share_button_element = $('.share-button');
719		var share_button_url = share_button_element.data('url');
720
721		var share_button_config = {
722			ui: {
723				flyout: "top center",
724				button_font: false,
725				button_text: '',
726				icon_font: false
727			}
728		};
729
730		if (share_button_url) {
731			share_button_config.url = share_button_url.replace("&", "%26");
732		}
733
734		var share_button_top = new Share('.share-button', share_button_config);
735	}
736};
737
738UNCODE.tooltip = function() {
739	if (typeof jQuery.fn.tooltip !== 'undefined') {
740		$('.btn-tooltip').tooltip();
741	}
742};
743
744UNCODE.counters = function() {
745	var $counters = $('.uncode-counter:not(.counter-init)');
746	$counters.each(function(){
747		var $counter = $(this).addClass('counter-init');
748		if ( SiteParameters.is_frontend_editor ) {
749			$counter.addClass('started');
750		}
751		if ( $counter.closest( '.owl-carousel' ).length ) {
752			return;
753		}
754		$counter.addClass('started').counterUp({
755			delay: 10,
756			time: 1500
757		});
758	});
759};
760
761UNCODE.countdowns = function() {
762	var $countdowns = $('[data-uncode-countdown]:not(.counter-init)');
763	$countdowns.each(function() {
764		var $this = $(this).addClass('counter-init'),
765			finalDate = $(this).data('uncode-countdown');
766		$this.countdown(finalDate, function(event) {
767			$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>'));
768		});
769	});
770};
771
772UNCODE.tabs = function() {
773
774	var tabSwitcher = function($el){
775		$('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vertical):not(.tab-switch)', $el).each(function(key, value){
776			var $navs = $(value),
777				$active = $('li.active', $navs),
778				$active_a = $('> a', $active),
779				$active_span = $('> span', $active_a),
780				vertical = $navs.closest('.vertical-tab-menu').length;
781			
782			if ( ! $('.switcher-cursor', $navs).length && ! vertical ) {
783				$navs.append('<span class="switcher-cursor" />');
784			}
785
786			var $cursor = $('.switcher-cursor', $navs),
787				active_w = $('a', $active).outerWidth(),
788				span_w = $active_span.outerWidth(),
789				active_pos = $active.position(),
790				active_a_pos = $active_a.position(),
791				span_pos = $active_span.position(),
792				cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w,
793				cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left;
794
795			cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10);
796
797			if ( ! vertical ) {
798				$cursor.css({
799					left: cursor_left,
800					width: cursor_w
801				});
802			}
803
804			$navs.addClass('switch-init');
805		});
806	};
807
808	var $body = $('body');
809	tabSwitcher($body);
810
811	var tabHoverIntent = function(){
812		var setHover;
813		$('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]')
814			.on('mouseover', function(e){
815				var $this = $(e.target);
816				setHover = requestTimeout(function() {
817					$this.trigger('hover-int');
818				}, 50);
819			})
820			.on('mouseout', function(){
821				clearRequestTimeout(setHover);
822			});
823	};
824	tabHoverIntent();
825
826	var tabInit = function(){
827		$('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) {
828			e.preventDefault()
829			var $el = $(this);
830			$el.tab('show');
831			var $container = $el.closest('.uncode-tabs');
832			tabSwitcher($container);
833			requestTimeout(function() {
834				window.dispatchEvent(UNCODE.boxEvent);
835				var $tabs = $(e.currentTarget).closest('.uncode-tabs');
836
837				if ( $tabs.hasClass('tabs-trigger-box-resized') ) {
838				window.dispatchEvent(new CustomEvent('boxResized'));
839				} else if ( $tabs.hasClass('tabs-trigger-window-resize') ) {
840					window.dispatchEvent(new Event('resize'));
841					$(window).trigger('uncode.re-layout');
842				} 
843
844				var $active_panel = $('.tab-pane.active', $tabs);
845
846				$.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) {
847					var element = $(val),
848						delayAttr = element.attr('data-delay');
849					if (delayAttr == undefined) delayAttr = 0;
850					requestTimeout(function() {
851						element.addClass('start_animation');
852					}, delayAttr);
853				});
854
855			}, 300);
856
857			var $li = $el.closest('li'),
858				mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
859			$('li', $container).not($li).find('.tab-pane').slideUp(250)
860			$('.tab-pane', $li).slideDown(250);
861			var completeSlideDown = requestTimeout(function(){
862				if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) {
863					var pos = $el.offset(),
864						rect = $el[0].getBoundingClientRect(),
865						$masthead = $('#masthead > .menu-container'),
866						considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0;
867
868					if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) {
869						$('html, body').animate({
870							scrollTop: ( pos.top ) - considerMenu
871						},{
872							easing: 'easeInOutQuad',
873							duration: 250
874						});
875					}
876				}
877			}, 260);
878		});
879	}
880	tabInit();
881
882	var tabResponsive = function(){
883		if ( SiteParameters.is_frontend_editor ) {
884			return true;
885		}
886		var $tabContainers = $('.tab-container.tabs-breakpoint');
887		$tabContainers.each(function(){
888			var $tabContainer = $(this),
889				$tabContent = $('.tab-content', $tabContainer),
890				$nav = $('.nav-tabs', $tabContainer),
891				mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
892
893			$('> li', $nav).each(function(){
894				var $li = $(this),
895					dataID = $li.attr('data-tab-id');
896
897				if ( UNCODE.wwidth <= mQuery ) {
898					if ( ! $('.tab-pane', $li ).length ) {
899						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent);
900						$tabContainer.addClass('tabs-appended');
901						$li.append($append_pane);
902					}
903
904					if ( $li.hasClass('active') ) {
905						$('> a', $li).click();
906					}
907				} else {
908					if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) {
909						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav);
910						$tabContainer.removeClass('tabs-appended');
911						$tabContent.prepend($append_pane.removeAttr('style'));
912					}
913				}
914			});
915		});
916
917	}
918	tabResponsive();
919
920	$(window).on('wwResize', function(){
921		tabHoverIntent();
922		tabSwitcher($body);
923	});
924
925	var setCTA;
926	$(window).on( 'resize', function(){
927		clearRequestTimeout(setCTA);
928		setCTA = requestTimeout( tabResponsive, 100 );
929	});
930
931	$('.nav-tabs').each(function(){
932		var $nav = $(this),
933			$lis = $('> li:not(.active)', $nav),
934			$links = $('.tab-excerpt-link', $nav);
935		$('.tab-excerpt', $lis).slideUp(400, function(){
936			$(this).addClass('init');
937		});
938
939		$links.each(function(){
940			var $link = $(this),
941				$par_a = $link.closest('a'),
942				href = $link.attr('data-href'),
943				target = $link.attr('data-target');
944			$par_a.addClass('inner-link');
945			$link.on('click', function(){
946				var _link = document.createElement('a');
947				_link.href = href;
948				_link.target = typeof target === 'undefined' || target === '' ? '_self' : target;
949				_link.click();
950			});
951		});
952		$nav.addClass('tab-init');
953	});
954
955	$('.uncode-tabs.tabs-no-lazy').each(function(){
956		var $tabs = $(this),
957			$panes = $('.tab-pane:not(.active)', $tabs);
958		$panes.each(function(){
959			var $pane = $(this),
960				$imgs = $('img[loading="lazy"]', $pane);
961			$imgs.removeAttr('loading');
962			$imgs.removeAttr('decoding');
963		});
964	});
965
966};
967UNCODE.collapse = function() {
968	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
969		var $this = $(this),
970			href
971		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
972		var $target = $(target)
973		var parent = $this.attr('data-parent')
974		var $parent = parent && $(parent)
975		var $title = $(this).parent()
976		var $accordion = $(e.target).closest('.uncode-accordion')
977		var $group = $this.closest('.group')
978		var $panel_group = $this.closest('.panel-group')
979		if ($parent) {
980			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
981			if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) {
982				$title.removeClass('active');
983				$group.removeClass('active-group');
984			} else {
985				if ( $panel_group.attr('data-no-toggle') != true ) {
986					$parent.find('.panel-title').removeClass('active')
987					$parent.find('.group').removeClass('active-group')
988				}
989				$title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active')
990				$group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group')
991			}
992		}
993		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
994		requestTimeout(function() {
995			var $accordion = $(e.target).closest('.uncode-accordion');
996			if ( $accordion.hasClass('tabs-trigger-box-resized') ) {
997			  window.dispatchEvent(new CustomEvent('boxResized'));
998			} else if ( $accordion.hasClass('tabs-trigger-window-resize') ) {
999				window.dispatchEvent(new Event('resize'));
1000				$(window).trigger('uncode.re-layout');
1001			} 
1002
1003			var $active_panel = $('.panel.active-group', $parent);
1004
1005			$.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) {
1006				var element = $(val),
1007					delayAttr = element.attr('data-delay');
1008				if (delayAttr == undefined) delayAttr = 0;
1009				requestTimeout(function() {
1010					element.addClass('start_animation');
1011				}, delayAttr);
1012			});
1013
1014		}, 500);
1015	});
1016
1017	$('.uncode-accordion.tabs-no-lazy').each(function(){
1018		var $accordion = $(this),
1019			$panes = $('.panel:not(.active-group)', $accordion);
1020		$panes.each(function(){
1021			var $pane = $(this),
1022				$imgs = $('img[loading="lazy"]', $pane);
1023			$imgs.removeAttr('loading');
1024			$imgs.removeAttr('decoding');
1025		});
1026	});
1027};
1028
1029UNCODE.bigText = function(el) {
1030	if (el == undefined) {
1031		el = $('body');
1032	}
1033	$.each($('.bigtext', el), function(index, val) {
1034		$(val).bigtext({
1035			minfontsize: 24
1036		});
1037		if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
1038			opacity: 1
1039		});
1040		requestTimeout(function() {
1041			if ($(val).find('.animate_when_almost_visible').length != 0) {
1042				$(val).css({opacity: 1});
1043			}
1044		}, 400);
1045	});
1046};
1047
1048UNCODE.process_shortpixel_image = function(image) {
1049	var data = {
1050		action: 'shortpixel_manual_optimization',
1051		image_id: image,
1052		cleanup: true
1053	};
1054
1055	$.get(SiteParameters.ajax_url, data);
1056};
1057
1058UNCODE.menuSystem = function() {
1059
1060	function menuMobile() {
1061		var $body = $('body'),
1062			scrolltop,
1063			$mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile'),
1064			$masthead = $('#masthead'),
1065			$box,
1066			$el,
1067			$el_transp,
1068			elHeight,
1069			offCanvasAnim,
1070			check,
1071			animating = false,
1072			stickyMobile = false,
1073			menuClose = new CustomEvent('menuMobileClose'),
1074			menuOpen = new CustomEvent('menuMobileOpen');
1075		UNCODE.menuOpened = false;
1076		$mobileToggleButton.on('click', function(event) {
1077			event.stopPropagation();
1078			var btn = this;
1079			if ($(btn).hasClass('overlay-close')) return;
1080			event.preventDefault();
1081			$('.overlay-search.open .menu-close-dd', $masthead).trigger('click');
1082			if (UNCODE.wwidth <= UNCODE.mediaQuery) {
1083				$box = $(this).closest('.box-container').find('.main-menu-container');
1084				$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner');
1085				$el_transp = $('.menu-absolute.menu-transparent');
1086				if (UNCODE.isMobile) {
1087					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 ) {
1088						stickyMobile = true;
1089						elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
1090					} else {
1091						elHeight = 0;
1092						$.each($box.find('> div'), function(index, val) {
1093							elHeight += $(val).outerHeight();
1094						});
1095					}
1096				} else {
1097					elHeight = 0;
1098					$.each($el, function(index, val) {
1099						elHeight += $(val).outerHeight();
1100					});
1101				}
1102				var open = function() {
1103					clearTimeout(offCanvasAnim);
1104					if (!animating) {
1105						$body.addClass('open-overlay-menu').addClass('opening-overlay-menu');
1106						scrolltop = $(window).scrollTop();
1107						window.dispatchEvent(menuOpen);
1108						animating = true;
1109						UNCODE.menuOpened = true;
1110						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) {
1111							if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) {
1112								$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1113							}
1114							if ($('body.menu-offcanvas').length) {
1115								$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1116								$('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1117							} else {
1118								if ( $('.menu-hide, .menu-sticky').length ) {
1119									if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length  ) {
1120										$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1121									}
1122								}
1123							}
1124						}
1125						if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) {
1126							//$("#masthead")[0].scrollIntoView();
1127							$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1128						}
1129						$box.addClass('open-items');
1130						if ($el_transp.length && $('body.menu-mobile-transparent').length) {
1131							$el_transp.addClass('is_mobile_open');
1132						}
1133						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1134							btn.classList.add('close');
1135							$box.animate({
1136								height: elHeight
1137							}, 600, "easeInOutCirc", function() {
1138								animating = false;
1139								if (!stickyMobile) $box.css('height', 'auto');
1140							});
1141						} else {
1142							animating = false;
1143						}
1144					}
1145				};
1146
1147				var close = function() {
1148					clearTimeout(offCanvasAnim);
1149					if (!animating) {
1150						window.dispatchEvent(menuClose);
1151						animating = true;
1152						UNCODE.menuOpened = false;
1153						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1154							btn.classList.remove('close');
1155							btn.classList.add('closing');
1156						}
1157						$box.addClass('close');
1158						requestTimeout(function() {
1159							$box.removeClass('close');
1160							$box.removeClass('open-items');
1161							btn.classList.remove('closing');
1162							if ($el_transp.length) {
1163								$el_transp.removeClass('is_mobile_open');
1164							}
1165						}, 500);
1166						$body.removeClass('opening-overlay-menu');
1167						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1168							$box.animate({
1169								height: 0
1170							}, {
1171								duration: 600,
1172								easing: "easeInOutCirc",
1173								complete: function(elements) {
1174									$(elements).css('height', '');
1175									animating = false;
1176									if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) {
1177										$('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative');
1178									}
1179									$body.removeClass('open-overlay-menu');
1180								}
1181							});
1182						} else {
1183							animating = false;
1184							offCanvasAnim = setTimeout(function(){
1185								$body.removeClass('open-overlay-menu');
1186							}, 1000);
1187						}
1188					}
1189				};
1190				check = (!UNCODE.menuOpened) ? open() : close();
1191			}
1192		});
1193
1194		$('html').on('click', function(event){
1195			if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) {
1196				$('.uncode-close-offcanvas-mobile').trigger('click');
1197			}
1198		});
1199
1200		window.addEventListener('menuMobileTrigged', function(e) {
1201			$('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click');
1202		});
1203		window.addEventListener('orientationchange', function(e) {
1204			$('#logo-container-mobile .mobile-menu-button.close').trigger('click');
1205		});
1206		window.addEventListener("resize", function() {
1207			if ($(window).width() < UNCODE.mediaQuery) {
1208				if (UNCODE.isMobile) {
1209					var $box = $('.box-container .main-menu-container'),
1210						$el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner');
1211					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) {
1212						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
1213							elHeight = 0;
1214							$.each($el, function(index, val) {
1215								elHeight += $(val).outerHeight();
1216							});
1217							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;
1218							$($box).css('height', elHeight + 'px');
1219						}
1220					}
1221				}
1222			} else {
1223				$('.menu-hide-vertical').removeAttr('style');
1224				$('.menu-container-mobile').removeAttr('style');
1225				$('.vmenu-container.menu-container').removeAttr('style');
1226			}
1227		});
1228
1229		$(window).on('scroll', function(){
1230			if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) {
1231				$(window).scrollTop(scrolltop);
1232				return false;
1233			}
1234		});
1235
1236	};
1237
1238	function menuOffCanvas() {
1239		var menuClose = new CustomEvent('menuCanvasClose'),
1240			menuOpen = new CustomEvent('menuCanvasOpen');
1241		$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) {
1242			if ($(window).width() > UNCODE.mediaQuery) {
1243				if ( $('body.vmenu-offcanvas-overlay').length ) {
1244					if ($(event.currentTarget).hasClass('off-close')) {
1245						$(event.currentTarget).removeClass('off-close');
1246						requestTimeout(function() {
1247							window.dispatchEvent(menuClose);
1248						}, 500);
1249
1250					} else {
1251						$(event.currentTarget).addClass('off-close');
1252						window.dispatchEvent(menuOpen);
1253					}
1254				} else {
1255					if ($(event.currentTarget).hasClass('close')) {
1256						$(event.currentTarget).removeClass('close');
1257						$(event.currentTarget).addClass('closing');
1258						requestTimeout(function() {
1259							$(event.currentTarget).removeClass('closing');
1260							window.dispatchEvent(menuClose);
1261						}, 500);
1262
1263					} else {
1264						$(event.currentTarget).addClass('close');
1265						window.dispatchEvent(menuOpen);
1266					}
1267				}
1268			}
1269
1270			$('body').toggleClass('off-opened');
1271		});
1272
1273		$('body').off('click.menu-off-canvas-mobile').on('click.menu-off-canvas-mobile', function(e){
1274			if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) {
1275				var $vMenuCont = $('#masthead .vmenu-container'),
1276					$close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont),
1277
1278					vmenu_h = parseFloat( $vMenuCont.outerHeight() ),
1279					vmenu_w = parseFloat( $vMenuCont.outerWidth() ),
1280					vmenu_off = $vMenuCont.offset(),
1281					vmenu_l = parseFloat(vmenu_off.left),
1282					vmenu_t = parseFloat(vmenu_off.top),
1283					vmenu_r = vmenu_l + vmenu_w,
1284					vmenu_b = vmenu_t + vmenu_h,
1285
1286					close_h = parseFloat( $close_menu.outerHeight() ),
1287					close_w = parseFloat( $close_menu.outerWidth() ),
1288					close_off = $close_menu.offset(),
1289					close_l = parseFloat(close_off.left),
1290					close_t = parseFloat(close_off.top),
1291					close_r = close_l + close_w,
1292					close_b = close_t + close_h;
1293				if (
1294					!(
1295						e.clientX > vmenu_l &&
1296						e.clientX < vmenu_r &&
1297						e.clientY > vmenu_t &&
1298						e.clientY < vmenu_b
1299					)
1300					||
1301					(
1302						e.clientX > close_l &&
1303						e.clientX < close_r &&
1304						e.clientY > close_t &&
1305						e.clientY < close_b
1306					)
1307				) {
1308					$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click');
1309				}
1310			}
1311		});
1312	};
1313
1314	function menuOverlay() {
1315		if ( $('.overlay').length ) {
1316			$('.overlay').removeClass('hidden');
1317		}
1318		if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) {
1319			$('.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) {
1320				var transDelay = (index / 20) + 0.1;
1321				if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery )
1322					transDelay = transDelay + 0.3;
1323				$(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');
1324			});
1325		}
1326
1327	};
1328	var $secondary_parent;
1329	function menuAppend() {
1330		var $body = $('body'),
1331			$menuCont = $('.menu-container:not(.vmenu-container)'),
1332			$vMenuCont = $('.menu-container.vmenu-container'),
1333			$cta = $('.navbar-cta'),
1334			$socials = $('.navbar-social:not(.appended-navbar)'),
1335			$ul = $('.navbar-main ul.menu-primary-inner'),
1336			$ulCta,
1337			$ulSocials,
1338			$navLast,
1339			$firstMenu = $('.main-menu-container:first-child', $menuCont),
1340			$secondMenu = $('.main-menu-container:last-child', $menuCont),
1341			$firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu),
1342			$secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu),
1343			$ulFirst = $('> ul', $firstNav),
1344			$ulSecond = $('> ul', $secondNav),
1345			setCTA,
1346			appendCTA = function(){
1347				return true;
1348			},
1349			appendSocials = function(){
1350				return true;
1351			},
1352			appendSplit = function(){
1353				return true;
1354			};
1355
1356		if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) {
1357			$ulCta = $('> ul', $cta);
1358			$ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden');
1359
1360			appendCTA = function(){
1361				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1362
1363					$ul.after($ulCta);
1364				} else {
1365					$cta.append($ulCta);
1366				}
1367			}
1368		}
1369
1370		if ( ! $body.hasClass('cta-not-appended') ) {
1371			appendCTA();
1372		}
1373
1374		var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social');
1375		$smartSocial.each(function(){
1376			var $_smartSocial = $(this);
1377			$('> li', $_smartSocial).each(function(){
1378				var $li = $(this);
1379				if ( $li.hasClass('mobile-hidden') ) {
1380					$_smartSocial.addClass('mobile-hidden');
1381				} else {
1382					$_smartSocial.removeClass('mobile-hidden');
1383					return false;
1384				}
1385			});
1386
1387			$('> li', $_smartSocial).each(function(){
1388				var $li = $(this);
1389				if ( $li.hasClass('tablet-hidden') ) {
1390					$_smartSocial.addClass('tablet-hidden');
1391				} else {
1392					$_smartSocial.removeClass('tablet-hidden');
1393					return false;
1394				}
1395			});
1396		});
1397
1398		if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) {
1399			$ulSocials = $('> ul', $socials).addClass('menu-smart-social');
1400			if ( $body.hasClass('hmenu-center-split') ) {
1401				$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1402			} else {
1403				$navLast = $('.navbar-nav-last', $vMenuCont);
1404			}
1405
1406			if ( ! $navLast.length ) {
1407				var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />');
1408				if ( $body.hasClass('hmenu-center-split') ) {
1409					$('.menu-horizontal-inner', $menuCont).append(_navLast);
1410					$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1411				} else {
1412					$('.menu-sidebar-inner', $vMenuCont).last().append(_navLast);
1413					$navLast = $('.navbar-nav-last', $vMenuCont);
1414				}
1415			}
1416
1417			appendSocials = function(){
1418				if ( !$body.hasClass('menu-overlay-center') ) {
1419				// 	if ( !$navLast.find('ul.menu-smart-social').length ) {
1420				// 		$ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont);
1421				// 		$navLast.append('<ul class="menu-smart menu-smart-social" />');
1422				// 		$ulSocials.each(function(){
1423				// 			var $li_social = $(this);
1424				// 			$navLast.find('ul.menu-smart-social').append($li_social);
1425				// 		});
1426				// 	}
1427				// } else {
1428					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1429						$socials.addClass('mobile-hidden').addClass('tablet-hidden')
1430						if ( ! $('> ul.menu-smart-social li', $socials).length ) {
1431							$('> ul.menu-smart-social li', $socials).remove();
1432						}
1433						$navLast.append($ulSocials);
1434					} else {
1435						if ( ! $('> ul.menu-smart-social li', $navLast).length ) {
1436							$('> ul.menu-smart-social li', $navLast).remove();
1437						}
1438						$socials.append($ulSocials);
1439					}
1440				}
1441			}
1442			appendSocials();
1443		}
1444
1445		if ( $vMenuCont.length ) {
1446			var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont);
1447		} else {
1448			var $accordion_secondary = $('.menu-accordion-secondary', $menuCont);
1449		}
1450		if ( $accordion_secondary.length ) {
1451			var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph');
1452			if (UNCODE.wwidth < UNCODE.mediaQuery) {
1453				if ( !$accordion_secondary_ph.length ) {
1454					$accordion_secondary.after('<span class="accordion-secondary-ph" />');
1455				}
1456				if ( $vMenuCont.length ) {
1457					$('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary);
1458				} else {
1459					if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1460						$('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary);
1461					} else {
1462						$('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary);
1463					}
1464				}
1465			} else {
1466				if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) {
1467					$accordion_secondary_ph.before($accordion_secondary);
1468				}
1469			}
1470		}
1471
1472		if ( $vMenuCont.length ) {
1473			var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont);
1474		} else {
1475			var $extra_icons = $('.navbar-extra-icons', $menuCont);
1476		}
1477
1478		if ( $extra_icons.length ) {
1479			if ( $vMenuCont.length ) {
1480				if ( $('li:not(.social-icon)', $extra_icons).length ) {
1481					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1482						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1483							$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1484						$not_social.each(function(){
1485							if ( ! $primary_after.length ) {
1486								$('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />');
1487								$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1488								$primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />');
1489							}
1490							var $extra_li = $(this);
1491							$primary_after.find('> ul').append($extra_li);
1492						});
1493					} else {
1494						var $primary_after = $('.menu-accordion-primary-after', $vMenuCont),
1495							$not_social = $('> ul > li:not(.social-icon)', $primary_after);
1496						$not_social.each(function(){
1497							var $extra_li = $(this);
1498							$extra_icons.find('> ul').append($extra_li);
1499						});
1500					}
1501				} /*else {
1502					var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph');
1503					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1504						if ( !$extra_icons_ph.length ) {
1505							$extra_icons.after('<span class="extra-icons-ph" />');
1506						}
1507						if ( $('.navbar-accordion-cta', $vMenuCont).length ) {
1508							$('.navbar-accordion-cta', $vMenuCont).after($extra_icons);
1509						} else {
1510							$('.menu-accordion-primary', $vMenuCont).after($extra_icons);
1511						}
1512					} else {
1513						if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) {
1514							$extra_icons_ph.before($extra_icons);
1515						}
1516					}
1517				}*/
1518			} else {
1519				if ( ! $body.hasClass('hmenu-center-double') ) {
1520					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1521						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1522							$primary_after = $('.nav.navbar-main-after', $menuCont);
1523
1524						if ( ! $primary_after.length && $not_social.length ) {
1525							if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1526								$('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />');
1527							} else {
1528								$('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />');
1529							}
1530							$primary_after = $('.nav.navbar-main-after', $menuCont);
1531							$primary_after.append('<ul class="menu-smart sm menu-smart-social" />');
1532						}
1533						var tablet_hidden = true,
1534							mobile_hidden = true;
1535						$not_social.each(function(){
1536							var $extra_li = $(this);
1537							$primary_after.find('> ul').append($extra_li);
1538							if ( ! $extra_li.hasClass('tablet-hidden') ) {
1539								tablet_hidden = false;
1540							}
1541							if ( ! $extra_li.hasClass('mobile-hidden') ) {
1542								mobile_hidden = false;
1543							}
1544						});
1545						if ( tablet_hidden === true && $not_social.length ) {
1546							$primary_after.addClass('tablet-hidden');
1547						}
1548						if ( mobile_hidden === true && $not_social.length ) {
1549							$primary_after.addClass('mobile-hidden');
1550						}
1551					} else {
1552						var $primary_after = $('.nav.navbar-main-after', $menuCont);
1553
1554						if ( $primary_after.length ) {
1555							var $not_social = $('> ul > li:not(.social-icon)', $primary_after);
1556							$not_social.each(function(){
1557								var $extra_li = $(this);
1558								$extra_icons.find('> ul').append($extra_li);
1559							});
1560							$primary_after.remove();
1561						}
1562					}
1563				}
1564			}
1565		}
1566
1567		if ( ( $body.hasClass('hmenu-center-double') ) ) {
1568			appendSplit = function(){
1569				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1570					if ( $extra_icons.length ) {
1571						if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) {
1572							var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1573								$append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />');
1574							$not_social.each(function(){
1575								var $extra_li = $(this);
1576								$append_ul.append($extra_li);
1577							});
1578							if ( $secondNav.length ) {
1579								$secondNav.append($append_ul);
1580							} else {
1581								$('.menu-horizontal-inner', $menuCont).prepend($append_ul);
1582							}
1583						}
1584					}
1585					if ( $secondNav.length ) {
1586						$secondNav.prepend($ulFirst);
1587					} else {
1588						$('.menu-horizontal-inner', $menuCont).prepend($ulFirst);
1589					}
1590					$firstMenu.hide();
1591				} else {
1592					$firstNav.append($ulFirst);
1593					var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0);
1594					if ( $append_ul.length ) {
1595						var $not_social = $('> li:not(.social-icon)', $append_ul);
1596						$not_social.each(function(){
1597							var $extra_li = $(this);
1598							$extra_icons.find('> ul').append($extra_li);
1599						});
1600					}
1601					$('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove();
1602					$('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove();
1603					$firstMenu.css({
1604						'display': 'table-cell'
1605					});
1606				}
1607			}
1608		}
1609		appendSplit();
1610
1611		$(window).on( 'resize', function(){
1612			clearRequestTimeout(setCTA);
1613			setCTA = requestTimeout( function() {
1614				appendCTA();
1615				appendSocials();
1616				appendSplit();
1617			}, 10 );
1618		});
1619	}
1620	//menuMobileButton();
1621	menuMobile();
1622	menuOffCanvas();
1623	menuAppend();
1624	menuOverlay();
1625
1626	var stickyDropdownSearch = function(){
1627		var $masthead = $('#masthead'),
1628			$ddSearch = $('.overlay.overlay-search', $masthead),
1629			$styles = $('#stickyDropdownSearch').remove();
1630		if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) {
1631			var $menuWrapper = $('.menu-wrapper'),
1632				$navbar = $('.menu-container-mobile', $menuWrapper),
1633				navbarH = $navbar.outerHeight(),
1634				//$topbar = $('.top-menu', $menuWrapper),
1635				//topbarH = $topbar.outerHeight(),
1636				_css;
1637
1638			_css = '<style id="stickyDropdownSearch">';
1639			_css += '@media (max-width: 959px) {';
1640			_css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {';
1641			_css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;';
1642			_css += '}';
1643			_css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {';
1644			_css += 'position: fixed;';
1645			_css += 'top: 0;';
1646			_css += '}';
1647			_css += '</style>';
1648
1649			$(_css).appendTo($('head'));
1650		}
1651	}
1652	stickyDropdownSearch();
1653
1654	var setMenuOverlay;
1655	$(window).on( 'resize', function(){
1656		if ( $('.overlay').length && $(window).width() > 1024 ) {
1657			$('.overlay').addClass('hidden');
1658		}
1659		clearRequestTimeout(setMenuOverlay);
1660		setMenuOverlay = requestTimeout( function(){
1661			menuOverlay();
1662			menuAppend();
1663			stickyDropdownSearch();
1664		}, 150 );
1665	});
1666	UNCODE.menuSmartInit();
1667};
1668
1669UNCODE.menuSmartInit = function() {
1670	var $menusmart = $('[class*="menu-smart"]'),
1671		$masthead = $('#masthead'),
1672		$hMenu = $('.menu-horizontal-inner', $masthead),
1673		$focus = $('.overlay-menu-focus'),
1674		showTimeout = 50,
1675		hideTimeout = 50,
1676		showTimeoutFunc, hideTimeoutFunc;
1677
1678	$('> li.menu-item-has-children', $menusmart).hover(function(){
1679		$(this).data('hover', true);
1680	}, function(){
1681		$(this).data('hover', false);
1682	});
1683
1684	$('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){
1685		e.preventDefault();
1686	});
1687
1688	if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) {
1689		var $notLis = $('> .nav > ul > li a', $hMenu),
1690			$menuA = $('a', $masthead).not($notLis),
1691			$hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'),
1692			showFuncCond = function() { return true };
1693
1694		if ( $('body').hasClass('focus-megamenu') ) {
1695			$hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner');
1696			showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') };
1697		} else if ( $('body').hasClass('focus-links') ) {
1698			$hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA);
1699		}
1700
1701		$hoverSelector.hover(function(){
1702			clearRequestTimeout(hideTimeoutFunc);
1703			showTimeoutFunc = requestTimeout(function(){
1704				$('body').addClass('navbar-hover');
1705			}, showTimeout*2);
1706		}, function(){
1707			hideTimeoutFunc = requestTimeout(function(){
1708				if ( ! $('.overlay-search.open', $masthead).length ) {
1709					$('body').removeClass('navbar-hover');
1710				}
1711			}, hideTimeout*2);
1712		});
1713	} else {
1714		showFuncCond = function() { return false };
1715	}
1716
1717	if ($menusmart.length > 0) {
1718		$menusmart.smartmenus({
1719			subIndicators: false,
1720			subIndicatorsPos: 'append',
1721			//subMenusMinWidth: '13em',
1722			subIndicatorsText: '',
1723			showTimeout: showTimeout,
1724			hideTimeout: hideTimeout,
1725			scrollStep: 8,
1726			showFunction: function($ul, complete) {
1727				clearRequestTimeout(showTimeoutFunc);
1728				$ul.fadeIn(0, 'linear', function(){
1729					complete();
1730					if ( $ul.hasClass('vc_row') ) {
1731						$ul.css({
1732							'display': 'table'
1733						});
1734					}
1735					if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) {
1736						$('body').addClass('open-megamenu');
1737					}
1738					if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) {
1739						$('body').addClass('navbar-hover');
1740					}
1741				}).addClass('open-animated');
1742			},
1743			hideFunction: function($ul, complete) {
1744				if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') && ! $('.overlay-search.open', $masthead).length ) {
1745					$('body').removeClass('open-megamenu');
1746				}
1747				var fixIE = $('html.ie').length;
1748				if (fixIE) {
1749					var $rowParent = $($ul).closest('.main-menu-container');
1750					$rowParent.height('auto');
1751				}
1752				$ul.fadeOut(0, 'linear', function(){
1753					complete();
1754					$ul.removeClass('open-animated');
1755					if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) {
1756						$('body').removeClass('open-submenu');
1757					}
1758				});
1759			},
1760			collapsibleShowFunction: function($ul, complete) {
1761				$ul.slideDown(400, 'easeInOutCirc', complete);
1762			},
1763			collapsibleHideFunction: function($ul, complete) {
1764				$ul.slideUp(200, 'easeInOutCirc', complete);
1765			},
1766			hideOnClick: SiteParameters.menuHideOnClick,
1767		});
1768
1769		if ( $('body').hasClass('menu-accordion-active') ) {
1770			requestTimeout(function(){
1771				$menusmart.addClass('menu-smart-init');
1772				$menusmart.smartmenus( 'itemActivate', $menusmart.find( '.current-menu-item > a' ).eq( -1 ) );
1773			}, 1000);
1774		}
1775
1776		$(document).on( 'uncode.smartmenu-appended', function(){
1777			requestTimeout(function(){
1778				$menusmart.smartmenus( 'refresh' );
1779			}, 1000);
1780		});
1781	}
1782
1783	$('.main-menu-container').each(function(){
1784		var $main_cont = $(this),
1785			$uls = $('ul', $main_cont);
1786
1787		$uls.each(function(){
1788			var $ul = $(this),
1789				mobile_hidden = true,
1790				tablet_hidden = true;
1791			$('> li:not(.hidden)', $ul).each(function(){
1792				if ( !$(this).hasClass('mobile-hidden') ) {
1793					mobile_hidden = false;
1794					return false;
1795				}
1796			});
1797			$('> li:not(.hidden)', $ul).each(function(){
1798				if ( !$(this).hasClass('tablet-hidden') ) {
1799					tablet_hidden = false;
1800					return false;
1801				}
1802			});
1803			if ( mobile_hidden ) {
1804				$ul.addClass('mobile-hidden');
1805			}
1806			if ( tablet_hidden ) {
1807				$ul.addClass('tablet-hidden');
1808			}
1809		});
1810
1811		var $divUlsMB = $('div:has(>ul.mobile-hidden)');
1812
1813		$divUlsMB.each(function(){
1814			var $divUlMB = $(this),
1815				div_mobile_hidden = true,
1816				div_tablet_hidden = true;
1817
1818			$('> ul:not(.hidden)', $divUlMB).each(function(){
1819				if ( !$(this).hasClass('mobile-hidden') ) {
1820					div_mobile_hidden = false;
1821					return false;
1822				}
1823			});
1824			$('> ul:not(.hidden)', $divUlMB).each(function(){
1825				if ( !$(this).hasClass('tablet-hidden') ) {
1826					div_tablet_hidden = false;
1827					return false;
1828				}
1829			});
1830			if ( div_mobile_hidden ) {
1831				$divUlMB.addClass('mobile-hidden');
1832			}
1833			if ( div_tablet_hidden ) {
1834				$divUlMB.addClass('tablet-hidden');
1835			}
1836		});
1837	});
1838
1839	var overlaySearchButton = function(){
1840		var $search_wrap = $('.overlay.overlay-search, .widget_search');
1841
1842		$search_wrap.each(function(){
1843			var $form = $('form', this),
1844				$icon = $('i', $form);
1845
1846			$icon.on('click', function(){
1847				$form.submit();
1848			});
1849		});
1850	};
1851	overlaySearchButton();
1852}
1853
1854UNCODE.okvideo = function() {
1855	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
1856	$.okvideo = function(options) {
1857		// if the option var was just a string, turn it into an object
1858		if (typeof options !== 'object') options = {
1859			'video': options
1860		};
1861		var base = this;
1862		// kick things off
1863		base.init = function() {
1864			base.options = $.extend({}, $.okvideo.options, options);
1865			// support older versions of okvideo
1866			if (base.options.video === null) base.options.video = base.options.source;
1867			base.setOptions();
1868			var target = base.options.target || $('body');
1869			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
1870			var zIndex = base.options.controls === 3 ? -999 : "auto";
1871			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
1872				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>';
1873				if (OKEvents.utils.isMobile()) {
1874					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>');
1875				} else {
1876					if (base.options.controls === 3) {
1877						target.append(mask)
1878					}
1879					if (base.options.adproof === 1) {
1880						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>');
1881					} else {
1882						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>');
1883					}
1884				}
1885				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
1886				if (base.options.playlist.list === null) {
1887					if (base.options.video.provider === 'youtube') {
1888						base.loadYouTubeAPI();
1889					} else if (base.options.video.provider === 'vimeo') {
1890						base.options.volume /= 100;
1891						base.loadVimeoAPI();
1892					}
1893				} else {
1894					base.loadYouTubeAPI();
1895				}
1896			}
1897		};
1898		// clean the options
1899		base.setOptions = function() {
1900			// exchange 'true' for '1' and 'false' for 3
1901			for (var key in this.options) {
1902				if (this.options[key] === true) this.options[key] = 1;
1903				if (this.options[key] === false) this.options[key] = 3;
1904			}
1905			if (base.options.playlist.list === null) {
1906				base.options.video = base.determineProvider();
1907			}
1908			// pass options to the window
1909			$(window).data('okoptions-' + base.options.id, base.options);
1910		};
1911		// insert js into the head and exectue a callback function
1912		base.insertJS = function(src, callback){
1913			var tag;
1914			if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) {
1915				tag = UNCODE.insertedSripts[src];
1916				if (callback){
1917					if (tag.readyState){  //IE
1918						tag.onreadystatechange = function(){
1919							if (tag.readyState === "loaded" ||
1920								tag.readyState === "complete"){
1921								tag.onreadystatechange = null;
1922								callback();
1923							}
1924						};
1925					} else {
1926						$(tag).on('load', callback);
1927					}
1928				}
1929				return;
1930			}
1931			tag = document.createElement('script');
1932			if (callback){
1933				if (tag.readyState){  //IE
1934					tag.onreadystatechange = function(){
1935						if (tag.readyState === "loaded" || tag.readyState === "complete"){
1936							tag.onreadystatechange = null;
1937							callback();
1938						}
1939					};
1940				} else {
1941					tag.onload = function() {
1942						callback();
1943					};
1944				}
1945			}
1946			tag.src = src;
1947			var firstScriptTag = document.getElementsByTagName('script')[0];
1948			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
1949			if ( ! UNCODE.insertedSripts ) {
1950				UNCODE.insertedSripts = [];
1951			}
1952			UNCODE.insertedSripts[src] = tag;
1953		};
1954		// load the youtube api
1955		base.loadYouTubeAPI = function(callback) {
1956			base.insertJS('https://www.youtube.com/player_api');
1957		};
1958		base.loadYouTubePlaylist = function() {
1959			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
1960		};
1961		// load the vimeo api by replacing the div with an iframe and loading js
1962		base.loadVimeoAPI = function() {
1963			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',
1964			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >');
1965			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
1966			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
1967			base.insertJS('//player.vimeo.com/api/player.js', function() {
1968				vimeoPlayerReady(base.options.id);
1969			});
1970		};
1971		// is it from youtube or vimeo?
1972		base.determineProvider = function() {
1973			var a = document.createElement('a');
1974			a.href = base.options.video;
1975			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
1976				var videoid = a.href.split('/')[3].toString();
1977				var query = videoid.substring(videoid.indexOf('?') + 1);
1978				if (query != '') {
1979					var vars = query.split('&');
1980					for (var i = 0; i < vars.length; i++) {
1981						var pair = vars[i].split('=');
1982						if (pair[0] == 'v') {
1983							videoid = pair[1];
1984						}
1985					}
1986				}
1987				return {
1988					"provider": "youtube",
1989					"id": videoid
1990				};
1991			} else if (/vimeo.com/.test(base.options.video)) {
1992				return {
1993					"provider": "vimeo",
1994					"id": (a.href.split('/')[3].toString()).split('#')[0],
1995				};
1996			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
1997				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
1998				if (id.length == 11) {
1999					return {
2000						"provider": "youtube",
2001						"id": id.toString()
2002					};
2003				} else {
2004					for (var i = 0; i < base.options.video.length; i++) {
2005						if (typeof parseInt(base.options.video[i]) !== "number") {
2006							throw 'not vimeo but thought it was for a sec';
2007						}
2008					}
2009					return {
2010						"provider": "vimeo",
2011						"id": base.options.video
2012					};
2013				}
2014			} else {
2015				throw "OKVideo: Invalid video source";
2016			}
2017		};
2018		base.init();
2019	};
2020
2021	var checkResize,
2022		newW = UNCODE.wwidth;
2023
2024	$.okvideo.options = {
2025		id: null,
2026		source: null, // Deprecate dis l8r
2027		video: null,
2028		playlist: { // eat ur heart out @brokyo
2029			list: null,
2030			index: 0,
2031			startSeconds: 0,
2032			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
2033		},
2034		disableKeyControl: 1,
2035		captions: 0,
2036		loop: 1,
2037		hd: 1,
2038		volume: 0,
2039		adproof: false,
2040		unstarted: null,
2041		onFinished: null,
2042		onReady: null,
2043		onPlay: null,
2044		onPause: null,
2045		buffering: null,
2046		controls: false,
2047		autoplay: true,
2048		annotations: true,
2049		cued: null
2050	};
2051	$.fn.okvideo = function(options) {
2052		options.target = this;
2053		return this.each(function() {
2054			(new $.okvideo(options));
2055		});
2056	};
2057
2058	var checkForVideos = function(){
2059		$(".uncode-video-container.video").each(function(index, el) {
2060			var $this = $(this),
2061				mobile_ready = $this.hasClass('no-control-mobile-autoplay'),
2062				url = $this.attr('data-video'),
2063				id = $this.attr('data-id'),
2064				cloned = $this.closest('.owl-item');
2065
2066			if ( mobile_ready || newW >= UNCODE.mediaQuery ) {
2067				if (!cloned.hasClass('cloned') || cloned.length == 0) {
2068					$this.okvideo({
2069						id: id,
2070						source: url.split('#')[0],
2071						time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
2072						autoplay: 1,
2073						controls: 0,
2074						volume: 0,
2075						adproof: 0,
2076						caller: $this,
2077						hd: 1,
2078						onReady: function(player) {
2079							var getPlayer = player.c || player.h || player,
2080							$iframe,
2081							getContainer = $(getPlayer).closest('.background-element');
2082							if (getContainer.length) {
2083								UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)');
2084							}
2085
2086							if ( $this.hasClass('drop-move') ) {
2087
2088								var $iframe = $(getPlayer),
2089									w = parseFloat($iframe.attr('width')),
2090									h = parseFloat($iframe.attr('height')),
2091									ratio = h / w,
2092									setResizeiFto,
2093								resizeiFrame = function(){
2094									var dataW = $this.attr('data-w'),
2095										newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2096										newH = newW * ratio;
2097									$iframe.css({
2098										width: newW,
2099										height: newH
2100									});
2101								};
2102								resizeiFrame();
2103								$(window).on( 'load', resizeiFrame );
2104								$(window).on( 'resize', function(){
2105									clearRequestTimeout(setResizeiFto);
2106									setResizeiFto = requestTimeout( function() {
2107										resizeiFrame();
2108									}, 10 );
2109								});
2110
2111							}
2112
2113						}
2114					});
2115				}
2116			}
2117		});
2118	};
2119
2120	checkForVideos();
2121
2122	$(window).on('load', function(){
2123		$('.mejs-fullscreen-button button').on('click', function(){
2124			var $button = $(this),
2125				$stuck = $button.closest('.is_stucked');
2126
2127			if ( $stuck.length ) {
2128				$stuck = $(this).trigger("sticky_kit:detach");
2129				window.scrollTo(0, 0);
2130			}
2131		});
2132	});
2133
2134	var checkVideoResize = function(){
2135		clearRequestTimeout(checkResize);
2136		checkResize = requestTimeout(function(){
2137			if ( newW !== UNCODE.wwidth ) {
2138				newW = UNCODE.wwidth;
2139				checkForVideos();
2140			}
2141		}, 1000);
2142	};
2143
2144	$(window).off('resize', checkVideoResize)
2145	.on( 'resize', checkVideoResize);
2146
2147};
2148
2149UNCODE.backgroundSelfVideos = function( $ctx ) {
2150
2151	var backgroundSelfVideosInit = function( $ctx ) {
2152		if ( SiteParameters.block_mobile_videos === true ) {
2153			return false;
2154		}
2155		if (typeof MediaElement === "function") {
2156			if ( typeof $ctx === 'undefined' ) {
2157				$ctx = document;
2158			}
2159		
2160			$(".background-video-shortcode", $ctx).each(function(index, el) {
2161				if ( $(this).closest('mediaelementwrapper').length ) {
2162					return true;
2163				}
2164				var $video_el = $(this),
2165					$parent_carousel = $video_el.parents('.uncode-slider').eq(0),
2166					$parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'),
2167					video_id = $video_el.attr('id');
2168
2169				if ( SiteParameters.is_frontend_editor ) {
2170					video_id = video_id + '_' + index;
2171					$video_el.attr('id', video_id);
2172				}
2173
2174				var media = new MediaElement(video_id, {
2175					startVolume: 0,
2176					loop: true,
2177					success: function(mediaElement, domObject) {
2178						domObject.volume = 0;
2179						$(mediaElement).data('started', false);
2180						mediaElement.addEventListener('timeupdate', function(e) {
2181							if (!$(e.target).data('started')) {
2182								$(mediaElement).data('started', true);
2183							}
2184						});
2185						mediaElement.addEventListener('loadedmetadata', function(e) {
2186							$('body').removeClass('video-not-supported');
2187							mediaElement.play();
2188						});
2189						if (!UNCODE.isMobile) {
2190							requestTimeout(function() {
2191								UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)');
2192							}, 100);
2193						}
2194						if ( ($('html.firefox').length) && !$parent_carousel.length  ) {
2195							mediaElement.play();
2196						}
2197
2198						if ( $parent_drop_move.length ) {
2199							var setResizeMEto,
2200								resizeMediaElement = function(){
2201								var dataW = $parent_drop_move.attr('data-w'),
2202									videoW = domObject.width,
2203									videoH = domObject.height,
2204									newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2205									newH = newW / ( videoW / videoH );
2206
2207								$(domObject).css({
2208									'height': newH,
2209									'width': newW
2210								});
2211							};
2212							$(window).on( 'resize load', function(){
2213								clearRequestTimeout(setResizeMEto);
2214								setResizeMEto = requestTimeout( function() {
2215									resizeMediaElement();
2216								}, 10 );
2217							});
2218						}
2219
2220						mediaElement.addEventListener('play', function() {
2221							$(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2222							$(mediaElement).closest('#page-header').addClass('video-started');
2223							$(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2224						}, true);
2225
2226					},
2227					// fires when a problem is detected
2228					error: function() {}
2229				});
2230			});
2231		} else {
2232
2233			if ( typeof $ctx === 'undefined' ) {
2234				$ctx = document;
2235			}
2236		
2237			const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)");
2238			Array.from(videos).forEach(function(video_el) {
2239				video_el.addEventListener('loadedmetadata', function(e) {
2240					$('body').removeClass('video-not-supported');
2241					video_el.play();
2242				});
2243				if ( video_el.currentTime > 0 && video_el.readyState > 2 ) {
2244					video_el.muted = true;
2245					video_el.loop = true;
2246					$(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2247					$(video_el).addClass('started').closest('#page-header').addClass('video-started');
2248					$(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2249					$('body').removeClass('video-not-supported');
2250					video_el.play();
2251				} else {
2252					requestTimeout(function(){
2253                         backgroundSelfVideosInit( $ctx );
2254					}, 1000);
2255				}
2256			});
2257		}
2258	};
2259
2260	backgroundSelfVideosInit( $ctx );
2261
2262	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2263		window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
2264			var $el = model.view.$el,
2265				shortcode = model.attributes.shortcode;
2266
2267			if (typeof MediaElement === "function") {
2268				backgroundSelfVideosInit( $el );
2269			} else {
2270				backgroundSelfVideosInit( $el[0] );
2271			}
2272		});
2273	}
2274};
2275
2276UNCODE.is_scrolling = false;
2277
2278UNCODE.disableHoverScroll = function() {
2279
2280	if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor) {
2281		var body = document.body,
2282		timer;
2283
2284		window.addEventListener('scroll', function() {
2285			var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300;
2286			clearRequestTimeout(timer);
2287			if ( body.classList && !body.classList.contains('disable-hover') ) {
2288				body.classList.add('disable-hover');
2289				window.dispatchEvent(new CustomEvent('disable-hover'));
2290			}
2291			UNCODE.is_scrolling = true;
2292
2293			timer = requestTimeout(function() {
2294				if ( body.classList ) {
2295					body.classList.remove('disable-hover');
2296					window.dispatchEvent(new CustomEvent('enable-hover'));
2297				}
2298				UNCODE.is_scrolling = false;
2299			}, delay);
2300		}, false);
2301	}
2302};
2303
2304UNCODE.isotopeLayout = function() {
2305	if ($('.isotope-layout').length > 0) {
2306		var isotopeContainersArray = [],
2307			typeGridArray = [],
2308			layoutGridArray = [],
2309			screenLgArray = [],
2310			screenMdArray = [],
2311			screenSmArray = [],
2312			transitionDuration = [],
2313			$filterItems = [],
2314			$filters = $('.isotope-system .isotope-filters'),
2315			$itemSelector = '.tmb-iso',
2316			$items,
2317			itemMargin,
2318			correctionFactor = 0,
2319			firstLoad = true,
2320			isOriginLeft = $('body').hasClass('rtl') ? false : true;
2321		$('[class*="isotope-container"]').each(function(index) {
2322			var _this = $(this);
2323			var isoData = _this.data(),
2324			$data_lg,
2325			$data_md,
2326			$data_sm;
2327			_this.children('.tmb').addClass('tmb-iso');
2328			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
2329			else $data_lg = '1000';
2330			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
2331			else $data_md = '600';
2332			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
2333			else $data_sm = '480';
2334			screenLgArray.push($data_lg);
2335			screenMdArray.push($data_md);
2336			screenSmArray.push($data_sm);
2337			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
2338			if (isoData.type == 'metro') typeGridArray.push(true);
2339			else typeGridArray.push(false);
2340			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
2341			else layoutGridArray.push('masonry');
2342			isotopeContainersArray.push(_this);
2343			_this.attr('data-iso-index', index);
2344		});
2345		var colWidth = function(index) {
2346				$(isotopeContainersArray[index]).width('');
2347				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
2348					widthAvailable = $(isotopeContainersArray[index]).width(),
2349					columnNum = 12,
2350					columnWidth = 0,
2351					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
2352					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
2353					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
2354					$rowContainer,
2355					paddingRow,
2356					$colContainer,
2357					paddingCol;
2358
2359				if ( consider_menu )
2360					winHeight = winHeight - UNCODE.menuHeight;
2361
2362				if ( data_vp_height === '1' ) {
2363					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
2364					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
2365					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
2366					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
2367					winHeight = winHeight - ( paddingRow + paddingCol );
2368				}
2369
2370				if (isPx) {
2371					columnWidth = Math.ceil(widthAvailable / columnNum);
2372					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
2373				} else {
2374					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
2375				}
2376				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
2377				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
2378				for (var i = 0, len = $items.length; i < len; i++) {
2379					var $item = $($items[i]),
2380						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
2381						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
2382						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
2383
2384
2385					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
2386						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
2387					}
2388
2389					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
2390						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
2391					}
2392
2393					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
2394						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2395							switch (parseInt(multiplier_w[1])) {
2396								case (5):
2397								case (4):
2398								case (3):
2399									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2400									multiplier_w[1] = 6;
2401									break;
2402								case (2):
2403								case (1):
2404									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
2405									multiplier_w[1] = 3;
2406									break;
2407								default:
2408									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2409									multiplier_w[1] = 12;
2410									break;
2411							}
2412
2413							if (multiplier_w[1] == 2.4) { // 5 columns
2414								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2415								multiplier_w[1] = 6;
2416							}
2417						}
2418					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
2419						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2420							switch (parseInt(multiplier_w[1])) {
2421								case (5):
2422								case (4):
2423								case (3):
2424								case (2):
2425								case (1):
2426									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2427									multiplier_w[1] = 6;
2428									break;
2429								default:
2430									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2431									multiplier_w[1] = 12;
2432									break;
2433							}
2434
2435							if (multiplier_w[1] == 2.4) { // 5 columns
2436								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2437								multiplier_w[1] = 6;
2438							}
2439						}
2440					} else if (widthAvailable < screenSmArray[index]) {
2441						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2442							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2443							multiplier_w[1] = 12;
2444							if (typeGridArray[index]) multiplier_h[1] = 12;
2445						}
2446					}
2447					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
2448						height;
2449
2450					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
2451						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
2452						if ( widthAvailable < screenSmArray[index] ) {
2453							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
2454						}
2455					} else {
2456						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
2457					}
2458
2459					if (width >= widthAvailable) {
2460						$item.css({
2461							width: widthAvailable
2462						});
2463						if (typeGridArray[index]) {
2464							$item.children().add($item.find('.backimg')).css({
2465								height: height
2466							});
2467						}
2468					} else {
2469						$item.css({
2470							width: width
2471						});
2472						if (typeGridArray[index]) {
2473							$item.children().add($item.find('.backimg')).css({
2474								height: height
2475							});
2476						}
2477					}
2478				}
2479				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
2480					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
2481				} else {
2482					return columnWidth;
2483				}
2484			},
2485			init_isotope = function() {
2486				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
2487					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
2488						isotopeId = isotopeSystem.attr('id'),
2489						$layoutMode = layoutGridArray[i],
2490						setIsotopeFirstRowTimeOut,
2491					setIsotopeFirstRow = function(items){
2492						var firstRow = true;
2493						$(items).each(function(index, val){
2494							var el = items[index].element,
2495								el_top = items[index].position.y,
2496								$el = $(el);
2497							if ( index > 0 && el_top > 0 && firstRow ) {
2498								firstRow = false;
2499							} else if ( index == 0 && el_top == 0 ) {
2500								firstRow = true;
2501							}
2502							if ( firstRow ) {
2503								$el.removeClass('tmb-isotope-further-row');
2504							} else {
2505								$el.addClass('tmb-isotope-further-row');
2506							}
2507						});
2508					};
2509					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
2510						//resizable: true,
2511						itemSelector: $itemSelector,
2512						layoutMode: $layoutMode,
2513						transitionDuration: transitionDuration[i],
2514						masonry: {
2515							columnWidth: colWidth(i)
2516						},
2517						vertical: {
2518							horizontalAlignment: 0.5,
2519						},
2520						sortBy: 'original-order',
2521						isOriginLeft: isOriginLeft
2522					})
2523					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
2524					.on('layoutComplete', function( event, items ){
2525						if ( typeof items[0] !== 'undefined' ) {
2526							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
2527								setIsotopeFirstRow(items);
2528							}
2529						}
2530					})
2531					.on('arrangeComplete', function( event, items ){
2532						if ( typeof items[0] !== 'undefined' ) {
2533							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
2534								clearRequestTimeout(setIsotopeFirstRowTimeOut);
2535								setIsotopeFirstRowTimeOut = requestTimeout(function(){
2536									setIsotopeFirstRow(items);
2537								}, 100);
2538							}
2539						}
2540					});
2541					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
2542						$(isotopeContainersArray[i]).infinitescroll({
2543								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
2544								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
2545								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat', // selector for all items you'll retrieve
2546								animate: false,
2547								behavior: 'local',
2548								debug: false,
2549								loading: {
2550									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
2551									speed: 0,
2552									finished: undefined,
2553									msg: $('#' + isotopeId + ' .loadmore-button'),
2554								},
2555								errorCallback: function() {
2556									var isotope_system = $(this).closest('.isotope-system');
2557									$('.loading-button', isotope_system).hide();
2558									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
2559								}
2560							},
2561							// append the new items to isotope on the infinitescroll callback function.
2562							function(newElements, opts) {
2563								var $isotope = $(this),
2564									isotopeId = $isotope.closest('.isotope-system').attr('id'),
2565									filters = new Array(),
2566									$loading_button = $isotope.closest('.isotope-system').find('.loading-button'),
2567									$infinite_button = $isotope.closest('.isotope-system').find('.loadmore-button'),
2568									$numPages = $('a', $infinite_button).data('pages'),
2569									delay = 300;
2570								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
2571								$infinite_button.show();
2572								$loading_button.hide();
2573								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
2574								$('> li', $isotope).remove();
2575								$.each($(newElements), function(index, val) {
2576									$(val).addClass('tmb-iso');
2577									if ($(val).is("li")) {
2578										filters.push($(val)[0]);
2579									}
2580								});
2581								newElements = newElements.filter(function(x) {
2582									return filters.indexOf(x) < 0
2583								});
2584								$.each($(filters), function(index, val) {
2585									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
2586								});
2587								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
2588								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2589									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
2590									if (typeof getLightbox === 'object') {
2591										getLightbox.refresh();
2592									} else {
2593										UNCODE.lightbox();
2594									}
2595								}
2596								if ( typeof twttr !== 'undefined' )
2597									twttr.widgets.load(isotopeContainersArray[i]);
2598
2599								requestTimeout(function() {
2600									Waypoint.refreshAll();
2601									$isotope.trigger('more-items-loaded');
2602									$(window).trigger('more-items-loaded');
2603								}, 1000);
2604
2605							});
2606						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
2607							var $infinite_isotope = $(isotopeContainersArray[i]),
2608								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
2609							$infinite_isotope.infinitescroll('pause');
2610							$infinite_button.on('click', function(event) {
2611								event.preventDefault();
2612								var $infinite_system = $(event.target).closest('.isotope-system'),
2613								$infinite_isotope = $infinite_system.find('.isotope-container'),
2614								isotopeId = $infinite_system.attr('id');
2615								$(event.currentTarget).html(SiteParameters.loading);
2616								$infinite_isotope.infinitescroll('resume');
2617								$infinite_isotope.infinitescroll('retrieve');
2618								$infinite_isotope.infinitescroll('pause');
2619							});
2620						}
2621					}
2622				}
2623			},
2624			onLayout = function(isotopeObj, startIndex, needsReload) {
2625				var needsReload = needsReload ? true : false;
2626
2627				if (typeof UNCODE.bigText !== 'undefined') {
2628					UNCODE.bigText();
2629				}
2630				isotopeObj.css('opacity', 1);
2631				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
2632
2633				requestTimeout(function() {
2634					if (startIndex > 0) {
2635						reloadIsotope(isotopeObj);
2636						if (SiteParameters.dynamic_srcset_active === '1') {
2637							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
2638							UNCODE.adaptive_srcset(isotopeObj);
2639						}
2640						// window.dispatchEvent(UNCODE.boxEvent);
2641					} else if (needsReload) {
2642						reloadIsotope(isotopeObj);
2643					}
2644
2645					UNCODE.adaptive();
2646					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
2647						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
2648					}
2649					if (typeof MediaElement === "function") {
2650						$(isotopeObj).find('audio,video').each(function() {
2651							$(this).mediaelementplayer({
2652	 							pauseOtherPlayers: false,
2653							});
2654						});
2655					}
2656					if ($(isotopeObj).find('.nested-carousel').length) {
2657						if (typeof UNCODE.carousel !== 'undefined') {
2658							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
2659						}
2660						requestTimeout(function() {
2661							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
2662						}, 200);
2663					} else {
2664						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
2665					}
2666					isotopeObj.trigger('isotope-layout-complete');
2667
2668				}, 100);
2669
2670			},
2671			boxAnimation = function(items, startIndex, sequential, container) {
2672				var $allItems = items.length - startIndex,
2673					showed = 0,
2674					index = 0;
2675				if (container.closest('.owl-item').length == 1) return false;
2676				$.each(items, function(index, val) {
2677					var $this = $(val),
2678						elInner = $('> .t-inside', val);
2679					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
2680						return;
2681					}
2682					if (val[0]) val = val[0];
2683					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
2684						new Waypoint({
2685							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
2686							element: val,
2687							handler: function() {
2688								var element = $('> .t-inside', this.element),
2689									parent = $(this.element),
2690									currentIndex = parent.index();
2691								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
2692									delayAttr = parseInt(element.attr('data-delay'));
2693								if (isNaN(delayAttr)) delayAttr = 100;
2694								delay -= showed;
2695								var objTimeout = requestTimeout(function() {
2696									element.removeClass('zoom-reverse').addClass('start_animation');
2697									showed = parent.index();
2698									if ( container.data('isotope') ) {
2699										container.isotope('layout');
2700									}
2701								}, delay * delayAttr)
2702								parent.data('objTimeout', objTimeout);
2703								if (!UNCODE.isUnmodalOpen) {
2704									this.destroy();
2705								}
2706							},
2707							offset: '100%'
2708						})
2709					} else {
2710						if (elInner.hasClass('force-anim')) {
2711							elInner.addClass('start_animation');
2712						} else {
2713							elInner.css('opacity', 1);
2714						}
2715						container.isotope('layout');
2716					}
2717
2718					index++;
2719				});
2720			},
2721			reloadIsotope = function(isotopeObj) {
2722				var isoIndex = $(isotopeObj).attr('data-iso-index');
2723				var $layoutMode = ($(isotopeObj).data('layout'));
2724				if ($layoutMode === undefined) {
2725					$layoutMode = 'masonry';
2726				}
2727				if (isotopeObj.data('isotope')) {
2728					isotopeObj.isotope({
2729						itemSelector: $itemSelector,
2730						layoutMode: $layoutMode,
2731						transitionDuration: transitionDuration[isoIndex],
2732						masonry: {
2733							columnWidth: colWidth(isoIndex)
2734						},
2735						vertical: {
2736							horizontalAlignment: 0.5,
2737						},
2738						sortBy: 'original-order',
2739						isOriginLeft: isOriginLeft
2740					});
2741				}
2742			}
2743			;
2744		if ($('.isotope-pagination').length > 0) {
2745			$('.isotope-system').on('click', '.pagination a', function(evt) {
2746				evt.preventDefault();
2747
2748				if (SiteParameters.index_pagination_disable_scroll !== '1') {
2749					var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
2750						container = $(this).closest('.isotope-system'),
2751						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
2752					calc_scroll -= UNCODE.get_scroll_offset();
2753
2754					var menu_container = $('.menu-sticky');
2755					var menu = menu_container.find('.menu-container');
2756
2757					if (menu_container.length > 0 && menu.length > 0) {
2758						calc_scroll = calc_scroll - menu.outerHeight();
2759					}
2760
2761					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
2762						delta = bodyTop - calc_scroll,
2763						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
2764					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
2765
2766					if (!UNCODE.isFullPage) {
2767						if (scrollSpeed == 0) {
2768							$('html, body').scrollTop(calc_scroll);
2769						} else {
2770							$('html, body').animate({
2771								scrollTop: calc_scroll
2772							}, {
2773								easing: 'easeInOutQuad',
2774								duration: scrollSpeed,
2775								complete: function () {
2776									UNCODE.scrolling = false;
2777								}
2778							});
2779						}
2780					}
2781				}
2782
2783				loadIsotope($(this), true);
2784			});
2785		}
2786		$filters.on('click', 'a.isotope-nav-link', function(evt) {
2787			if ($(this).hasClass('no-isotope-filter')) {
2788				return;
2789			}
2790			var $filter = $(this),
2791				filterContainer = $filter.closest('.isotope-filters'),
2792				filterValue = $filter.attr('data-filter'),
2793				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
2794				transitionDuration = container.data().isotope.options.transitionDuration,
2795				delay = 300,
2796				filterItems = [];
2797
2798			var filter_items = function(){
2799				if (filterValue !== undefined) {
2800					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
2801						var parent = $(val).parent(),
2802							objTimeout = parent.data('objTimeout');
2803						if (objTimeout) {
2804							$(val).removeClass('zoom-reverse').removeClass('start_animation')
2805							clearRequestTimeout(objTimeout);
2806						}
2807						if (transitionDuration == 0) {
2808							if ($(val).hasClass('animate_when_almost_visible')) {
2809								$(val).addClass('zoom-reverse').removeClass('start_animation');
2810							} else {
2811								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
2812							}
2813						}
2814					});
2815					requestTimeout(function(){
2816						if ( filterValue == '*' ) {
2817							container.removeClass('isotope-filtered');
2818						} else {
2819							container.addClass('isotope-filtered');
2820						}
2821						container.isotope({
2822							filter: function() {
2823								var block = $(this),
2824								filterable = (filterValue == '*') || block.hasClass(filterValue),
2825								lightboxElements = $('[data-lbox^=ilightbox]', block);
2826								if (filterable) {
2827									if (lightboxElements.length) {
2828										lightboxElements.removeClass('lb-disabled');
2829										container.data('lbox', $(lightboxElements[0]).data('lbox'));
2830									}
2831									filterItems.push(block);
2832								} else {
2833									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
2834								}
2835								container.trigger('more-items-loaded');
2836								$(window).trigger('more-items-loaded');
2837								return filterable;
2838							}
2839						});
2840						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
2841
2842					}, delay);
2843
2844					/** once filtered - start **/
2845					container.isotope('once', 'arrangeComplete', function() {
2846						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2847							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
2848							if (typeof getLightbox === 'object') {
2849								getLightbox.refresh();
2850							} else {
2851								UNCODE.lightbox();
2852							}
2853						}
2854						if (transitionDuration == 0) {
2855							requestTimeout(function() {
2856								boxAnimation(filterItems, 0, false, container);
2857							}, 100);
2858						}
2859						requestTimeout(function() {
2860							Waypoint.refreshAll();
2861						}, 2000);
2862					});
2863					/** once filtered - end **/
2864				} else {
2865					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2866						$.each(UNCODE.lightboxArray, function(index, val) {
2867							UNCODE.lightboxArray[index].destroy();
2868						});
2869					}
2870					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
2871						var parent = $(val).parent(),
2872							objTimeout = parent.data('objTimeout');
2873						if (objTimeout) {
2874							$(val).removeClass('zoom-reverse').removeClass('start_animation')
2875							clearRequestTimeout(objTimeout);
2876						}
2877						if (transitionDuration == 0) {
2878							if ($(val).hasClass('animate_when_almost_visible')) {
2879								$(val).addClass('zoom-reverse').removeClass('start_animation');
2880							} else {
2881								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
2882							}
2883						}
2884					});
2885					container.parent().addClass('grid-loading');
2886					loadIsotope($filter);
2887				}
2888			};
2889
2890			if (!$filter.hasClass('active')) {
2891				/** Scroll top with filtering */
2892				if (filterContainer.hasClass('filter-scroll')) {
2893                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
2894                    calc_scroll -= UNCODE.get_scroll_offset();
2895
2896					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
2897						delta = bodyTop - calc_scroll,
2898						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
2899						filterTolerance = false,
2900						filter_timeout;
2901					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
2902
2903					if ( !UNCODE.isFullPage ) {
2904						if (scrollSpeed == 0) {
2905							$('html, body').scrollTop(calc_scroll);
2906							UNCODE.scrolling = false;
2907							filter_items();
2908						} else {
2909
2910							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
2911								filter_items();
2912								filterTolerance = true;
2913							}
2914
2915							$('html, body').animate({
2916								scrollTop: calc_scroll
2917							},{
2918								easing: 'easeInOutQuad',
2919								duration: scrollSpeed,
2920								complete: function(){
2921									UNCODE.scrolling = false;
2922									if ( !filterTolerance ) {
2923										filter_timeout = setTimeout(function(){
2924											clearTimeout(filter_timeout);
2925											filter_items();
2926										}, 200);
2927									}
2928								}
2929							});
2930						}
2931					}
2932				} else {
2933					filter_items();
2934				}
2935			}
2936			evt.preventDefault();
2937		});
2938
2939		$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) {
2940			var params = UNCODE.getURLParams(window.location);
2941			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
2942
2943			UNCODE.lastURL = window.location.href;
2944
2945			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
2946				return;
2947			}
2948
2949			if (params.id === undefined) {
2950				$.each($('.isotope-system'), function(index, val) {
2951					loadIsotope($(val));
2952				});
2953			} else {
2954				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
2955					loadIsotope($('#' + params.id));
2956				}
2957			}
2958		});
2959
2960		var loadIsotope = function($href, $paginating) {
2961			var is_paginating = false;
2962
2963			if (undefined !== $paginating && $paginating) {
2964				var is_paginating = $paginating;
2965			}
2966
2967			var href = ($href.is("a") ? $href.attr('href') : location),
2968				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
2969				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
2970				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
2971				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
2972				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
2973				isotopeId = isotopeSystem.attr('id');
2974			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
2975				UNCODE.lastURL = href;
2976				history.pushState({
2977					myIsotope: true
2978				}, document.title, href);
2979			}
2980			if (is_paginating) {
2981				isotopeWrapper.addClass('grid-filtering');
2982			}
2983			$.ajax({
2984				url: href
2985			}).done(function(data) {
2986				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
2987					$resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0],
2988					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
2989				isotopeWrapper.addClass('isotope-reloaded');
2990				requestTimeout(function() {
2991					isotopeWrapper.removeClass('grid-loading');
2992					isotopeWrapper.removeClass('isotope-reloaded');
2993					isotopeWrapper.removeClass('grid-filtering');
2994				}, 500);
2995				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
2996					var parent = $(val).parent(),
2997						objTimeout = parent.data('objTimeout');
2998					if (objTimeout) {
2999						$(val).removeClass('zoom-reverse').removeClass('start_animation')
3000						clearRequestTimeout(objTimeout);
3001					}
3002					if ($(val).hasClass('animate_when_almost_visible')) {
3003						$(val).addClass('zoom-reverse').removeClass('start_animation');
3004					} else {
3005						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
3006					}
3007				});
3008				requestTimeout(function() {
3009					if (isotopeContainer.data('isotope')) {
3010						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
3011						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
3012						UNCODE.adaptive();
3013						if (SiteParameters.dynamic_srcset_active === '1') {
3014							UNCODE.adaptive_srcset(isotopeContainer);
3015						}
3016						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3017							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
3018							if (typeof getLightbox === 'object') {
3019								getLightbox.refresh();
3020							} else {
3021								UNCODE.lightbox();
3022							}
3023						}
3024					}
3025					isotopeContainer.trigger('more-items-loaded');
3026					$(window).trigger('more-items-loaded');
3027				}, 300);
3028				$('.pagination', isotopeFooter).remove();
3029				isotopeFooter.append($resultPagination);
3030
3031				if (isotopeResultCount.length > 0) {
3032					$('.woocommerce-result-count', isotopeResultCount).remove();
3033					isotopeResultCount.append($resultCount);
3034				}
3035			});
3036		};
3037		$filters.each(function(i, buttonGroup) {
3038			var $buttonGroup = $(buttonGroup);
3039			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
3040				$buttonGroup.find('.active').removeClass('active');
3041				$(this).addClass('active');
3042
3043			});
3044
3045			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
3046				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
3047				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
3048			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
3049				e.preventDefault();
3050				$cats_filters.slideToggle(400, 'easeInOutCirc');
3051			});
3052
3053		});
3054		window.addEventListener('boxResized', function(e) {
3055			if (UNCODE.printDialogOpen !== false) {
3056				return false;
3057			}
3058			$.each($('.isotope-layout'), function(index, val) {
3059				var $layoutMode = ($(this).data('layout'));
3060				if ($layoutMode === undefined) $layoutMode = 'masonry';
3061				if ($(this).data('isotope')) {
3062					$(this).isotope({
3063						itemSelector: $itemSelector,
3064						layoutMode: $layoutMode,
3065						transitionDuration: transitionDuration[index],
3066						masonry: {
3067							columnWidth: colWidth(index)
3068						},
3069						vertical: {
3070							horizontalAlignment: 0.5,
3071						},
3072						sortBy: 'original-order',
3073						isOriginLeft: isOriginLeft
3074					});
3075					$(this).isotope('unbindResize');
3076					if (SiteParameters.dynamic_srcset_active === '1') {
3077						UNCODE.refresh_dynamic_srcset_size($(this));
3078					}
3079				}
3080				$(this).find('.mejs-video,.mejs-audio').each(function() {
3081					$(this).trigger('resize');
3082				});
3083			});
3084		}, false);
3085
3086		init_isotope();
3087	};
3088}
3089
3090UNCODE.lightbox = function() {
3091	if ( SiteParameters.lbox_enhanced ) {
3092		return true;
3093	}
3094	UNCODE.lightboxArray = {};
3095	requestTimeout(function() {
3096		var groupsArr = {};
3097		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() {
3098			var group = this.getAttribute("data-lbox"),
3099				values = $(this).data();
3100			$(this).attr('data-lbox-init','true')
3101			groupsArr[group] = values;
3102		});
3103		for (var i in groupsArr) {
3104			var skin = groupsArr[i].skin || 'black',
3105				path = groupsArr[i].dir || 'horizontal',
3106				thumbs = !groupsArr[i].notmb || false,
3107				arrows = !groupsArr[i].noarr || false,
3108				social = groupsArr[i].social || false,
3109				deeplink = groupsArr[i].deep || false,
3110				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'),
3111				counter = $els.length,
3112				dataAlbum = $els.attr('data-album');
3113			if (social) social = {
3114				facebook: true,
3115				twitter: true,
3116				reddit: true,
3117				digg: true
3118			};
3119			UNCODE.lightboxArray[i] = $els.iLightBox({
3120				selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)',
3121				skin: skin,
3122				path: path,
3123				linkId: deeplink,
3124				infinite: false,
3125				//fullViewPort: 'fit',
3126				smartRecognition: false,
3127				fullAlone: true,
3128				maxScale: 1,
3129				minScale: .02,
3130				//fullStretchTypes: 'flash, video',
3131				overlay: {
3132					opacity: .94
3133				},
3134				controls: {
3135					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
3136					fullscreen: true,
3137					thumbnail: thumbs,
3138					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
3139				},
3140				show: {
3141					speed: 200
3142				},
3143				hide: {
3144					speed: 200
3145				},
3146				social: {
3147					start: false,
3148					buttons: social
3149				},
3150				caption: {
3151					start: false
3152				},
3153				styles: {
3154					nextOpacity: 1,
3155					nextScale: 1,
3156					prevOpacity: 1,
3157					prevScale: 1
3158				},
3159				effects: {
3160					switchSpeed: 400
3161				},
3162				slideshow: {
3163					pauseTime: 5000
3164				},
3165				thumbnails: {
3166					maxWidth: 60,
3167					maxHeight: 60,
3168					activeOpacity: .2
3169				},
3170				html5video: {
3171					preload: true
3172				},
3173				callback: {
3174					onOpen: function(){
3175						$(window).trigger('uncode-custom-cursor');
3176						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3177							iNoBounce.enable();
3178						}
3179					},
3180					onHide: function(){
3181						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3182							iNoBounce.disable()
3183						}
3184					},
3185				}
3186			});
3187
3188			$(document).on('infinite-loaded', function(){
3189				UNCODE.lightboxArray[i].refresh();
3190			});
3191
3192			$(window).on('gdprOpen', function(){
3193				UNCODE.lightboxArray[i].close();
3194			});
3195		};
3196	}, 100);
3197
3198	$(document).on('click', '.lb-disabled', function(e){
3199		e.preventDefault();
3200	});
3201};
3202
3203UNCODE.lightgallery = function( $el ) {
3204	var createSelectors = function(){
3205		$('a[data-lbox]:not([data-lbox-init]):not([data-album])').each(function(){
3206			if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3207				$(this).addClass('lbox-trigger-item');
3208			} else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3209				$(this).addClass('lbox-nested-item');
3210			} else {
3211				$(this).removeClass('lbox-trigger-item');
3212				$(this).removeClass('lbox-nested-item');
3213			}
3214		});
3215	};
3216
3217	createSelectors();
3218
3219	var galleries = [],
3220		nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
3221			return !$(this).closest('.nested-carousel').length;
3222		}),
3223		$_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 *'),
3224		$galleries = $_galleries.filter(function( index ) {
3225			return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
3226		}),
3227		$nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item');
3228
3229	if ( typeof $el === 'undefined' ) {
3230		$el = $galleries.add( $nested );
3231	}
3232
3233	var $disabled = $('a.lb-disabled');
3234	$disabled.on('click', function(e){
3235		e.preventDefault();
3236	});
3237
3238	var beforeSlide = function(event) {
3239		var detail = event.detail,
3240			info = detail.info,
3241			item = detail.item,
3242			$slide = $(detail.currentSlide.selector),
3243			$video = $('video', $slide),
3244			$previous = $(detail.previousSlide.selector),
3245			$prevVideo = $('video', $previous),
3246			isAudio = false;
3247
3248		if ( typeof info.src !== 'undefined' ) {
3249			isAudio = info.src.search(/.mp3|.m4a/i) > -1;
3250		}
3251
3252		if ( ! $video.length && ( info.video || isAudio ) ) {
3253			if ( info.video ) {
3254				if ( typeof info.video === 'object' ) {
3255					var infoJson = info.video;
3256				} else {
3257					var infoJson = JSON.parse(info.video);
3258				}
3259				var src = infoJson.source[0].src,
3260					autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes',
3261					muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes',
3262					loop = $(item).attr('data-loop');
3263
3264			} else if ( isAudio ) {
3265				var src = info.src,
3266					autoplay = true,
3267					loop = false;
3268			}
3269			if ( typeof src !== 'undefined' ) {
3270				$slide.addClass('has-html5');
3271				var video = document.createElement('video');
3272				video.src = src;
3273				video.preload = 'auto';
3274				video.controls = 'controls';
3275				video.controlsList = 'nodownload';
3276				if ( autoplay ) {
3277					video.autoplay = 'autoplay';
3278				}
3279				if ( muted ) {
3280					video.muted = 'muted';
3281				}
3282				if ( loop ) {
3283					video.loop = 'loop';
3284				}
3285				$(video).appendTo($slide);
3286			}
3287		} else {
3288			var $video = $('video', $slide);
3289			if ( $video.length ) {
3290				$video[0].currentTime = 0;
3291				if ( $video[0].autoplay ) {
3292					$video[0].play();
3293				}
3294			}
3295		}
3296		if ( $prevVideo.length ) {
3297			$prevVideo[0].currentTime = 0;
3298			$prevVideo[0].pause();
3299		}
3300	};
3301
3302	var beforeOpen = function(event) {
3303		var detail = event.detail,
3304			items = detail.items,
3305			galleryItems = detail.galleryItems,
3306			outer = detail.outer.selector,
3307			i, ii;
3308		for ( i = 0; i < galleryItems.length; i++ ) {
3309			var item = galleryItems[i];
3310			if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) {
3311				$(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video');
3312			}
3313		}
3314		for ( ii = 0; ii < items.length; ii++ ) {
3315			var item = items[ii];
3316			if ( $(item).attr('data-icon') === 'video' ) {
3317				$(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video');
3318			}
3319		}
3320
3321	};
3322
3323	//caption builder
3324	var captionBuilder = function($el){
3325		$el.each( function( index, val ) {
3326			var $gallery = $(this).attr('data-lbox-init','true'),
3327				$_a = '.lbox-trigger-item',
3328				$_nested_a = '.lbox-nested-item';
3329
3330			$gallery.find($_a, $_nested_a).each(function(){
3331				var $a = $(this),
3332					$img = $('img', $a).first(),
3333					imgw = $img.attr('data-width'),
3334					imgh = $img.attr('data-height'),
3335					caption = $a.attr('data-caption'),
3336					title = $a.attr('data-title');
3337
3338				if ( $img.length && $img.attr('data-crop') != true ) {
3339					if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) {
3340						$a.attr('data-external-thumb-image', $img.attr('data-guid'));
3341					} else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) {
3342						$a.attr('data-external-thumb-image', $img[0].src);
3343					}
3344				}
3345
3346				if ( typeof title !== 'undefined' && title !== '' ) {
3347					title = '<h6>' + title + '</h6>';
3348				} else {
3349					title = '';
3350				}
3351
3352				if ( typeof caption !== 'undefined' && caption !== '' ) {
3353					caption = '<p>' + caption + '</p>';
3354					title += caption;
3355				}
3356
3357				if ( title !== '' ) {
3358					$a.attr( 'title', title );
3359				}
3360
3361				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') ) ) {
3362					$a.attr('data-lg-size', imgw + '-' + imgh);
3363				}
3364			});
3365		});
3366	};
3367	captionBuilder($el);
3368
3369	//regular galleries
3370	$el.each( function( index, val ) {
3371		var $gallery = $(this),
3372			$_a = '.lbox-trigger-item',
3373			$_nested_a = '.lbox-nested-item',
3374			$_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(),
3375			galleryID = $_first.attr('data-lbox'),
3376			$_connected_a = $_a + '[data-lbox="' + galleryID + '"]',
3377			tmb = $_first.attr('data-notmb'),
3378			social = $_first.attr('data-social'),
3379			deep = $_first.attr('data-deep'),
3380			zoom = $_first.attr('data-zoom-origin'),
3381			actual = $_first.attr('data-actual-size'),
3382			download = $_first.attr('data-download'),
3383			controls = $_first.attr('data-arrows') !== 'no',
3384			fullScreen = $_first.attr('data-full'),
3385			counter = $_first.attr('data-counter'),
3386			transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide',
3387			containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
3388			connect = $_first.attr('data-connect'),
3389			lgPlugins = [lgVideo],
3390			itemsLoadedTimeOut;
3391
3392		containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3393		containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
3394
3395		if ( typeof tmb == 'undefined' || !tmb ) {
3396			lgPlugins.push(lgThumbnail);
3397		}
3398		if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) {
3399			lgPlugins.push(lgZoom);
3400		}
3401		if ( typeof deep != 'undefined' && deep != '' ) {
3402			lgPlugins.push(lgHash);
3403		}
3404		if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
3405			lgPlugins.push(lgFullscreen);
3406		}
3407		if ( social ) {
3408			lgPlugins.push(lgShare);
3409		}
3410
3411		if ( galleries.indexOf( galleryID ) !== -1 ) {
3412			return true;
3413		}
3414
3415		galleries.push( galleryID );
3416		var $triggerGal = connect ? $('.page-wrapper') : $gallery,
3417			$selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a;
3418		var gallery = lightGallery( $triggerGal[0], {
3419			addClass: containerClass,
3420			plugins: lgPlugins,
3421			mode: transition,
3422			selector: $selector,
3423			galleryId: galleryID,
3424			thumbnail: ( typeof tmb == 'undefined' || !tmb ),
3425			iframeWidth: '848px',
3426			iframeMaxWidth: '90%',
3427			iframeMaxHeight: '90%',
3428			exThumbImage: 'data-external-thumb-image',
3429			loadYouTubeThumbnail: false,
3430			autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' ),
3431			// autoplayFirstVideo: false,
3432			pager: false,
3433			startClass: 'lg-start-opacity',
3434			zoomFromOrigin: zoom,
3435			controls: controls,
3436			download: ( typeof download != 'undefined' && download != '' ),
3437			thumbWidth: 50,
3438			thumbHeight: '50px',
3439			counter: $triggerGal.find($selector).length > 1 ? counter : false,
3440			loadYouTubePoster: false,
3441			enableDrag: $triggerGal.find($selector).length > 1,
3442			mobileSettings: {
3443				showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
3444			},
3445		});
3446
3447		$('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){
3448			e.preventDefault();
3449			var index = $(this).closest('.owl-item.cloned').attr('data-index');
3450			gallery.openGallery(index-1);
3451		});
3452
3453		clearRequestTimeout(itemsLoadedTimeOut);
3454		$triggerGal.on('more-items-loaded', function(e, items) {
3455			itemsLoadedTimeOut = requestTimeout(function(){
3456				createSelectors();
3457				captionBuilder($triggerGal);
3458				gallery.refresh();
3459			}, 100);
3460		});
3461
3462		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3463			window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
3464				$el = model.view.$el;
3465				if ( $el.find($triggerGal).length ) {
3466					gallery.destroy();
3467				}
3468			});
3469		}
3470
3471		$triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide);
3472		$triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen);
3473		$triggerGal[0].addEventListener('lgAfterOpen', function(){
3474			$(window).trigger('uncode-custom-cursor');
3475		});
3476
3477	});
3478
3479	if ( typeof $el !== 'undefined' ) {
3480
3481		//album galleries
3482		$('a[data-album]:not([data-lbox-init])').each(function(index, val) {
3483			var album = val,
3484				galleryID = index,
3485				$album = $(album),
3486				params = $album.attr('data-album'),
3487				tmb = $(val).attr('data-notmb'),
3488				social = $(val).attr('data-social'),
3489				deep = $(val).attr('data-deep'),
3490				actual = $(val).attr('data-actual-size'),
3491				download = $(val).attr('data-download'),
3492				controls = $(val).attr('data-arrows') !== 'no',
3493				fullScreen = $(val).attr('data-full'),
3494				counter = $(val).attr('data-counter'),
3495				transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide',
3496				containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
3497				lgPlugins = [lgVideo];
3498
3499			$(val).attr('data-lbox-init','true');
3500
3501			containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3502			containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
3503
3504			if ( typeof tmb == 'undefined' || !tmb ) {
3505				lgPlugins.push(lgThumbnail);
3506			}
3507			if ( typeof actual != 'undefined' && actual != '' ) {
3508				lgPlugins.push(lgZoom);
3509			}
3510			if ( typeof deep != 'undefined' && deep != '' ) {
3511				lgPlugins.push(lgHash);
3512			}
3513			if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
3514				lgPlugins.push(lgFullscreen);
3515			}
3516			if ( social ) {
3517				lgPlugins.push(lgShare);
3518			}
3519
3520			var gallery = window.lightGallery(album, {
3521				dynamic: true,
3522				plugins: lgPlugins,
3523				dynamicEl: JSON.parse(params),
3524				galleryId: galleryID,
3525				addClass: containerClass,
3526				mode: transition,
3527				thumbnail: ( typeof tmb == 'undefined' || !tmb ),
3528				iframeWidth: '848px',
3529				iframeMaxWidth: '90%',
3530				iframeMaxHeight: '90%',
3531				loadYouTubeThumbnail: false,
3532				autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ),
3533				// autoplayFirstVideo: false,
3534				pager: false,
3535				startClass: 'lg-start-opacity',
3536				zoomFromOrigin: false,
3537				controls: controls,
3538				download: ( typeof download != 'undefined' && download != '' ),
3539				thumbWidth: 50,
3540				thumbHeight: '50px',
3541				loadYouTubePoster: false,
3542				counter: counter
3543			});
3544
3545			$album.on('click', function(){
3546				gallery.openGallery(0);
3547			});
3548
3549			album.addEventListener('lgBeforeSlide', beforeSlide);
3550			album.addEventListener('lgBeforeOpen', beforeOpen);
3551			album.addEventListener('lgAfterOpen', function(){
3552				$(window).trigger('uncode-custom-cursor');
3553			});
3554
3555			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3556				window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
3557					$el = model.view.$el;
3558					if ( $el.find($album).length ) {
3559						gallery.destroy();
3560					}
3561				});
3562			}
3563
3564		});
3565
3566		//single images
3567		$('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) {
3568			var gallery = lightGallery( $('.page-wrapper')[0], {
3569				selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])',
3570				iframeWidth: '848px',
3571				iframeMaxWidth: '90%',
3572				iframeMaxHeight: '90%',
3573				loadYouTubeThumbnail: false,
3574				// autoplayFirstVideo: false,
3575				startClass: 'lg-start-opacity',
3576				thumbWidth: 50,
3577				thumbHeight: '50px',
3578				download: false,
3579				loadYouTubePoster: false,
3580				counter: false
3581			});
3582
3583			$('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide);
3584			$('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen);
3585		});
3586	}
3587
3588	var onGalleryEsc = function(e){
3589		if (e.keyCode === 27 || e.key === 'Escape' || e.keyCode === 90 || e.key === 'z') {
3590			if (document.fullscreenElement) {
3591				document.exitFullscreen()
3592			} else {
3593				document.documentElement.requestFullscreen();
3594			}
3595		}
3596	};
3597	window.addEventListener('keydown', onGalleryEsc, { once: true });
3598
3599	$(document).on(
3600		'webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange',
3601		function(e){
3602			if ( e.target.tagName === 'IFRAME' ) {
3603				window.addEventListener('keydown', onGalleryEsc, { once: true });
3604			}
3605		}
3606	);
3607};
3608
3609UNCODE.carousel = function(container) {
3610	var $owlContainers = $('.owl-carousel-container', container);
3611	$owlContainers.each(function() {
3612		var $owlContainer = $(this),
3613			$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
3614			$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
3615			values = {},
3616			tempTimeStamp,
3617			newWidth = UNCODE.wwidth,
3618			$owlInsideEqual = [];
3619		$owlSelector.each(function() {
3620			var itemID = $(this).attr('id'),
3621				$elSelector = $(('#' + itemID).toString());
3622			values['id'] = itemID;
3623			values['items'] = 1;
3624			values['columns'] = 3;
3625			values['fade'] = false;
3626			values['nav'] = false;
3627			values['navmobile'] = false;
3628			values['navskin'] = 'light';
3629			values['navspeed'] = 400;
3630			values['dots'] = false;
3631			values['dotsmobile'] = false;
3632			values['loop'] = false;
3633			values['autoplay'] = false;
3634			values['timeout'] = 3000;
3635			values['autoheight'] = false;
3636			values['stagepadding'] = 0;
3637			values['margin'] = 0;
3638			values['lg'] = 1;
3639			values['md'] = 1;
3640			values['sm'] = 1;
3641			$.each($(this).data(), function(i, v) {
3642				values[i] = v;
3643			});
3644
3645			if ($(this).closest('.uncode-slider').length) {
3646				values['navskin'] = '';
3647				values['navmobile'] = false;
3648				//values['dotsmobile'] = true;
3649			} else {
3650				values['navskin'] = ' style-'+values['navskin']+' style-override';
3651			}
3652
3653			var setIndexActive = function(event, init){
3654				var init = typeof init === 'undefined' ? false : init,
3655					thiis = $(event.currentTarget);
3656				if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
3657					var scrolltop = $(document).scrollTop(),
3658						size = event.page.size,
3659						i;
3660					var setIndex = requestTimeout(function() {
3661						for ( i = 0; i < size; i++ ) {
3662							var itemCont = event.item.index != null ? (event.item.index + i) : i;
3663							var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
3664							if (thiis.closest('.row-slider').length) {
3665								if (currentItem == undefined) {
3666									currentItem = thiis.children()[i];
3667								}
3668								if ($(currentItem).closest('#page-header').length) {
3669									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
3670										UNCODE.switchColorsMenu(scrolltop, 'dark');
3671									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
3672										UNCODE.switchColorsMenu(scrolltop, 'light');
3673									}
3674								}
3675							}
3676							var itendIndex = $(currentItem).attr('data-index');
3677							if ( isNaN(itendIndex) ) {
3678								itendIndex = 1;
3679							}
3680							$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
3681							$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
3682							if ($.fn.counterUp) {
3683								$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){
3684									var $counter = $(this);
3685									$counter.addClass('started').counterUp({
3686										delay: 10,
3687										time: 1500
3688									});
3689								});
3690							}
3691						}
3692						$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
3693					}, 200);
3694				}
3695				tempTimeStamp = event.timeStamp;
3696			}
3697
3698			/** Initialized */
3699			$elSelector.on('initialized.owl.carousel', function(event) {
3700
3701				if ( $('.isotope-container', event.currentTarget).length ) {
3702					window.dispatchEvent(UNCODE.boxEvent);
3703				}
3704
3705				$('.owl-dot.active', $elSelector).on('click', function(){
3706					return false;
3707				});
3708
3709				var thiis = $(event.currentTarget),
3710					// get the time from the data method
3711					time = thiis.data("timer-id"),
3712					rowParent = thiis.closest('.row-parent');
3713
3714				if ( typeof rowParent[0] !== 'undefined' ) {
3715					rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
3716				}
3717
3718				if (time) {
3719					clearRequestTimeout(time);
3720				}
3721
3722				thiis.addClass('showControls');
3723				var new_time = requestTimeout(function() {
3724					thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
3725					if (thiis.hasClass('owl-height-viewport'))
3726						setItemsRelHeight(thiis);
3727					if (thiis.hasClass('owl-height-equal'))
3728						setItemsHeight(thiis);
3729					if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
3730					if (thiis.closest('.unequal, .unexpand').length) {
3731						UNCODE.setRowHeight(rowParent[0], true);
3732					}
3733					if (SiteParameters.dynamic_srcset_active === '1') {
3734						UNCODE.refresh_dynamic_srcset_size(thiis);
3735					}
3736				}, 350);
3737				// save the new time
3738				thiis.data("timer-id", new_time);
3739
3740				var scrolltop = $(document).scrollTop();
3741				thiis.closest('.uncode-slider').find('video').removeAttr('poster');
3742
3743				//if (!UNCODE.isMobile) {
3744					/** fix autoplay when visible **/
3745				$(window).on('load', function(){
3746					if (thiis.data('autoplay')) {
3747						if ( !thiis.closest('.sticky-element').length ) {
3748							thiis.trigger('stop.autoplay.owl');
3749						} else {
3750							thiis.trigger('play.owl.autoplay');
3751						}
3752					}
3753					if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) {
3754						return;
3755					}
3756					if ( ! thiis.closest('.sticky-element').length ) {
3757						var carouselInView = new Waypoint.Inview({
3758							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3759							element: thiis[0],
3760							exited: function() {
3761								var el = $(this.element);
3762								if (el.data('autoplay') ) {
3763									el.trigger('stop.owl.autoplay');
3764									el.data('stopped','true');
3765								}
3766							},
3767							enter: function(direction) {
3768								var el = $(this.element);
3769								requestTimeout(function() {
3770									if (el.data('autoplay')) {
3771										el.trigger('play.owl.autoplay');
3772										el.data('stopped','false');
3773									}
3774								}, 100);
3775							}
3776						});
3777					}
3778				});
3779				//}
3780
3781				// $(window).on('frontend:carousel_updated', function(){
3782				// 	Waypoint.refreshAll();
3783				// });
3784
3785				if (!thiis.closest('.isotope-system').length) {
3786					requestTimeout(function() {
3787						animate_thumb($('.t-inside', el), event);
3788					}, 400);
3789				} else {
3790					requestTimeout(function() {
3791						thiis.closest('.isotope-container').isotope('layout');
3792					}, 400);
3793				}
3794
3795				var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
3796				currentIndex = $(currentItem).attr('data-index');
3797
3798				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
3799					if ($(val).closest('.uncode-slider').length) {
3800						$(val).removeClass('start_animation');
3801					}
3802				});
3803				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
3804					if ($(val).closest('.uncode-slider').length) {
3805						$(val).removeClass('already-animated');
3806					}
3807				});
3808
3809				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
3810					if ($(val).closest('.uncode-slider').length) {
3811						$(val).removeAttr('data-animated');
3812					}
3813				});
3814
3815				$.each($('.owl-item.cloned', thiis), function(index, val) {
3816					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
3817				});
3818
3819				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
3820					if ($(val).attr('data-index') != currentIndex) {
3821						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
3822						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
3823					}
3824					if ($(val).attr('data-index') != currentIndex) {
3825						$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
3826					}
3827					if ($(val).attr('data-index') == currentIndex) {
3828						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
3829					}
3830				});
3831
3832				if (thiis.closest('.uncode-slider').length) {
3833					var el = thiis.closest('.row-parent')[0];
3834					if ($(el).data('imgready')) {
3835						firstLoaded(el, event);
3836					} else {
3837						el.addEventListener("imgLoaded", function(el) {
3838							firstLoaded(el.target, event);
3839						}, false);
3840					}
3841					var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
3842					if (transHeight != null) {
3843						requestTimeout(function() {
3844							thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
3845						}, 100);
3846					}
3847				} else {
3848					var el = thiis;
3849					el.closest('.uncode-slider').addClass('slider-loaded');
3850				}
3851
3852				requestTimeout(function() {
3853					if (typeof UNCODE.bigText !== 'undefined') {
3854						UNCODE.bigText(thiis);
3855					}
3856					if (thiis.closest('.uncode-slider').length) {
3857						if (thiis.data('autoplay')) pauseOnHover(thiis);
3858					}
3859				}, 500);
3860
3861				if (thiis.closest('.unequal').length) {
3862					$owlInsideEqual.push(thiis.closest('.row-parent'));
3863				}
3864
3865				var containerClasses = '',
3866					containerStyle = '';
3867				if ( $('.owl-dots-classes', $owlContainer).length ) {
3868					containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
3869					containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
3870					$('.owl-dots-classes', $owlContainer).remove();
3871				}
3872
3873				if ( containerClasses !== '' ) {
3874					requestTimeout(function() {
3875						if ( containerClasses !== '' )
3876							$('.owl-dots', $owlContainer).attr('style', containerStyle);
3877						if ( containerStyle !== '' )
3878							$('.owl-dots', $owlContainer).addClass(containerClasses);
3879					}, 100);
3880				}
3881
3882				$.each($('.column_child.pos-bottom', thiis), function(index, val) {
3883					$(val).closest('.row-inner').css({
3884						'margin-top': '-1px'
3885					});
3886				});
3887
3888				if ($.fn.isotope) {
3889					if ( thiis.closest('.isotope-container').length ) {
3890						if (thiis.closest('.isotope-container').data('isotope')) {
3891							requestTimeout(function(){
3892								thiis.closest('.isotope-container').isotope('layout');
3893							}, 300);
3894						}
3895						$(window).on('load', function(){
3896							if (thiis.closest('.isotope-container').data('isotope')) {
3897								thiis.closest('.isotope-container').isotope('layout');
3898							}
3899						});
3900					}
3901				}
3902
3903				if (thiis.data('autoplay')) {
3904					$(window).on('menuOpen', function(){
3905						thiis.trigger('stop.owl.autoplay');
3906						thiis.data('stopped','true');
3907					}).on('menuClose', function(){
3908
3909					});
3910				}
3911				$(window).on('menuClose', function(){
3912					if (thiis.data('autoplay')) {
3913						thiis.trigger('play.owl.autoplay');
3914						thiis.data('stopped','false');
3915					}
3916				});
3917
3918				setIndexActive(event, true);
3919
3920				var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
3921						return !$(this).closest('.nested-carousel').length;
3922					}),
3923					$_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),
3924					$galleries = $_galleries.filter(function( index ) {
3925						return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
3926					});
3927
3928				if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
3929					UNCODE.lightgallery( $galleries );
3930				}
3931
3932
3933			});
3934
3935			$elSelector.on('resized.owl.carousel', function(event) {
3936				var thiis = $(event.currentTarget);
3937				// if ($(this).closest('.nested-carousel').length) {
3938				// 	requestTimeout(function() {
3939				// 		window.dispatchEvent(UNCODE.boxEvent);
3940				// 	}, 200);
3941				// }
3942				if ( thiis.hasClass('owl-height-equal') )
3943					setItemsHeight(thiis);
3944
3945				if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
3946					newWidth = UNCODE.wwidth;
3947					setItemsRelHeight($elSelector);
3948				}
3949
3950				setIndexActive(event);
3951
3952				if (SiteParameters.dynamic_srcset_active === '1') {
3953					UNCODE.refresh_dynamic_srcset_size(thiis);
3954				}
3955
3956				if ($.fn.isotope) {
3957					$(window).on('load', function(){
3958						if ($(event.currentTarget).closest('.isotope-container').data('isotope')) {
3959							$(event.currentTarget).closest('.isotope-container').isotope('layout');
3960						}
3961					});
3962				}
3963			});
3964
3965			/** detect resize window for fluid height layout */
3966			var setFluidResize;
3967			function manageFluidCarouseHeight() {
3968				clearRequestTimeout(setFluidResize);
3969				setFluidResize = requestTimeout(function(){
3970					if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
3971						newWidth = UNCODE.wwidth;
3972						setItemsRelHeight($elSelector);
3973					}
3974				}, 100);
3975			}
3976			window.addEventListener('resize', manageFluidCarouseHeight);
3977
3978			/** Change */
3979			$elSelector.on('change.owl.carousel', function(event) {
3980				if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
3981			});
3982
3983			/** Changed */
3984			$elSelector.on('changed.owl.carousel', function(event) {
3985				var $row = $elSelector.parents('.row')[0];
3986				if ( typeof $row !== 'undefined' ) {
3987					$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
3988				}
3989				setIndexActive(event);
3990			});
3991
3992			var checkDrag = function(e) {
3993				$elSelector.addClass('owl-dragging');
3994			};
3995			$elSelector.on('drag.owl.carousel', function(event) {
3996				document.addEventListener("mousemove", checkDrag);
3997			});
3998
3999			$elSelector.on('dragged.owl.carousel', function(event) {
4000				$elSelector.removeClass('owl-dragging');
4001				document.removeEventListener("mousemove", checkDrag);
4002			});
4003
4004			$elSelector.on('translate.owl.carousel', function(event) {
4005				if (UNCODE.isMobile) {
4006					$(event.currentTarget).addClass('owl-translating');
4007				}
4008			});
4009
4010			/** Translated */
4011			$elSelector.on('translated.owl.carousel', function(event) {
4012
4013				var thiis = $(event.currentTarget),
4014					currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4015					currentIndex = $(currentItem).attr('data-index'),
4016					stagePadding = thiis.data('stagepadding');
4017
4018				stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4019
4020				if (!UNCODE.isMobile) {
4021					UNCODE.owlPlayVideo(thiis);
4022				}
4023
4024				requestTimeout(function(){
4025					var lastDelayElems = animate_elems($('.owl-item.index-active', thiis));
4026					var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event);
4027					if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) {
4028						if (lastDelayElems == undefined) lastDelayElems = 0;
4029						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4030						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4031						thiis.trigger('stop.owl.autoplay');
4032						requestTimeout(function() {
4033							if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay');
4034						}, maxDelay);
4035					}
4036				}, 200);
4037
4038				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4039					if ($(val).closest('.uncode-slider').length) {
4040						$(val).removeClass('start_animation');
4041					}
4042				});
4043
4044				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4045					if ($(val).closest('.uncode-slider').length) {
4046						$(val).removeClass('already-animated');
4047					}
4048				});
4049
4050				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4051					if ($(val).closest('.uncode-slider').length) {
4052						$(val).removeAttr('data-animated');
4053					}
4054				});
4055
4056				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4057					if ($(val).attr('data-index') != currentIndex) {
4058						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4059						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4060					}
4061					if ($(val).attr('data-index') != currentIndex) {
4062						$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
4063					}
4064					if ($(val).attr('data-index') == currentIndex) {
4065						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4066					}
4067				});
4068
4069				if (UNCODE.isMobile) {
4070					thiis.removeClass('owl-translating');
4071				}
4072
4073				setIndexActive(event);
4074			});
4075
4076			if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
4077
4078			/** Init carousel */
4079			$elSelector.not('.showControls').owlCarousel({
4080				items: values['items'],
4081				animateIn: (values['fade'] == true) ? 'fadeIn' : null,
4082				animateOut: (values['fade'] == true) ? 'fadeOut' : null,
4083				nav: values['nav'],
4084				dots: values['dots'],
4085				loop: values['loop'],
4086				stagePadding: values['stagepadding'],
4087				margin: 0,
4088				video: true,
4089				autoWidth: false,
4090				autoplay: false,
4091				autoplayTimeout: values['timeout'],
4092				autoplaySpeed: values['navspeed'],
4093				autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true,
4094				autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ),
4095				rtl: $('body').hasClass('rtl') ? true : false,
4096				fluidSpeed: true,
4097				navSpeed: values['navspeed'],
4098				dotsSpeed: values['navspeed'] / values['items'],
4099				navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
4100				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>'],
4101				navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
4102				responsiveClass: true,
4103				responsiveBaseElement: '.box-container',
4104				responsive: {
4105					0: {
4106						items: values['sm'],
4107						nav: values['navmobile'],
4108						dots: values['dotsmobile'],
4109						dotsSpeed: values['navspeed'] / values['sm'],
4110					},
4111					480: {
4112						items: values['sm'],
4113						nav: values['navmobile'],
4114						dots: values['dotsmobile'],
4115						dotsSpeed: values['navspeed'] / values['sm'],
4116					},
4117					570: {
4118						items: values['md'],
4119						nav: values['navmobile'],
4120						dots: values['dotsmobile'],
4121						dotsSpeed: values['navspeed'] / values['md'],
4122					},
4123					960: {
4124						items: values['lg'],
4125						dotsSpeed: values['navspeed'] / values['lg'],
4126					}
4127				}
4128			});
4129
4130			var transDuration = parseFloat(values['navspeed']) * 0.3;
4131			var transDuration2 = parseFloat(values['navspeed']) * 0.8;
4132
4133			$('.owl-item .tmb', $elSelector).css({
4134				'-webkit-transition-delay': transDuration + 'ms',
4135				'-moz-transition-delay': transDuration + 'ms',
4136				'-o-transition-delay': transDuration + 'ms',
4137				'transition-delay': transDuration + 'ms',
4138				'-webkit-transition-duration': transDuration2 + 'ms',
4139				'-moz-transition-duration': transDuration2 + 'ms',
4140				'-o-transition-duration': transDuration2 + 'ms',
4141				'transition-duration': transDuration2 + 'ms',
4142			});
4143
4144			requestTimeout(function() {
4145				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4146					UNCODE.setRowHeight($owlInsideEqual[i]);
4147				};
4148			}, 300);
4149
4150			$(window).on('load', function(){
4151				var $elCarousel = $elSelector.data('owl.carousel');
4152				if ( typeof $elCarousel !== 'undefined' ) {
4153					$elCarousel.trigger('refreshed');
4154					for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4155						UNCODE.setRowHeight($owlInsideEqual[i]);
4156					};
4157				}
4158			});
4159
4160			$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
4161				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4162					$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
4163					$('#' + carousel_id).find('.owl-item').each( function() {
4164						var $item = $(this),
4165							index = ( $item.index() + 1 );
4166						$item.attr('data-index', index);
4167					});
4168				}
4169			});
4170
4171			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4172				window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
4173					if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4174						$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
4175						$('#' + carousel_id).find('.owl-item').each( function() {
4176							var $item = $(this),
4177								index = ( $item.index() + 1 );
4178							$item.attr('data-index', index);
4179						});
4180					}
4181				});
4182			}
4183
4184		});
4185
4186		function firstLoaded(el, event) {
4187			var el = $(el),
4188			uncode_slider = el.find('.uncode-slider');
4189			el.find('.owl-carousel').css('opacity', 1);
4190			uncode_slider.addClass('slider-loaded');
4191			if (typeof UNCODE.bigText !== 'undefined') {
4192				UNCODE.bigText(el.find('.owl-item.active'));
4193			}
4194			//if (!UNCODE.isMobile) {
4195				requestTimeout(function() {
4196					var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
4197					var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
4198					if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
4199						if (lastDelayElems == undefined) lastDelayElems = 0;
4200						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4201						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4202						$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
4203						requestTimeout(function() {
4204							$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
4205						}, maxDelay);
4206					}
4207				}, 500);
4208
4209			//}
4210		}
4211
4212		function navHover(el) {
4213			var $owlCont = el,
4214				$owlPrev = $owlCont.find('.owl-prev'),
4215				$owlNext = $owlCont.find('.owl-next'),
4216				$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
4217				$owlPagination = $owlCont.next(),
4218				owlPrevW = $owlPrev.outerWidth(),
4219				owlNextW = $owlNext.outerWidth(),
4220				owlDotsH = $owlDots.innerHeight(),
4221				owlTime = 400,
4222				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4223			if ( $('body').hasClass('rtl') ) {
4224				$owlPrev.css("margin-right", -owlPrevW);
4225				$owlNext.css("margin-left", -owlNextW);
4226			} else {
4227				$owlPrev.css("margin-left", -owlPrevW);
4228				$owlNext.css("margin-right", -owlNextW);
4229			}
4230			if (!owlNested) $owlDots.css("bottom", -owlDotsH);
4231			$owlCont.mouseenter(function() {
4232				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4233				$owlPrev.add($owlNext).css({
4234					marginLeft: 0,
4235					marginRight: 0
4236				});
4237				if (!owlNested) {
4238					$owlDots.css({
4239						opacity: 1,
4240						bottom: 0
4241					});
4242				}
4243			}).mouseleave(function() {
4244				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4245				if ( $('body').hasClass('rtl') ) {
4246					$owlPrev.css("margin-right", -owlPrevW);
4247					$owlNext.css("margin-left", -owlNextW);
4248				} else {
4249					$owlPrev.css("margin-left", -owlPrevW);
4250					$owlNext.css("margin-right", -owlNextW);
4251				}
4252				if (!owlNested) {
4253					$owlDots.css({
4254						opacity: 1,
4255						bottom: -owlDotsH
4256					});
4257				}
4258			});
4259		};
4260
4261		function animate_elems($this) {
4262			var lastDelay;
4263			$.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) {
4264				var element = $(val),
4265					delayAttr = element.attr('data-delay'),
4266					$first_item = element.closest('.owl-item[data-index="1"]');
4267
4268				if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
4269					return false;
4270				}
4271
4272				if (delayAttr == undefined) delayAttr = 0;
4273				requestTimeout(function() {
4274					element.addClass('start_animation');
4275				}, delayAttr);
4276				lastDelay = delayAttr;
4277			});
4278			return lastDelay;
4279		}
4280
4281		function animate_thumb(items, event) {
4282			var lastDelay,
4283				itemIndex,
4284				thiis = $(event.currentTarget),
4285				tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'),
4286				numActives = $('.owl-item.active', thiis).length,
4287				stagePadding = thiis.data('stagepadding');
4288
4289			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4290
4291			thiis.data('tempIndex', event.item.index);
4292				$.each(items, function(index, val) {
4293					var parent = $(val).closest('.owl-item');
4294					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4295						return;
4296					}
4297					if (!$(val).hasClass('start_animation')) {
4298						if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
4299							var thumbInView = new Waypoint.Inview({
4300							  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4301							  element: val,
4302							  enter: function(direction) {
4303								var element = $(this.element),
4304										delayAttr = parseInt(element.attr('data-delay')),
4305										itemIndex = element.closest('.owl-item').index() + 1,
4306										diffItem = Math.abs(itemIndex - tempIndex) - 1;
4307									if (itemIndex > tempIndex) {
4308										thiis.data('tempIndex', itemIndex);
4309									}
4310									if (isNaN(delayAttr)) delayAttr = 100;
4311									if (stagePadding) {
4312										var objTimeout = requestTimeout(function() {
4313											element.addClass('start_animation');
4314										}, index * delayAttr);
4315										lastDelay = index * delayAttr;
4316									} else {
4317										$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation');
4318										var objTimeout = requestTimeout(function() {
4319											element.addClass('start_animation');
4320										}, diffItem * delayAttr);
4321										lastDelay = diffItem * delayAttr;
4322									}
4323									parent.data('objTimeout', objTimeout);
4324									if (!UNCODE.isUnmodalOpen) {
4325										this.destroy();
4326									}
4327								}
4328							});
4329						}
4330					}
4331				});
4332				return lastDelay;
4333			}
4334
4335		function setItemsHeight(item) {
4336			$.each($('.owl-item', item), function(index, val) {
4337				var availableThumbHeight = $('.t-inside', $(val)).height(),
4338				innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
4339				difference = availableThumbHeight - innerThumbHeight;
4340				if ($('.tmb-content-under', val).length) {
4341					var visualPart = $('.t-entry-visual', val);
4342					if (visualPart.length) {
4343						difference -= $('.t-entry-visual', val).height();
4344					}
4345				}
4346				if (! $('.tmb-content-lateral', val).length)
4347					$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
4348			});
4349		}
4350
4351		function setItemsRelHeight(item) {
4352			$.each($('.owl-item', item), function(index, val) {
4353				var $rowContainer = $(item).parents('.row-parent').eq(0),
4354					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
4355					$colContainer = $(item).parents('.uncell').eq(0),
4356					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
4357					winHeight = UNCODE.wheight,
4358					multiplier_h = parseInt($(item).attr('data-vp-height')),
4359					data_viewport_h,
4360					consider_menu = $(item).data('vp-menu');
4361
4362				if ( consider_menu ) {
4363					winHeight = winHeight - UNCODE.menuHeight;
4364				}
4365
4366				data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
4367				$('.t-inside', val).css( 'height', data_viewport_h );
4368			});
4369		}
4370
4371		function pauseOnHover(slider) {
4372			$('.owl-dots, .owl-prev, .owl-next', slider).on({
4373				mouseenter: function () {
4374					$(slider).addClass('owl-mouseenter');
4375					$(slider).trigger('stop.owl.autoplay');
4376				},
4377				mouseleave: function () {
4378					$(slider).removeClass('owl-mouseenter');
4379					$(slider).trigger('play.owl.autoplay');
4380				}
4381			});
4382		}
4383	});
4384};
4385
4386UNCODE.owlPlayVideo = function(carousel) {
4387	var player, iframe;
4388	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
4389		var content = $(val).html();
4390		if (content == '') {
4391			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
4392			$(val).append(getCloned);
4393		}
4394		if ($(this).attr('data-provider') == 'vimeo') {
4395			iframe = $(this).find('iframe');
4396			player = new Vimeo.Player(iframe[0]);
4397			player.play();
4398		} else if ($(this).attr('data-provider') == 'youtube') {
4399			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
4400		} else {
4401			var player = $(this).find('video');
4402			if (player.length) {
4403				$(this).find('video')[0].volume = 0;
4404				$(this).find('video')[0].play();
4405				$(val).css('opacity', 1);
4406			}
4407		}
4408	});
4409};
4410
4411UNCODE.owlStopVideo = function(carousel) {
4412	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
4413		var player, iframe;
4414		if ($(this).attr('data-provider') == 'vimeo') {
4415			iframe = $(this).find('iframe');
4416			player = new Vimeo.Player(iframe[0]);
4417			player.pause();
4418		} else if ($(this).attr('data-provider') == 'youtube') {
4419			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
4420		} else {
4421			var player = $(this).find('video');
4422			if (player.length) {
4423				$(this).find('video')[0].volume = 0;
4424				$(this).find('video')[0].play();
4425			}
4426		}
4427	});
4428};
4429
4430UNCODE.animations = function() {
4431
4432	var runWaypoints_TO,
4433		runWaypoints_carousel_TO,
4434		runWaypoints_delay = 0,
4435	highlightComplexFunc = function($wrap, ev){
4436
4437		var $lines = $('.heading-line-wrap', $wrap),
4438			not_animate = false;
4439
4440		if ( $wrap.data('animate') === true ) {
4441			not_animate = true;
4442		}
4443
4444		var $rotatingTxt = $('.uncode-rotating-text-start', $wrap);
4445		if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) {
4446			return;
4447		}
4448
4449		$lines.each(function(_key, _value){
4450			var $line = $(_value),
4451				$inners = $('.split-word-inner', $line),
4452				$highlights = $('.heading-text-highlight-inner', $line);
4453
4454			var highlitInnerFunc = function(ev){
4455				var delay = 0;
4456				$highlights.each(function(h_key, high){
4457					var $highlight = $(high),
4458						$split = $highlight.closest('.split-word:not(.uncode-rotating-span)'),
4459						$nextSplit = $split.nextUntil(),
4460						$next = $('.heading-text-highlight-inner', $nextSplit),
4461						countCh = $split.text().length;
4462
4463					$highlight.css({
4464						'-webkit-transition-duration': (30 * countCh) + 'ms',
4465						'-moz-transition-duration': (30 * countCh) + 'ms',
4466						'-o-transition-duration': (30 * countCh) + 'ms',
4467						'transition-duration': (30 * countCh) + 'ms',
4468					});
4469
4470					delay += (30 * countCh);
4471
4472					$next.css({
4473						'-webkit-transition-delay': delay + 'ms',
4474						'-moz-transition-delay': delay + 'ms',
4475						'-o-transition-delay': delay + 'ms',
4476						'transition-delay': delay + 'ms',
4477					});
4478				});
4479				$highlights.removeAttr('data-animated');
4480				if ( _key+1 === $lines.length ) {
4481					$wrap.data('animate', true);
4482				}
4483			};
4484
4485			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
4486				if ( not_animate ) {
4487					$highlights.each(function(h_key, high){
4488						var $highlight = $(high);
4489						$highlight.css({
4490							'-webkit-transition-duration': '0ms',
4491							'-moz-transition-duration': '0ms',
4492							'-o-transition-duration': '0ms',
4493							'transition-duration': '0ms',
4494						});
4495					});
4496					$highlights.removeAttr('data-animated');
4497				} else {
4498					if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) {
4499						highlitInnerFunc();
4500					} else {
4501						$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc);
4502					}
4503				}
4504			}
4505		});
4506	};
4507
4508	$.each($('.header-content-inner'), function(index, val) {
4509		var element = $(val),
4510			transition = '';
4511		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
4512		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
4513		if (element.hasClass('left-t-right')) transition = 'left-t-right';
4514		if (element.hasClass('right-t-left')) transition = 'right-t-left';
4515		if (element.hasClass('zoom-in')) transition = 'zoom-in';
4516		if (element.hasClass('zoom-out')) transition = 'zoom-out';
4517		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
4518		if (transition != '') {
4519			$(val).removeClass(transition);
4520			var container = element,
4521				containerDelay = container.attr('data-delay'),
4522				containerSpeed = container.attr('data-speed'),
4523				items = $('.header-title > *, .post-info', container);
4524			$.each(items, function(index, val) {
4525				var element = $(val),
4526					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
4527					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
4528				if (!element.hasClass('animate_when_almost_visible')) {
4529					delayAttr = Number(delayAttr) + (400 * index);
4530					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
4531					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
4532				}
4533			});
4534			container.css('opacity', 1);
4535		}
4536	});
4537
4538	function animate_css_grids_on_load() {
4539		$('.cssgrid-system').each(function() {
4540			var grid = $(this);
4541			var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false;
4542			UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false);
4543		});
4544	}
4545
4546	window.waypoint_animation = function(ev) {
4547		$.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) {
4548			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 ) ) {
4549				return true;
4550			}
4551			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4552				return;
4553			}
4554			var run = true,
4555				$carousel = $(val).closest('.owl-carousel');
4556			if ( $carousel.length ) {
4557				run = false;
4558			}
4559			if (run) {
4560				new Waypoint({
4561					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4562					element: val,
4563					handler: function() {
4564						var element = $(this.element),
4565							index = element.index(),
4566							delayAttr = element.attr('data-delay');
4567						if (delayAttr == undefined) delayAttr = 0;
4568						requestTimeout(function() {
4569							element.addClass('start_animation');
4570						}, delayAttr);
4571						if (!UNCODE.isUnmodalOpen) {
4572							this.destroy();
4573						}
4574					},
4575					offset: UNCODE.isFullPage ? '100%' : '90%'
4576				});
4577			}
4578		});
4579		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
4580			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4581				return;
4582			}
4583			var run = true,
4584				$carousel = $(val).closest('.owl-carousel');
4585			if ( $carousel.length ) {
4586				run = false;
4587			}
4588			if (run) {
4589				new Waypoint({
4590					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4591					element: val,
4592					handler: function() {
4593						var $element = $(this.element),
4594							$childs = $('.animate_when_parent_almost_visible', $element);
4595						$childs.each(function(key,el){
4596							var $child = $(el),
4597								delaySpeed = $child.attr('data-speed'),
4598								delayAttr = $child.attr('data-delay'),
4599								intervalAttr = $child.attr('data-interval');
4600							if (delayAttr == undefined) {
4601								delayAttr = 50*key;
4602							}
4603							requestTimeout(function() {
4604								$child.addClass('start_animation');
4605								if ( $child.hasClass('anim-line-checker') ) {
4606									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4607										var $line = $child.closest('.heading-line-wrap');
4608									});
4609								}
4610								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
4611								highlightComplexFunc($wrapText, ev);
4612								if ( $child.hasClass('anim-tot-checker') ) {
4613									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4614										if ( $child.hasClass('anim-tot-checker') ) {
4615											$wrapText.addClass('already-animated');
4616											$element.trigger('already-animated');
4617										}
4618									});
4619								}
4620							}, delayAttr );
4621						});
4622						$element.addClass('start_animation');
4623						if (!UNCODE.isUnmodalOpen) {
4624							this.destroy();
4625						}
4626					},
4627					offset: UNCODE.isFullPage ? '100%' : '90%'
4628				});
4629			}
4630		});
4631	}
4632	window.waypoint_carousel_animation = function(ev) {
4633		$.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) {
4634			if ( $(val).hasClass('el-text-split') ) {
4635				return true;
4636			}
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							index = element.index(),
4654							delayAttr = element.attr('data-delay');
4655						if (delayAttr == undefined) delayAttr = 0;
4656						requestTimeout(function() {
4657							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
4658								$all_first.attr('data-already-reached', 'true');
4659							}
4660							element.addClass('start_animation');
4661						}, delayAttr);
4662						if (!UNCODE.isUnmodalOpen) {
4663							this.destroy();
4664						}
4665					},
4666					offset: UNCODE.isFullPage ? '100%' : '90%'
4667				});
4668			}
4669		});
4670		$.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) {
4671			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4672				return;
4673			}
4674			var run = true,
4675				$carousel = $(val).closest('.owl-carousel'),
4676				$first_item = $(val).closest('.owl-item[data-index="1"]'),
4677				$all_first = $('.owl-item[data-index="1"]', $carousel);
4678			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
4679				run = false;
4680			}
4681			if (run) {
4682				new Waypoint({
4683					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4684					element: val,
4685					handler: function() {
4686						var $element = $(this.element),
4687							$childs = $('.animate_when_parent_almost_visible', $element);
4688						$childs.each(function(key,el){
4689							var $child = $(el),
4690								delaySpeed = $child.attr('data-speed'),
4691								delayAttr = $child.attr('data-delay'),
4692								intervalAttr = $child.attr('data-interval');
4693							if (delayAttr == undefined) {
4694								delayAttr = 50*key;
4695							}
4696							requestTimeout(function() {
4697								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
4698									$all_first.attr('data-already-reached', 'true');
4699								}
4700								$child.addClass('start_animation');
4701								if ( $child.hasClass('anim-line-checker') ) {
4702									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4703										var $line = $child.closest('.heading-line-wrap');
4704									});
4705								}
4706								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
4707								highlightComplexFunc($wrapText, ev);
4708								if ( $child.hasClass('anim-tot-checker') ) {
4709									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4710										if ( $child.hasClass('anim-tot-checker') ) {
4711											$wrapText.addClass('already-animated');
4712										}
4713									});
4714								}
4715							}, delayAttr );
4716						});
4717						$element.addClass('start_animation');
4718						if (!UNCODE.isUnmodalOpen) {
4719							this.destroy();
4720						}
4721					},
4722					offset: UNCODE.isFullPage ? '100%' : '90%'
4723				});
4724			}
4725		});
4726	}
4727
4728	var runWaypoints = function(ev){
4729		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
4730			runWaypoints_delay = 400;
4731		}
4732		clearRequestTimeout(runWaypoints_TO);
4733		runWaypoints_TO = requestTimeout(function() {
4734			window.waypoint_animation(ev);
4735		}, runWaypoints_delay);
4736
4737		clearRequestTimeout(runWaypoints_carousel_TO);
4738		runWaypoints_carousel_TO = requestTimeout(function() {
4739			window.waypoint_carousel_animation(ev);
4740		}, 400);
4741	};
4742	runWaypoints();
4743	animate_css_grids_on_load();
4744
4745	$( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) {
4746		runWaypoints(ev);
4747	});
4748	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4749		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
4750	}
4751};
4752
4753UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) {
4754	var $allItems = elements.length - startIndex,
4755		showed = 0,
4756		index = 0,
4757		use_index = false
4758		;
4759
4760	if (filtering) {
4761		if (sequential) {
4762			use_index = true;
4763		}
4764		sequential = false;
4765	}
4766
4767	$.each(elements, function(index, val) {
4768		var $this = $(val),
4769			elInner = $('> .t-inside', val);
4770
4771		if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4772			return;
4773		}
4774		if (val[0]) val = val[0];
4775
4776		if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
4777			new Waypoint({
4778				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4779				element: val,
4780				handler: function() {
4781					var element = $('> .t-inside', this.element),
4782						parent = $(this.element);
4783					var _index = use_index? index : 0;
4784
4785					var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index),
4786						delayAttr = parseInt(element.attr('data-delay'));
4787					if (isNaN(delayAttr)) delayAttr = 100;
4788					if (sequential || use_index) {
4789						delay -= showed;
4790					}
4791					var objTimeout = requestTimeout(function() {
4792						element.removeClass('zoom-reverse').addClass('start_animation');
4793						showed = index;
4794					}, delay * delayAttr);
4795					parent.data('objTimeout', objTimeout);
4796					if (!UNCODE.isUnmodalOpen) {
4797						this.destroy();
4798					}
4799				},
4800				offset: UNCODE.isFullPage ? '100%' : '90%'
4801			});
4802		}
4803
4804		index++;
4805	});
4806};
4807
4808UNCODE.tapHover = function() {
4809
4810	var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), //.length //html.touch a.btn
4811		elClass = "hover";
4812
4813	$(window).on('click', function() {
4814		$el.removeClass(elClass);
4815	});
4816
4817	$el.on("click", function(e) { // cambia click con touch start 'touchstart'
4818		e.stopPropagation();
4819		var link = $(this);
4820		if ( ! link.hasClass(elClass)) {
4821			e.preventDefault();
4822			link.addClass("hover");
4823			$el.not(this).removeClass(elClass);
4824			return false;
4825		}
4826	});
4827};
4828
4829UNCODE.onePage = function(isMobile) {
4830	var current = 0,
4831		last = 0,
4832		lastScrollTop = 0,
4833		forceScroll = false,
4834		lastScrolled = 0,
4835		isSectionscroller = ($('.main-onepage').length) ? true : false,
4836		isOnePage = false,
4837		getOffset = function () {
4838			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);
4839			return calculateOffset;
4840		}
4841
4842	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
4843	// 	return false;
4844
4845	function init_onepage() {
4846		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
4847			$("<ul class='onepage-pagination'></ul>").prependTo("body");
4848		}
4849		last = $('.onepage-pagination li').last().find('a').data('index');
4850		$.each($('div[data-parent="true"]'), function(index, val) {
4851			$(this).attr('data-section', index);
4852			if (isMobile) return;
4853			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4854				return;
4855			}
4856			var sectionDown = new Waypoint({
4857				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4858				element: val,
4859				handler: function(direction) {
4860					if (direction == 'down') {
4861						changeMenuActive(this.element, index);
4862					}
4863				},
4864				offset: function() {
4865					return 5 + getOffset()
4866				}
4867			});
4868			var sectionUp = new Waypoint({
4869				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4870				element: val,
4871				handler: function(direction) {
4872					if (direction == 'up') {
4873						changeMenuActive(this.element, index);
4874					}
4875				},
4876				offset: function() {
4877					return -5 - getOffset()
4878				}
4879			});
4880
4881			if (isSectionscroller) {
4882				var label;
4883				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
4884				else label = '';
4885				var getName = $(this).attr('data-name');
4886				if (getName == undefined) getName = index;
4887				if (label != '') {
4888					isOnePage = true;
4889					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
4890					$('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>");
4891				}
4892			}
4893		});
4894
4895		if (isSectionscroller) {
4896			$.each($('ul.onepage-pagination li'), function(index, val) {
4897				var $this = $(val),
4898					$a = ('a', $this);
4899				$a.on('click', function(evt) {
4900					if ( $('.is-selected', $this).length ) {
4901						return false;
4902					}
4903					if ( $('body').hasClass('uncode-scroll-no-history') ) {
4904						evt.preventDefault();
4905					}
4906					Waypoint.refreshAll();
4907					var el = $('a', evt.currentTarget);
4908					current = lastScrolled = parseInt(el.attr('data-index'));
4909					lastScrolled += 1;
4910					scrollBody(current);
4911				});
4912			});
4913		}
4914
4915		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
4916		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
4917			goToSection = String(window.location.hash).replace(/^#/, "");
4918			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
4919		}
4920
4921		if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) {
4922			current = lastScrolled = goToSection;
4923			$(window).on('load', function(){
4924				if ( $('.owl-carousel').length ) {
4925					requestTimeout(function(){
4926						scrollBody(goToSection);
4927					}, 400);
4928				} else {
4929					scrollBody(goToSection);
4930				}
4931			});
4932		}
4933
4934	}
4935
4936	function changeMenuActive(section, index) {
4937		current = lastScrolled = parseInt($(section).attr('data-section'));
4938		if (isOnePage) {
4939			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
4940			if (newSection.length) {
4941				$('ul.onepage-pagination li a').removeClass('is-selected');
4942				newSection.addClass('is-selected');
4943			}
4944			var getName = $('[data-section="' + index + '"]').attr('data-name');
4945			if (getName != undefined && getName !== '') {
4946				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
4947					var get_href = $(val).attr('href');
4948					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
4949						$(val).closest('.menu-smart').find('.active').removeClass('active');
4950						$(val).parent().addClass('active');
4951					}
4952				});
4953			}
4954		}
4955	}
4956
4957	if (isOnePage) {
4958		$(window).on('scroll', function() {
4959			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
4960			if (bodyTop == 0) {
4961				$('ul.onepage-pagination li a').removeClass('is-selected');
4962				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
4963				var getName = $('[data-section=0]').attr('data-name');
4964				if (getName != undefined && getName !== '') {
4965					$.each($('.menu-container .menu-item > a'), function(i, val) {
4966						var get_href = $(val).attr('href');
4967						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
4968							$(val).closest('ul').find('.active').removeClass('active');
4969							$(val).parent().addClass('active');
4970						}
4971					});
4972				}
4973			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
4974				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
4975				if (lastSection.length) {
4976					$('ul.onepage-pagination li a').removeClass('is-selected');
4977					lastSection.addClass('is-selected');
4978				}
4979			}
4980		});
4981	}
4982
4983	var scrollBody = function(index) {
4984		$('ul.onepage-pagination li a').removeClass('is-selected');
4985		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
4986
4987		var getSection = $('[data-section=' + index + ']'),
4988			scrollTo;
4989
4990		if (getSection == undefined) return;
4991
4992		var body = $("html, body"),
4993			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
4994			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
4995			getOffset = UNCODE.get_scroll_offset(index);
4996		if ( typeof getSection.offset() === 'undefined' )
4997			return;
4998		scrollTo = getSection.offset().top;
4999
5000		// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
5001		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
5002			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
5003			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
5004				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
5005			}
5006
5007			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
5008				if ( index === 0 ) {
5009					scrollTo = 0;
5010				} else {
5011					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
5012				}
5013			} else {
5014				scrollTo -= getOffset;
5015			}
5016		}
5017
5018		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
5019		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
5020
5021		if (index != 0) {
5022			UNCODE.scrolling = true;
5023		}
5024
5025		if (scrollSpeed == 0) {
5026			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
5027			UNCODE.scrolling = false;
5028		} else {
5029			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5030				$(this).stop();
5031			}).animate({
5032				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5033			}, scrollSpeed, 'easeInOutCubic', function() {
5034				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5035				UNCODE.scrolling = false;
5036				if  ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
5037				||
5038				$('.menu-hided').length ) {
5039					scrollTo = getSection.offset().top;
5040					getOffset = UNCODE.get_scroll_offset(index);
5041					scrollTo -= getOffset;
5042					body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5043						$(this).stop();
5044					}).animate({
5045						scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5046						}, scrollSpeed, 'easeInOutCubic', function() {
5047							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5048							UNCODE.scrolling = false;
5049						}
5050					);
5051				}
5052			});
5053		}
5054
5055	};
5056
5057	init_onepage();
5058};
5059
5060UNCODE.stickyElements = function() {
5061	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
5062	if (!isMobile_wide) {
5063
5064		var $pageHeader = $('#page-header'),
5065			$headerRow = $('.vc_row', $pageHeader),
5066			startSticky = false;
5067
5068		if ( $headerRow.hasClass('sticky-element') ) {
5069			$headerRow.removeClass('sticky-element');
5070			$pageHeader.addClass('sticky-element');
5071			startSticky = true;
5072		}
5073
5074		var calculateOffset = function(el) {
5075			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
5076				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
5077				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0,
5078				elTop = window.pageYOffset + el.getBoundingClientRect().top;
5079
5080			sideOffset += UNCODE.bodyBorder;
5081
5082			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
5083			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) {
5084				if ($('.menu-shrink').length) {
5085					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
5086				} else {
5087					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
5088				}
5089			}
5090
5091			return sideOffset;
5092
5093		},
5094
5095		initStickyElement = function($els) {
5096			if ( typeof $els === 'undefined' ) {
5097				$els = $('.sticky-element');
5098			}
5099			$.each($els, function(index, element) {
5100				if ($(element).closest('.tab-pane').length) {
5101					var $paneParent = $(element).closest('.tab-pane');
5102					if ( !$paneParent.hasClass('active') ) {
5103						return true;
5104					}
5105				}
5106				$(element).stick_in_parent({
5107					sticky_class: 'is_stucked',
5108					offset_top: calculateOffset(element),
5109					bottoming: true,
5110					inner_scrolling: SiteParameters.sticky_elements === 'on'
5111				});
5112			});
5113		};
5114
5115		requestTimeout(function() {
5116			if ($('.sticky-element').length) {
5117
5118				if ($(window).width() > UNCODE.mediaQuery) {
5119					initStickyElement();
5120
5121					if ( startSticky === true ) {
5122						$('#page-header').trigger('sticky_kit:recalc');
5123					}
5124				}
5125
5126				$(window).on('resize lateral_resize', function(event) {
5127					$(".sticky-element").trigger("sticky_kit:detach");
5128					if ($(window).width() > UNCODE.mediaQuery) {
5129						initStickyElement();
5130					}
5131				});
5132			}
5133		}, 1000);
5134
5135		if ($('.sticky-element').length) {
5136			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
5137				requestTimeout(function() {
5138					$(document.body).trigger("sticky_kit:recalc");
5139				}, 100);
5140			});
5141		}
5142
5143		var $panels = $('.panel-collapse');
5144		if ( $panels.length ) {
5145			$panels.each(function(){
5146				var $panel = $(this);
5147				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
5148					$(document.body).trigger("sticky_kit:recalc");
5149				});
5150			});
5151		}
5152
5153		$('.nav-tabs a').on('shown.bs.tab', function(e){
5154			var $tabs = $(e.target).closest('.tab-container'),
5155				$panel = $('.tab-pane.active', $tabs),
5156				$els = $(e.target).nextAll(".sticky-element");
5157
5158			$els.trigger("sticky_kit:detach");
5159			initStickyElement($els);
5160	});
5161	}
5162};
5163
5164UNCODE.twentytwenty = function() {
5165
5166  if (!$('.twentytwenty-container').length) return;
5167
5168// DOM.event.move
5169//
5170// 2.0.0
5171//
5172// Stephen Band
5173//
5174// Triggers 'movestart', 'move' and 'moveend' events after
5175// mousemoves following a mousedown cross a distance threshold,
5176// similar to the native 'dragstart', 'drag' and 'dragend' events.
5177// Move events are throttled to animation frames. Move event objects
5178// have the properties:
5179//
5180// pageX:
5181// pageY:     Page coordinates of pointer.
5182// startX:
5183// startY:    Page coordinates of pointer at movestart.
5184// distX:
5185// distY:     Distance the pointer has moved since movestart.
5186// deltaX:
5187// deltaY:    Distance the finger has moved since last event.
5188// velocityX:
5189// velocityY: Average velocity over last few events.
5190
5191
5192(function(fn) {
5193	if (typeof define === 'function' && define.amd) {
5194        define([], fn);
5195    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
5196        module.exports = fn;
5197	} else {
5198		fn();
5199	}
5200})(function(){
5201	var assign = Object.assign || window.jQuery && jQuery.extend;
5202
5203	// Number of pixels a pressed pointer travels before movestart
5204	// event is fired.
5205	var threshold = 8;
5206
5207	// Shim for requestAnimationFrame, falling back to timer. See:
5208	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
5209	var requestFrame = (function(){
5210		return (
5211			window.requestAnimationFrame ||
5212			window.webkitRequestAnimationFrame ||
5213			window.mozRequestAnimationFrame ||
5214			window.oRequestAnimationFrame ||
5215			window.msRequestAnimationFrame ||
5216			function(fn, element){
5217				return window.setTimeout(function(){
5218					fn();
5219				}, 25);
5220			}
5221		);
5222	})();
5223
5224	// Shim for customEvent
5225	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
5226	(function () {
5227		if ( typeof window.CustomEvent === "function" ) return false;
5228		function CustomEvent ( event, params ) {
5229			params = params || { bubbles: false, cancelable: false, detail: undefined };
5230			var evt = document.createEvent( 'CustomEvent' );
5231			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
5232			return evt;
5233		}
5234
5235		CustomEvent.prototype = window.Event.prototype;
5236		window.CustomEvent = CustomEvent;
5237	})();
5238
5239	var ignoreTags = {
5240			textarea: true,
5241			input: true,
5242			select: true,
5243			button: true
5244		};
5245
5246	var mouseevents = {
5247		move:   'mousemove',
5248		cancel: 'mouseup dragstart',
5249		end:    'mouseup'
5250	};
5251
5252	var touchevents = {
5253		move:   'touchmove',
5254		cancel: 'touchend',
5255		end:    'touchend'
5256	};
5257
5258	var rspaces = /\s+/;
5259
5260
5261	// DOM Events
5262
5263	var eventOptions = { bubbles: true, cancelable: true };
5264
5265	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
5266
5267	function createEvent(type) {
5268		return new CustomEvent(type, eventOptions);
5269	}
5270
5271	function getEvents(node) {
5272		return node[eventsSymbol] || (node[eventsSymbol] = {});
5273	}
5274
5275	function on(node, types, fn, data, selector) {
5276		types = types.split(rspaces);
5277
5278		var events = getEvents(node);
5279		var i = types.length;
5280		var handlers, type;
5281
5282		function handler(e) { fn(e, data); }
5283
5284		while (i--) {
5285			type = types[i];
5286			handlers = events[type] || (events[type] = []);
5287			handlers.push([fn, handler]);
5288			node.addEventListener(type, handler);
5289		}
5290	}
5291
5292	function off(node, types, fn, selector) {
5293		types = types.split(rspaces);
5294
5295		var events = getEvents(node);
5296		var i = types.length;
5297		var type, handlers, k;
5298
5299		if (!events) { return; }
5300
5301		while (i--) {
5302			type = types[i];
5303			handlers = events[type];
5304			if (!handlers) { continue; }
5305			k = handlers.length;
5306			while (k--) {
5307				if (handlers[k][0] === fn) {
5308					node.removeEventListener(type, handlers[k][1]);
5309					handlers.splice(k, 1);
5310				}
5311			}
5312		}
5313	}
5314
5315	function trigger(node, type, properties) {
5316		// Don't cache events. It prevents you from triggering an event of a
5317		// given type from inside the handler of another event of that type.
5318		var event = createEvent(type);
5319		if (properties) { assign(event, properties); }
5320		node.dispatchEvent(event);
5321	}
5322
5323
5324	// Constructors
5325
5326	function Timer(fn){
5327		var callback = fn,
5328		    active = false,
5329		    running = false;
5330
5331		function trigger(time) {
5332			if (active){
5333				callback();
5334				requestFrame(trigger);
5335				running = true;
5336				active = false;
5337			}
5338			else {
5339				running = false;
5340			}
5341		}
5342
5343		this.kick = function(fn) {
5344			active = true;
5345			if (!running) { trigger(); }
5346		};
5347
5348		this.end = function(fn) {
5349			var cb = callback;
5350
5351			if (!fn) { return; }
5352
5353			// If the timer is not running, simply call the end callback.
5354			if (!running) {
5355				fn();
5356			}
5357			// If the timer is running, and has been kicked lately, then
5358			// queue up the current callback and the end callback, otherwise
5359			// just the end callback.
5360			else {
5361				callback = active ?
5362					function(){ cb(); fn(); } :
5363					fn ;
5364
5365				active = true;
5366			}
5367		};
5368	}
5369
5370
5371	// Functions
5372
5373	function noop() {}
5374
5375	function preventDefault(e) {
5376		e.preventDefault();
5377	}
5378
5379	function isIgnoreTag(e) {
5380		return !!ignoreTags[e.target.tagName.toLowerCase()];
5381	}
5382
5383	function isPrimaryButton(e) {
5384		// Ignore mousedowns on any button other than the left (or primary)
5385		// mouse button, or when a modifier key is pressed.
5386		return (e.which === 1 && !e.ctrlKey && !e.altKey);
5387	}
5388
5389	function identifiedTouch(touchList, id) {
5390		var i, l;
5391
5392		if (touchList.identifiedTouch) {
5393			return touchList.identifiedTouch(id);
5394		}
5395
5396		// touchList.identifiedTouch() does not exist in
5397		// webkit yet… we must do the search ourselves...
5398
5399		i = -1;
5400		l = touchList.length;
5401
5402		while (++i < l) {
5403			if (touchList[i].identifier === id) {
5404				return touchList[i];
5405			}
5406		}
5407	}
5408
5409	function changedTouch(e, data) {
5410		var touch = identifiedTouch(e.changedTouches, data.identifier);
5411
5412		// This isn't the touch you're looking for.
5413		if (!touch) { return; }
5414
5415		// Chrome Android (at least) includes touches that have not
5416		// changed in e.changedTouches. That's a bit annoying. Check
5417		// that this touch has changed.
5418		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
5419
5420		return touch;
5421	}
5422
5423
5424	// Handlers that decide when the first movestart is triggered
5425
5426	function mousedown(e){
5427		// Ignore non-primary buttons
5428		if (!isPrimaryButton(e)) { return; }
5429
5430		// Ignore form and interactive elements
5431		if (isIgnoreTag(e)) { return; }
5432
5433		on(document, mouseevents.move, mousemove, e);
5434		on(document, mouseevents.cancel, mouseend, e);
5435	}
5436
5437	function mousemove(e, data){
5438		checkThreshold(e, data, e, removeMouse);
5439	}
5440
5441	function mouseend(e, data) {
5442		removeMouse();
5443	}
5444
5445	function removeMouse() {
5446		off(document, mouseevents.move, mousemove);
5447		off(document, mouseevents.cancel, mouseend);
5448	}
5449
5450	function touchstart(e) {
5451		// Don't get in the way of interaction with form elements
5452		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
5453
5454		var touch = e.changedTouches[0];
5455
5456		// iOS live updates the touch objects whereas Android gives us copies.
5457		// That means we can't trust the touchstart object to stay the same,
5458		// so we must copy the data. This object acts as a template for
5459		// movestart, move and moveend event objects.
5460		var data = {
5461			target:     touch.target,
5462			pageX:      touch.pageX,
5463			pageY:      touch.pageY,
5464			identifier: touch.identifier,
5465
5466			// The only way to make handlers individually unbindable is by
5467			// making them unique.
5468			touchmove:  function(e, data) { touchmove(e, data); },
5469			touchend:   function(e, data) { touchend(e, data); }
5470		};
5471
5472		on(document, touchevents.move, data.touchmove, data);
5473		on(document, touchevents.cancel, data.touchend, data);
5474	}
5475
5476	function touchmove(e, data) {
5477		var touch = changedTouch(e, data);
5478		if (!touch) { return; }
5479		checkThreshold(e, data, touch, removeTouch);
5480	}
5481
5482	function touchend(e, data) {
5483		var touch = identifiedTouch(e.changedTouches, data.identifier);
5484		if (!touch) { return; }
5485		removeTouch(data);
5486	}
5487
5488	function removeTouch(data) {
5489		off(document, touchevents.move, data.touchmove);
5490		off(document, touchevents.cancel, data.touchend);
5491	}
5492
5493	function checkThreshold(e, data, touch, fn) {
5494		var distX = touch.pageX - data.pageX;
5495		var distY = touch.pageY - data.pageY;
5496
5497		// Do nothing if the threshold has not been crossed.
5498		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
5499
5500		triggerStart(e, data, touch, distX, distY, fn);
5501	}
5502
5503	function triggerStart(e, data, touch, distX, distY, fn) {
5504		var touches = e.targetTouches;
5505		var time = e.timeStamp - data.timeStamp;
5506
5507		// Create a movestart object with some special properties that
5508		// are passed only to the movestart handlers.
5509		var template = {
5510			altKey:     e.altKey,
5511			ctrlKey:    e.ctrlKey,
5512			shiftKey:   e.shiftKey,
5513			startX:     data.pageX,
5514			startY:     data.pageY,
5515			distX:      distX,
5516			distY:      distY,
5517			deltaX:     distX,
5518			deltaY:     distY,
5519			pageX:      touch.pageX,
5520			pageY:      touch.pageY,
5521			velocityX:  distX / time,
5522			velocityY:  distY / time,
5523			identifier: data.identifier,
5524			targetTouches: touches,
5525			finger: touches ? touches.length : 1,
5526			enableMove: function() {
5527				this.moveEnabled = true;
5528				this.enableMove = noop;
5529				e.preventDefault();
5530			}
5531		};
5532
5533		// Trigger the movestart event.
5534		trigger(data.target, 'movestart', template);
5535
5536		// Unbind handlers that tracked the touch or mouse up till now.
5537		fn(data);
5538	}
5539
5540
5541	// Handlers that control what happens following a movestart
5542
5543	function activeMousemove(e, data) {
5544		var timer  = data.timer;
5545
5546		data.touch = e;
5547		data.timeStamp = e.timeStamp;
5548		timer.kick();
5549	}
5550
5551	function activeMouseend(e, data) {
5552		var target = data.target;
5553		var event  = data.event;
5554		var timer  = data.timer;
5555
5556		removeActiveMouse();
5557
5558		endEvent(target, event, timer, function() {
5559			// Unbind the click suppressor, waiting until after mouseup
5560			// has been handled.
5561			setTimeout(function(){
5562				off(target, 'click', preventDefault);
5563			}, 0);
5564		});
5565	}
5566
5567	function removeActiveMouse() {
5568		off(document, mouseevents.move, activeMousemove);
5569		off(document, mouseevents.end, activeMouseend);
5570	}
5571
5572	function activeTouchmove(e, data) {
5573		var event = data.event;
5574		var timer = data.timer;
5575		var touch = changedTouch(e, event);
5576
5577		if (!touch) { return; }
5578
5579		// Stop the interface from gesturing
5580		e.preventDefault();
5581
5582		event.targetTouches = e.targetTouches;
5583		data.touch = touch;
5584		data.timeStamp = e.timeStamp;
5585
5586		timer.kick();
5587	}
5588
5589	function activeTouchend(e, data) {
5590		var target = data.target;
5591		var event  = data.event;
5592		var timer  = data.timer;
5593		var touch  = identifiedTouch(e.changedTouches, event.identifier);
5594
5595		// This isn't the touch you're looking for.
5596		if (!touch) { return; }
5597
5598		removeActiveTouch(data);
5599		endEvent(target, event, timer);
5600	}
5601
5602	function removeActiveTouch(data) {
5603		off(document, touchevents.move, data.activeTouchmove);
5604		off(document, touchevents.end, data.activeTouchend);
5605	}
5606
5607
5608	// Logic for triggering move and moveend events
5609
5610	function updateEvent(event, touch, timeStamp) {
5611		var time = timeStamp - event.timeStamp;
5612
5613		event.distX =  touch.pageX - event.startX;
5614		event.distY =  touch.pageY - event.startY;
5615		event.deltaX = touch.pageX - event.pageX;
5616		event.deltaY = touch.pageY - event.pageY;
5617
5618		// Average the velocity of the last few events using a decay
5619		// curve to even out spurious jumps in values.
5620		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
5621		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
5622		event.pageX =  touch.pageX;
5623		event.pageY =  touch.pageY;
5624	}
5625
5626	function endEvent(target, event, timer, fn) {
5627		timer.end(function(){
5628			trigger(target, 'moveend', event);
5629			return fn && fn();
5630		});
5631	}
5632
5633
5634	// Set up the DOM
5635
5636	function movestart(e) {
5637		if (e.defaultPrevented) { return; }
5638		if (!e.moveEnabled) { return; }
5639
5640		var event = {
5641			startX:        e.startX,
5642			startY:        e.startY,
5643			pageX:         e.pageX,
5644			pageY:         e.pageY,
5645			distX:         e.distX,
5646			distY:         e.distY,
5647			deltaX:        e.deltaX,
5648			deltaY:        e.deltaY,
5649			velocityX:     e.velocityX,
5650			velocityY:     e.velocityY,
5651			identifier:    e.identifier,
5652			targetTouches: e.targetTouches,
5653			finger:        e.finger
5654		};
5655
5656		var data = {
5657			target:    e.target,
5658			event:     event,
5659			timer:     new Timer(update),
5660			touch:     undefined,
5661			timeStamp: e.timeStamp
5662		};
5663
5664		function update(time) {
5665			updateEvent(event, data.touch, data.timeStamp);
5666			trigger(data.target, 'move', event);
5667		}
5668
5669		if (e.identifier === undefined) {
5670			// We're dealing with a mouse event.
5671			// Stop clicks from propagating during a move
5672			on(e.target, 'click', preventDefault);
5673			on(document, mouseevents.move, activeMousemove, data);
5674			on(document, mouseevents.end, activeMouseend, data);
5675		}
5676		else {
5677			// In order to unbind correct handlers they have to be unique
5678			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
5679			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
5680
5681			// We're dealing with a touch.
5682			on(document, touchevents.move, data.activeTouchmove, data);
5683			on(document, touchevents.end, data.activeTouchend, data);
5684		}
5685	}
5686
5687	on(document, 'mousedown', mousedown);
5688	on(document, 'touchstart', touchstart);
5689	on(document, 'movestart', movestart);
5690
5691
5692	// jQuery special events
5693	//
5694	// jQuery event objects are copies of DOM event objects. They need
5695	// a little help copying the move properties across.
5696
5697	if (!window.jQuery) { return; }
5698
5699	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
5700
5701	function enableMove1(e) { e.enableMove(); }
5702	function enableMove2(e) { e.enableMove(); }
5703	function enableMove3(e) { e.enableMove(); }
5704
5705	function add(handleObj) {
5706		var handler = handleObj.handler;
5707
5708		handleObj.handler = function(e) {
5709			// Copy move properties across from originalEvent
5710			var i = properties.length;
5711			var property;
5712
5713			while(i--) {
5714				property = properties[i];
5715				e[property] = e.originalEvent[property];
5716			}
5717
5718			handler.apply(this, arguments);
5719		};
5720	}
5721
5722	jQuery.event.special.movestart = {
5723		setup: function() {
5724			// Movestart must be enabled to allow other move events
5725			on(this, 'movestart', enableMove1);
5726
5727			// Do listen to DOM events
5728			return false;
5729		},
5730
5731		teardown: function() {
5732			off(this, 'movestart', enableMove1);
5733			return false;
5734		},
5735
5736		add: add
5737	};
5738
5739	jQuery.event.special.move = {
5740		setup: function() {
5741			on(this, 'movestart', enableMove2);
5742			return false;
5743		},
5744
5745		teardown: function() {
5746			off(this, 'movestart', enableMove2);
5747			return false;
5748		},
5749
5750		add: add
5751	};
5752
5753	jQuery.event.special.moveend = {
5754		setup: function() {
5755			on(this, 'movestart', enableMove3);
5756			return false;
5757		},
5758
5759		teardown: function() {
5760			off(this, 'movestart', enableMove3);
5761			return false;
5762		},
5763
5764		add: add
5765	};
5766});
5767
5768  $.fn.twentytwenty = function(options) {
5769    var options = $.extend({
5770      default_offset_pct: 0.5,
5771      orientation: 'horizontal',
5772      before_label: 'Before',
5773      after_label: 'After',
5774      no_overlay: false,
5775      move_slider_on_hover: false,
5776      move_with_handle_only: true,
5777      click_to_move: false
5778    }, options);
5779
5780    return this.each(function() {
5781
5782      var sliderPct = options.default_offset_pct;
5783      var container = $(this);
5784      var sliderOrientation = options.orientation;
5785      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
5786      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
5787
5788
5789      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
5790      if(!options.no_overlay) {
5791        container.append("<div class='twentytwenty-overlay'></div>");
5792        var overlay = container.find(".twentytwenty-overlay");
5793        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
5794        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
5795      }
5796      var beforeImg = container.find("img:first");
5797      var afterImg = container.find("img:last");
5798      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
5799      var slider = container.find(".twentytwenty-handle");
5800      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
5801      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
5802      container.addClass("twentytwenty-container");
5803      beforeImg.addClass("twentytwenty-before");
5804      afterImg.addClass("twentytwenty-after");
5805
5806      var calcOffset = function(dimensionPct) {
5807        var w = beforeImg.width();
5808        var h = beforeImg.height();
5809        return {
5810          w: w+"px",
5811          h: h+"px",
5812          cw: (dimensionPct*w)+"px",
5813          ch: (dimensionPct*h)+"px"
5814        };
5815      };
5816
5817      var adjustContainer = function(offset) {
5818      	if (sliderOrientation === 'vertical') {
5819          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
5820          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
5821      	}
5822      	else {
5823          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
5824          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
5825    	}
5826        container.css("height", offset.h);
5827      };
5828
5829      var adjustSlider = function(pct) {
5830        var offset = calcOffset(pct);
5831        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
5832        adjustContainer(offset);
5833      };
5834
5835      // Return the number specified or the min/max number if it outside the range given.
5836      var minMaxNumber = function(num, min, max) {
5837        return Math.max(min, Math.min(max, num));
5838      };
5839
5840      // Calculate the slider percentage based on the position.
5841      var getSliderPercentage = function(positionX, positionY) {
5842        var sliderPercentage = (sliderOrientation === 'vertical') ?
5843          (positionY-offsetY)/imgHeight :
5844          (positionX-offsetX)/imgWidth;
5845
5846        return minMaxNumber(sliderPercentage, 0, 1);
5847      };
5848
5849
5850      $(window).on("resize.twentytwenty", function(e) {
5851        adjustSlider(sliderPct);
5852      });
5853
5854      var offsetX = 0;
5855      var offsetY = 0;
5856      var imgWidth = 0;
5857      var imgHeight = 0;
5858      var onMoveStart = function(e) {
5859        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
5860          e.preventDefault();
5861        }
5862        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
5863          e.preventDefault();
5864        }
5865        container.addClass("active");
5866        offsetX = container.offset().left;
5867        offsetY = container.offset().top;
5868        imgWidth = beforeImg.width();
5869        imgHeight = beforeImg.height();
5870      };
5871      var onMove = function(e) {
5872        if (container.hasClass("active")) {
5873          sliderPct = getSliderPercentage(e.pageX, e.pageY);
5874          adjustSlider(sliderPct);
5875        }
5876      };
5877      var onMoveEnd = function() {
5878          container.removeClass("active");
5879      };
5880
5881      var moveTarget = options.move_with_handle_only ? slider : container;
5882      moveTarget.on("movestart",onMoveStart);
5883      moveTarget.on("move",onMove);
5884      moveTarget.on("moveend",onMoveEnd);
5885
5886      if (options.move_slider_on_hover) {
5887        container.on("mouseenter", onMoveStart);
5888        container.on("mousemove", onMove);
5889        container.on("mouseleave", onMoveEnd);
5890      }
5891
5892      slider.on("touchmove", function(e) {
5893        e.preventDefault();
5894      });
5895
5896      container.find("img").on("mousedown", function(event) {
5897        event.preventDefault();
5898      });
5899
5900      if (options.click_to_move) {
5901        container.on('click', function(e) {
5902          offsetX = container.offset().left;
5903          offsetY = container.offset().top;
5904          imgWidth = beforeImg.width();
5905          imgHeight = beforeImg.height();
5906
5907          sliderPct = getSliderPercentage(e.pageX, e.pageY);
5908          adjustSlider(sliderPct);
5909        });
5910      }
5911
5912      $(window).trigger("resize.twentytwenty");
5913    });
5914  };
5915
5916
5917  $(window).on("load", function(e) {
5918  	$('.twentytwenty-container').each(function(){
5919  		var $container = $(this);
5920  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
5921  			$container.twentytwenty();
5922  		}
5923  		$('img', $container).on('async-done', function(){
5924	  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
5925	  			$container.twentytwenty();
5926	  		}
5927	    });
5928  	});
5929  });
5930}
5931
5932UNCODE.justifiedGallery = function() {
5933
5934	var breakPointMe = function( val ) {
5935		val = parseInt( val );
5936		if ( isNaN(val) ) {
5937			return false;
5938		}
5939		if ( val >= 1500 ) {
5940			return 1;
5941		} else if ( val < 1500 && val >= 960 ) {
5942			return 2;
5943		} else if ( val < 960 && val >= 570 ) {
5944			return 3;
5945		} else if ( val < 570 ) {
5946			return 4;
5947		}
5948	}
5949
5950	var gutterByBreakpoint = function( bp, gutter ) {
5951		var ret;
5952		switch(gutter) {
5953		    case 'no-gutter':
5954		    	ret = 0;
5955		        break;
5956		    case 'px-gutter':
5957		    	ret = 1;
5958		        break;
5959		    case 'half-gutter':
5960		    	ret = 18;
5961		        break;
5962		    case 'double-gutter':
5963				switch(bp) {
5964				    case 3:
5965				    case 4:
5966				    	ret = 36;
5967				        break;
5968				    default:
5969				    	ret = 72;
5970				        break;
5971				}
5972		        break;
5973		    case 'triple-gutter':
5974				switch(bp) {
5975				    case 3:
5976				    case 4:
5977				    	ret = 36;
5978				        break;
5979				    default:
5980				    	ret = 108;
5981				        break;
5982				}
5983		        break;
5984		    case 'quad-gutter':
5985				switch(bp) {
5986				    case 2:
5987				    	ret = 108;
5988				        break;
5989				    case 3:
5990				    	ret = 72;
5991				        break;
5992				    case 4:
5993				    	ret = 36;
5994				        break;
5995				    default:
5996				    	ret = 144;
5997				        break;
5998				}
5999		        break;
6000		    default:
6001		    	ret = 36;//single-gutter
6002		}
6003		return ret;
6004	}
6005
6006	if ($('.justified-layout').length > 0) {
6007		var justifiedContainersArray = [],
6008			typeGridArray = [],
6009			layoutGridArray = [],
6010			transitionDuration = [],
6011			$filterItems = [],
6012			$filters = $('.justified-system .isotope-filters'),
6013			$itemSelector = '.tmb',
6014			$items,
6015			itemMargin,
6016			correctionFactor = 0,
6017			firstLoad = true,
6018			isOriginLeft = $('body').hasClass('rtl') ? false : true,
6019			prevW = breakPointMe(UNCODE.wwidth);
6020		$('[class*="justified-container"]').each(function() {
6021			var isoData = $(this).data();
6022			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6023			if (isoData.type == 'metro') typeGridArray.push(true);
6024			else typeGridArray.push(false);
6025			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
6026			else layoutGridArray.push('justified');
6027			justifiedContainersArray.push($(this));
6028		});
6029		var init_justifiedGallery = function() {
6030			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
6031				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
6032					justifiedId = justifiedSystem.attr('id'),
6033					$layoutMode = layoutGridArray[i],
6034					gutter = $(justifiedContainersArray[i]).data('gutter'),
6035					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
6036					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
6037					lastRow = $(justifiedContainersArray[i]).data('last-row'),
6038					margins;
6039
6040				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
6041				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
6042				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6043
6044				margins = gutterByBreakpoint(prevW, gutter);
6045
6046				$(justifiedContainersArray[i]).justifiedGallery({
6047					rowHeight: rowHeight,
6048					maxRowHeight: maxRowHeight,
6049					margins: margins,
6050					cssAnimation: true,
6051					lastRow: lastRow,
6052					waitThumbnailsLoad: false
6053				}).one('jg.complete', function(){ onLayout($(this), 0); } );
6054
6055				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
6056					$(justifiedContainersArray[i]).infinitescroll({
6057							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
6058							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6059							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
6060							animate: false,
6061							behavior: 'local',
6062							debug: false,
6063							loading: {
6064								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
6065								speed: 0,
6066								finished: undefined,
6067								msg: $('#' + justifiedId + ' .loadmore-button'),
6068							},
6069							errorCallback: function() {
6070								var justified_system = $(this).closest('.justified-system');
6071								$('.loading-button', justified_system).hide();
6072								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
6073							}
6074						},
6075						// append the new items to galleryJustified on the infinitescroll callback function.
6076						function(newElements, opts) {
6077							var $galleryJustified = $(this),
6078								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
6079								filters = new Array(),
6080								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
6081								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
6082								$numPages = $('a', $infinite_button).data('pages'),
6083								delay = 300;
6084							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6085							$infinite_button.show();
6086							$loading_button.hide();
6087							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6088							$('> li', $galleryJustified).remove();
6089							$.each($(newElements), function(index, val) {
6090								$(val).addClass('tmb-iso');
6091								if ($(val).is("li")) {
6092									filters.push($(val)[0]);
6093								}
6094							});
6095							newElements = newElements.filter(function(x) {
6096								return filters.indexOf(x) < 0
6097							});
6098							$.each($(filters), function(index, val) {
6099								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
6100							});
6101							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
6102							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6103								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
6104								if (typeof getLightbox === 'object') {
6105									getLightbox.refresh();
6106								} else {
6107									UNCODE.lightbox();
6108								}
6109							}
6110							if ( typeof twttr !== 'undefined' )
6111								twttr.widgets.load(justifiedContainersArray[i]);
6112
6113							requestTimeout(function() {
6114								$galleryJustified.trigger('more-items-loaded');
6115								$(window).trigger('more-items-loaded');
6116							}, 1000);
6117						});
6118					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
6119						var $infinite_justified = $(justifiedContainersArray[i]),
6120							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
6121						$infinite_justified.infinitescroll('pause');
6122						$infinite_button.on('click', function(event) {
6123							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6124								$.each(UNCODE.lightboxArray, function(index, val) {
6125									UNCODE.lightboxArray[index].destroy();
6126								});
6127							}
6128							event.preventDefault();
6129							var $justified_system = $(event.target).closest('.justified-system'),
6130							$infinite_justified = $justified_system.find('.justified-container'),
6131							justifiedId = $justified_system.attr('id');
6132							$(event.currentTarget).html(SiteParameters.loading);
6133							$infinite_justified.infinitescroll('resume');
6134							$infinite_justified.infinitescroll('retrieve');
6135							$infinite_justified.infinitescroll('pause');
6136							$infinite_justified.trigger('more-items-loaded');
6137							$(window).trigger('more-items-loaded');
6138						});
6139					}
6140				}
6141			}
6142		},
6143		onLayout = function(justifiedObj, startIndex) {
6144			justifiedObj.css('opacity', 1);
6145			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
6146			$('.tmb', justifiedObj).addClass('justified-object-loaded');
6147
6148			requestTimeout(function() {
6149				// window.dispatchEvent(UNCODE.boxEvent);
6150				UNCODE.adaptive();
6151				if (SiteParameters.dynamic_srcset_active === '1') {
6152					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
6153				}
6154				if (typeof MediaElement === "function") {
6155					$(justifiedObj).find('audio,video').each(function() {
6156						$(this).mediaelementplayer({
6157								pauseOtherPlayers: false,
6158						});
6159					});
6160				}
6161				if ($(justifiedObj).find('.nested-carousel').length) {
6162					if (typeof UNCODE.carousel !== 'undefined') {
6163						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
6164					}
6165					requestTimeout(function() {
6166						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6167						justifiedObj.addClass('justified-gallery-finished')
6168						Waypoint.refreshAll();
6169					}, 200);
6170				} else {
6171					requestTimeout(function() {
6172						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6173						justifiedObj.addClass('justified-gallery-finished')
6174						Waypoint.refreshAll();
6175					}, 300);
6176				}
6177			}, 100);
6178
6179		},
6180		boxAnimation = function(items, startIndex, sequential, container) {
6181			var $allItems = items.length - startIndex,
6182				showed = 0,
6183				index = 0;
6184			if (container.closest('.owl-item').length == 1) return false;
6185			$.each(items, function(index, val) {
6186				var elInner = $('> .t-inside', val);
6187				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
6188					return;
6189				}
6190				if (val[0]) val = val[0];
6191				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
6192					new Waypoint({
6193						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
6194						element: val,
6195						handler: function() {
6196							var element = $('> .t-inside', this.element),
6197								parent = $(this.element),
6198								currentIndex = parent.index();
6199							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
6200								delayAttr = parseInt(element.attr('data-delay'));
6201							if (isNaN(delayAttr)) delayAttr = 100;
6202							delay -= showed;
6203							var objTimeout = requestTimeout(function() {
6204								element.removeClass('zoom-reverse').addClass('start_animation');
6205								showed = parent.index();
6206							}, delay * delayAttr);
6207							parent.data('objTimeout', objTimeout);
6208							if (!UNCODE.isUnmodalOpen) {
6209								this.destroy();
6210							}
6211						},
6212						offset: '100%'
6213					})
6214				} else {
6215					elInner.removeClass('animate_when_almost_visible');
6216					$(val).addClass('no-waypoint-animation');
6217					/*if (elInner.hasClass('force-anim')) {
6218						elInner.addClass('start_animation');
6219					} else {
6220						elInner.css('opacity', 1);
6221					}*/
6222				}
6223				index++;
6224			});
6225		};
6226		$filters.on('click', 'a[data-filter]', function(evt) {
6227			var $filter = $(this),
6228				filterContainer = $filter.closest('.isotope-filters'),
6229				filterValue = $filter.attr('data-filter'),
6230				container = $filter.closest('.justified-system').find($('.justified-layout')),
6231				lastRow = container.data('last-row'),
6232				transitionDuration = 0,
6233				delay = 300,
6234				filterItems = [];
6235
6236			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6237
6238			var filter_items = function(){
6239				if (filterValue !== undefined) {
6240					$.each($('> .tmb > .t-inside', container), function(index, val) {
6241						var parent = $(val).parent(),
6242							objTimeout = parent.data('objTimeout');
6243						if (objTimeout) {
6244							$(val).removeClass('zoom-reverse');
6245							clearRequestTimeout(objTimeout);
6246						}
6247						if (transitionDuration == 0) {
6248							if ($(val).hasClass('animate_when_almost_visible')) {
6249								$(val).addClass('zoom-reverse').removeClass('start_animation');
6250							} else {
6251								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6252							}
6253						}
6254					});
6255
6256					requestTimeout(function() {
6257						var $block,
6258							selector,
6259							lightboxElements,
6260							$boxes;
6261
6262						if ( filterValue !== '' && filterValue !== '*' ) {
6263							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
6264							selector = '.' + filterValue;
6265							$.each($(selector, container), function(index, block) {
6266								lightboxElements = $('[data-lbox^=ilightbox]', block);
6267								if (lightboxElements.length) {
6268									lightboxElements.removeClass('lb-disabled');
6269									container.data('lbox', $(lightboxElements[0]).data('lbox'));
6270								}
6271								filterItems.push(block);
6272							});
6273							container.justifiedGallery({
6274								filter: selector,
6275								lastRow: 'nojustify'
6276							});
6277						} else {
6278							container.justifiedGallery({
6279								filter: false,
6280								lastRow: lastRow
6281							});
6282							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
6283							filterItems = $('> .tmb', container);
6284						}
6285						container.trigger('more-items-loaded');
6286						$(window).trigger('more-items-loaded');
6287
6288						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
6289						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6290							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
6291							if (typeof getLightbox === 'object') {
6292								getLightbox.refresh();
6293							} else {
6294								UNCODE.lightbox();
6295							}
6296						}
6297
6298						if (transitionDuration == 0) {
6299							requestTimeout(function() {
6300								boxAnimation(filterItems, 0, false, container);
6301							}, 100);
6302						}
6303						requestTimeout(function() {
6304							Waypoint.refreshAll();
6305							container.trigger('more-items-loaded');
6306							$(window).trigger('more-items-loaded');
6307						}, 2000);
6308
6309					}, delay);
6310				} else {
6311					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6312						$.each(UNCODE.lightboxArray, function(index, val) {
6313							UNCODE.lightboxArray[index].destroy();
6314						});
6315					}
6316					$.each($('> .tmb > .t-inside', container), function(index, val) {
6317						var parent = $(val).parent(),
6318							objTimeout = parent.data('objTimeout');
6319						if (objTimeout) {
6320							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6321							clearRequestTimeout(objTimeout);
6322						}
6323						if (transitionDuration == 0) {
6324							if ($(val).hasClass('animate_when_almost_visible')) {
6325								$(val).addClass('zoom-reverse').removeClass('start_animation');
6326							} else {
6327								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6328							}
6329						}
6330					});
6331					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6332						UNCODE.lightbox();
6333					}
6334					container.parent().addClass('justified-loading');
6335					container.trigger('more-items-loaded');
6336					$(window).trigger('more-items-loaded');
6337				}
6338			};
6339
6340			if (!$filter.hasClass('active')) {
6341				/** Scroll top with filtering */
6342				if (filterContainer.hasClass('filter-scroll')) {
6343                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6344                    calc_scroll -= UNCODE.get_scroll_offset();
6345
6346					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6347						delta = bodyTop - calc_scroll,
6348						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
6349						filterTolerance = false,
6350						filter_timeout;
6351					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6352
6353					if ( !UNCODE.isFullPage ) {
6354						if (scrollSpeed == 0) {
6355							$('html, body').scrollTop(calc_scroll);
6356							UNCODE.scrolling = false;
6357							filter_items();
6358						} else {
6359
6360							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
6361								filter_items();
6362								filterTolerance = true;
6363							}
6364
6365							$('html, body').animate({
6366								scrollTop: calc_scroll
6367							},{
6368								easing: 'easeInOutQuad',
6369								duration: scrollSpeed,
6370								complete: function(){
6371									UNCODE.scrolling = false;
6372									if ( !filterTolerance ) {
6373										filter_timeout = setTimeout(function(){
6374											clearTimeout(filter_timeout);
6375											filter_items();
6376										}, 200);
6377									}
6378								}
6379							});
6380						}
6381					}
6382				} else {
6383					filter_items();
6384				}
6385			}
6386			evt.preventDefault();
6387		});
6388
6389		$filters.each(function(i, buttonGroup) {
6390			var $buttonGroup = $(buttonGroup);
6391			$buttonGroup.on('click', 'a', function() {
6392				$buttonGroup.find('.active').removeClass('active');
6393				$(this).addClass('active');
6394			});
6395
6396			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
6397				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
6398				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
6399			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
6400				e.preventDefault();
6401				$cats_filters.slideToggle(400, 'easeInOutCirc');
6402			});
6403		});
6404		window.addEventListener('boxResized', function(e) {
6405			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
6406				prevW = breakPointMe(UNCODE.wwidth);
6407				$.each($('.justified-layout'), function(index, val) {
6408					var gutter = $(this).data('gutter'),
6409						margins = gutterByBreakpoint( prevW, gutter);
6410					$(this).justifiedGallery({
6411						margins: margins
6412					});
6413					$(this).find('.mejs-video,.mejs-audio').each(function() {
6414						$(this).trigger('resize');
6415					});
6416				});
6417			}
6418		}, false);
6419
6420		init_justifiedGallery();
6421	};
6422};
6423
6424UNCODE.cssGrid = function() {
6425	if ($('.cssgrid-layout').length > 0) {
6426		var cssGridContainersArray = [];
6427		var transitionDuration = [];
6428		var $filters = $('.cssgrid-system .cssgrid-filters');
6429
6430		$('[class*="cssgrid-container"]').each(function() {
6431			cssGridContainersArray.push($(this));
6432			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6433		});
6434
6435		var init_cssGridAjax = function() {
6436			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
6437				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
6438					cssGridId = cssGridSystem.attr('id');
6439
6440				cssGridSystem.data('transitionDuration', transitionDuration[i]);
6441
6442				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
6443					$(cssGridContainersArray[i]).infinitescroll({
6444						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
6445						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6446						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat', // selector for all items you'll retrieve
6447						animate: false,
6448						behavior: 'local',
6449						debug: false,
6450						loading: {
6451							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
6452							speed: 0,
6453							finished: undefined,
6454							msg: $('#' + cssGridId + ' .loadmore-button'),
6455						},
6456						errorCallback: function() {
6457							var cssgrid_system = $(this).closest('.cssgrid-system');
6458							$('.loading-button', cssgrid_system).hide();
6459							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
6460						}
6461					},
6462					// append the new items to cssGrid on the infinitescroll callback function.
6463					function(newElements, opts) {
6464						var $cssGrid = $(this),
6465							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
6466							cssGridId = cssGridSystemCont.attr('id'),
6467							filters = new Array(),
6468							$loading_button = $cssGrid.closest('.cssgrid-system').find('.loading-button'),
6469							$infinite_button = $cssGrid.closest('.cssgrid-system').find('.loadmore-button'),
6470							$numPages = $('a', $infinite_button).data('pages'),
6471							delay = 300;
6472						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6473						$infinite_button.show();
6474						$loading_button.hide();
6475						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6476						$('> li', $cssGrid).remove();
6477						$.each($(newElements), function(index, val) {
6478							$(val).addClass('tmb-grid');
6479							if ($(val).is("li")) {
6480								filters.push($(val)[0]);
6481							}
6482						});
6483						newElements = newElements.filter(function(x) {
6484							return filters.indexOf(x) < 0
6485						});
6486						$.each($(filters), function(index, val) {
6487							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
6488						});
6489
6490						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
6491						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
6492						if (filterValue !== undefined && filterValue != '*') {
6493							$(newElements).hide();
6494							var els_to_show = $();
6495							$(newElements).each(function() {
6496								var el = $(this);
6497								if (el.hasClass(filterValue)) {
6498									els_to_show = els_to_show.add(el);
6499									el.show();
6500								}
6501							});
6502							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
6503						} else {
6504							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
6505						}
6506
6507						UNCODE.adaptive();
6508						if (SiteParameters.dynamic_srcset_active === '1') {
6509							UNCODE.refresh_dynamic_srcset_size($cssGrid);
6510						}
6511						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6512							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
6513							if (typeof getLightbox === 'object') {
6514								getLightbox.refresh();
6515							} else {
6516								UNCODE.lightbox();
6517							}
6518						}
6519						if ( typeof twttr !== 'undefined' ) {
6520							twttr.widgets.load(cssGridContainersArray[i]);
6521						}
6522
6523						UNCODE.carousel($(newElements));
6524						requestTimeout(function() {
6525							$cssGrid.trigger('more-items-loaded');
6526							$(window).trigger('more-items-loaded');
6527						}, 1000);
6528
6529					});
6530					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
6531						var $cssgrid_el = $(cssGridContainersArray[i]),
6532							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
6533						$cssgrid_el.infinitescroll('pause');
6534						$infinite_button.on('click', function(event) {
6535							event.preventDefault();
6536							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
6537							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
6538							cssGridId = $cssgrid_system.attr('id');
6539							$(event.currentTarget).html(SiteParameters.loading);
6540							$cssgrid_el.infinitescroll('resume');
6541							$cssgrid_el.infinitescroll('retrieve');
6542							$cssgrid_el.infinitescroll('pause');
6543						});
6544					}
6545				}
6546			}
6547		};
6548
6549		init_cssGridAjax();
6550
6551		if ($('.cssgrid-pagination').length > 0) {
6552			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
6553				evt.preventDefault();
6554
6555				if (SiteParameters.index_pagination_disable_scroll !== '1') {
6556					var container = $(this).closest('.cssgrid-system'),
6557					calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6558
6559					calc_scroll -= UNCODE.get_scroll_offset();
6560
6561					var menu_container = $('.menu-sticky');
6562					var menu = menu_container.find('.menu-container');
6563
6564					if (menu_container.length > 0 && menu.length > 0) {
6565						calc_scroll = calc_scroll - menu.outerHeight();
6566					}
6567
6568					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6569						delta = bodyTop - calc_scroll,
6570						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
6571					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6572
6573					if ( !UNCODE.isFullPage ) {
6574						if (scrollSpeed == 0) {
6575							$('html, body').scrollTop(calc_scroll);
6576						} else {
6577							$('html, body').animate({
6578								scrollTop: calc_scroll
6579							},{
6580								easing: 'easeInOutQuad',
6581								duration: scrollSpeed,
6582								complete: function(){
6583									UNCODE.scrolling = false;
6584								}
6585							});
6586						}
6587					}
6588				}
6589
6590				loadCssGrid($(this), true);
6591			});
6592		}
6593
6594		$filters.on('click', 'a.grid-nav-link', function(evt) {
6595			if ($(this).hasClass('no-grid-filter')) {
6596				return;
6597			}
6598			var $filter = $(this),
6599				filterContainer = $filter.closest('.cssgrid-filters'),
6600				filterValue = $filter.attr('data-filter'),
6601				containerSystem = $filter.closest('.cssgrid-system'),
6602				container = containerSystem.find($('.cssgrid-layout')),
6603				transitionDuration = containerSystem.data('transitionDuration'),
6604				delay = 300,
6605				filterItems = [],
6606				all_thumbs = container.find('.tmb-grid');
6607
6608			var filter_items = function(){
6609				if (filterValue !== undefined) {
6610					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
6611						var parent = $(val).parent(),
6612							objTimeout = parent.data('objTimeout');
6613						if (objTimeout) {
6614							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6615							clearRequestTimeout(objTimeout);
6616						}
6617						if (transitionDuration == 0) {
6618							if ($(val).hasClass('animate_when_almost_visible')) {
6619								$(val).addClass('zoom-reverse').removeClass('start_animation');
6620							} else {
6621								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6622							}
6623						}
6624					});
6625					requestTimeout(function(){
6626						if ( filterValue == '*' ) {
6627							all_thumbs.show();
6628							all_thumbs.each(function(index, val) {
6629								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
6630								filterItems.push($(this));
6631							});
6632						} else {
6633							all_thumbs.each(function() {
6634								var _tmb = $(this);
6635								if (_tmb.hasClass(filterValue)) {
6636									_tmb.show();
6637									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
6638									filterItems.push(_tmb);
6639								} else {
6640									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
6641									_tmb.hide();
6642								}
6643							});
6644						}
6645
6646						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
6647
6648						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
6649						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
6650						var lightboxElements = $('[data-lbox^=ilightbox]', container);
6651						if (lightboxElements.length) {
6652							container.data('lbox', $(lightboxElements[0]).data('lbox'));
6653							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6654								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
6655								if (typeof getLightbox === 'object') {
6656									getLightbox.refresh();
6657								} else {
6658									UNCODE.lightbox();
6659								}
6660							}
6661						}
6662						container.trigger('more-items-loaded');
6663						$(window).trigger('more-items-loaded');
6664					}, delay);
6665				} else {
6666					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
6667						var parent = $(val).parent(),
6668							objTimeout = parent.data('objTimeout');
6669						if (objTimeout) {
6670							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6671							clearRequestTimeout(objTimeout);
6672						}
6673						if (transitionDuration == 0) {
6674							if ($(val).hasClass('animate_when_almost_visible')) {
6675								$(val).addClass('zoom-reverse').removeClass('start_animation');
6676							} else {
6677								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6678							}
6679						}
6680					});
6681					loadCssGrid($filter);
6682				}
6683			};
6684
6685			if (!$filter.hasClass('active')) {
6686				/** Scroll top with filtering */
6687				if (filterContainer.hasClass('filter-scroll')) {
6688                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6689                    calc_scroll -= UNCODE.get_scroll_offset();
6690
6691					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6692						delta = bodyTop - calc_scroll,
6693						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
6694						filterTolerance = false,
6695						filter_timeout;
6696					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6697
6698					if ( !UNCODE.isFullPage ) {
6699						if (scrollSpeed == 0) {
6700							$('html, body').scrollTop(calc_scroll);
6701							UNCODE.scrolling = false;
6702							filter_items();
6703						} else {
6704
6705							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
6706								filter_items();
6707								filterTolerance = true;
6708							}
6709
6710							$('html, body').animate({
6711								scrollTop: calc_scroll
6712							},{
6713								easing: 'easeInOutQuad',
6714								duration: scrollSpeed,
6715								complete: function(){
6716									UNCODE.scrolling = false;
6717									if ( !filterTolerance ) {
6718										filter_timeout = setTimeout(function(){
6719											clearTimeout(filter_timeout);
6720											filter_items();
6721										}, 200);
6722									}
6723								}
6724							});
6725						}
6726					}
6727				} else {
6728					filter_items();
6729				}
6730			}
6731			evt.preventDefault();
6732		});
6733
6734		$(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) {
6735			var params = UNCODE.getURLParams(window.location);
6736			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
6737
6738			UNCODE.lastURL = window.location.href;
6739
6740			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
6741				return;
6742			}
6743
6744			if (params.id === undefined) {
6745				$.each($('.cssgrid-system'), function(index, val) {
6746					loadCssGrid($(val));
6747				});
6748			} else {
6749				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
6750					loadCssGrid($('#' + params.id));
6751				}
6752			}
6753		});
6754
6755		var loadCssGrid = function($href, $paginating) {
6756			var is_paginating = false;
6757
6758			if (undefined !== $paginating && $paginating) {
6759				var is_paginating = $paginating;
6760			}
6761
6762			var href = ($href.is("a") ? $href.attr('href') : location),
6763				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
6764				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
6765				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
6766				cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')),
6767				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
6768				cssgridId = cssgridSystem.attr('id');
6769			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
6770				UNCODE.lastURL = href;
6771				history.pushState({
6772					myCSSgrid: true
6773				}, document.title, href);
6774			}
6775			cssgridWrapper.addClass('cssgrid-loading');
6776			if (is_paginating) {
6777				cssgridWrapper.addClass('grid-filtering');
6778			}
6779			$.ajax({
6780				url: href
6781			}).done(function(data) {
6782				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
6783					$resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0],
6784					$resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0];
6785				requestTimeout(function() {
6786					cssgridContainer.html($resultItems);
6787					cssgridWrapper.removeClass('cssgrid-loading');
6788					cssgridWrapper.removeClass('grid-filtering');
6789					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
6790					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false);
6791					UNCODE.adaptive();
6792					if (SiteParameters.dynamic_srcset_active === '1') {
6793						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
6794					}
6795					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6796						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
6797						if (typeof getLightbox === 'object') {
6798							getLightbox.refresh();
6799						} else {
6800							UNCODE.lightbox();
6801						}
6802					}
6803					cssgridContainer.trigger('more-items-loaded');
6804					$(window).trigger('more-items-loaded');
6805				}, 300);
6806
6807				$('.pagination', cssgridFooter).remove();
6808				cssgridFooter.append($resultPagination);
6809
6810				if (cssgridResultCount.length > 0) {
6811					$('.woocommerce-result-count', cssgridResultCount).remove();
6812					cssgridResultCount.append($resultCount);
6813				}
6814			});
6815		};
6816
6817		$filters.each(function(i, buttonGroup) {
6818			var $buttonGroup = $(buttonGroup);
6819			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
6820				$buttonGroup.find('.active').removeClass('active');
6821				$(this).addClass('active');
6822
6823			});
6824
6825			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
6826				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
6827				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
6828			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
6829				e.preventDefault();
6830				$cats_filters.slideToggle(400, 'easeInOutCirc');
6831			});
6832
6833		});
6834	};
6835};
6836
6837UNCODE.preventDoubleTransition = function() {
6838	$('.sticky-element .animate_when_almost_visible').each(function(){
6839		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
6840			$el.addClass('do_not_reanimate');
6841		});
6842	});
6843};
6844
6845UNCODE.checkScrollForTabs = function(){
6846	var goToSection = window.location.hash.replace('#', ''),
6847		$index;
6848
6849	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
6850	goToSection = encodeURIComponent(goToSection);
6851	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
6852
6853	$index.attr('data-parent', 'parent-' + goToSection);
6854
6855	if (window.location.hash != undefined && window.location.hash != '') {
6856		requestTimeout(function() {
6857			scrollBody('parent-' + goToSection);
6858		}, 500);
6859	}
6860
6861	$('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
6862		var hash = (e.currentTarget).hash,
6863			index = (e.currentTarget).closest('.uncode-tabs');
6864		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
6865			$('a[href="' + hash + '"][data-tab-history]').click();
6866			scrollBody(index);
6867		}
6868	});
6869
6870	var scrollBody = function(index) {
6871
6872		var getSection = $('a[href="' + index + '"][data-tab-history]'),
6873			scrollTo,
6874			safeGap = 27;
6875
6876		if ( ! getSection.length ) {
6877			getSection = $('div[data-parent="' + index + '"]');
6878
6879			if ( getSection.attr('data-target') == 'row' ) {
6880				getSection = getSection.closest('.vc_row');
6881				safeGap = 0;
6882			}
6883		}
6884
6885		if (typeof getSection === 'undefined' || ! getSection.length ) {
6886			return;
6887		}
6888
6889		var body = $("html, body"),
6890		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6891		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
6892		getOffset = UNCODE.get_scroll_offset();
6893		if ( typeof getSection.offset() === 'undefined' )
6894			return;
6895		scrollTo = getSection.offset().top - safeGap;
6896		scrollTo -= getOffset;
6897
6898		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
6899		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6900
6901		if (index != 0) {
6902			UNCODE.scrolling = true;
6903		}
6904
6905		if (scrollSpeed == 0) {
6906			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
6907			UNCODE.scrolling = false;
6908		} else {
6909			body.animate({
6910				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
6911			}, scrollSpeed, 'easeInOutQuad', function() {
6912				requestTimeout(function() {
6913					UNCODE.scrolling = false;
6914					if (getOffset != UNCODE.get_scroll_offset()) {
6915						scrollBody(index);
6916					}
6917				}, 100);
6918			});
6919		}
6920
6921	};
6922};
6923
6924UNCODE.printScreen = function() {
6925	var inlineMediaStyle = null,
6926		setResize;
6927
6928    function changeMediaStyle() {
6929		clearRequestTimeout(setResize);
6930		setResize = requestTimeout(function(){
6931	        var $head = document.getElementsByTagName('head')[0],
6932	        	$newStyle = document.createElement('style'),
6933	        	winW = window.innerWidth,
6934	        	printH = window.innerHeight;
6935
6936	        $newStyle.setAttribute('type', 'text/css');
6937	        $newStyle.setAttribute('media', 'print');
6938	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
6939
6940	        if (inlineMediaStyle != null) {
6941	            $head.replaceChild($newStyle, inlineMediaStyle)
6942	        } else {
6943	            $head.appendChild($newStyle);
6944	        }
6945	        inlineMediaStyle = $newStyle;
6946	    }, 1000);
6947    }
6948
6949    changeMediaStyle();
6950    window.addEventListener('resize', changeMediaStyle);
6951};
6952
6953UNCODE.fullPage = function() {
6954	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
6955		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
6956		return false;
6957	} else {
6958		requestTimeout(function() {
6959			window.scrollTo(0, 0);
6960		}, 10);
6961	}
6962
6963	var $masthead = $('#masthead'),
6964		$logo = $('#logo-container-mobile'),
6965		$logolink = $('[data-minheight]', $logo),
6966		logoMinScale = $logolink.data('minheight'),
6967		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
6968		$container = $('.main-container .post-content'),
6969		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
6970		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
6971		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
6972		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
6973		headerWithOpacity = $('.header-scroll-opacity', $header).length,
6974		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
6975		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
6976		scrollBar = true,
6977		effect,
6978		animationEndTimeOut,
6979		fp_anim_time = 900,
6980		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
6981		is_scrolling = false,
6982		dataNames = [],
6983		is_first = true,
6984		no_history = $('body').hasClass('uncode-scroll-no-history'),
6985		theres_footer = true;
6986
6987	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
6988		$('> div', $footer).each(function(index, el){
6989			if ( $(el).outerHeight() < 2 )
6990				theres_footer = false;
6991			else
6992				theres_footer = true;
6993		});
6994	}
6995
6996	if ( !$footer.length )
6997		theres_footer = false;
6998
6999	if ( !UNCODE.isFullPageSnap ) {
7000
7001		if ( $('body').hasClass('uncode-fullpage-zoom') )
7002			effect = 'scaleDown';
7003		else if ( $('body').hasClass('uncode-fullpage-parallax') )
7004			effect = 'moveparallax';
7005		else
7006			effect = 'movecurtain';
7007	}
7008
7009	if ( $('body').hasClass('uncode-fullpage-trid') )
7010		fp_anim_time = fp_anim_time*2;
7011
7012	if ( $header.length ) {
7013		if ( headerName !== '' )
7014			$header.attr('data-name', headerName);
7015		if ( headerLabel !== '' )
7016			$header.attr('data-label', headerLabel);
7017		$container.prepend($header);
7018	}
7019	if ( theres_footer ) {
7020		$container.append($footer);
7021		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
7022		$('aside.widget ul', $footer).addClass('no-list');
7023	}
7024
7025	var $all = $rows.add($header);
7026
7027	if ( theres_footer )
7028		$all = $all.add($footer);
7029
7030	$all.each(function(index, row) {
7031		if( index === 0 )
7032			$(row).addClass('uncode-scroll-active');
7033	});
7034
7035	if ( !UNCODE.isMobile && !$('body').hasClass('uncode-scroll-no-dots') )
7036		$("<ul class='onepage-pagination'></ul>").prependTo("body");
7037
7038	$all.each(function(index, val) {
7039		var getName = $(val).data('name'),
7040			label;
7041
7042		if (typeof getName == 'undefined' || getName == 'undefined')
7043			getName = SiteParameters.slide_name + '-' + index;
7044
7045		//if ( dataNames.includes(getName) ) {
7046		if ( dataNames.indexOf(getName) > 0 ) {
7047			getName += '_' + index;
7048			$(val).data('name', getName);
7049		}
7050
7051		dataNames.push(getName);
7052
7053		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
7054
7055		if (typeof $(val).attr('data-label') !== 'undefined')
7056			label = $(val).attr('data-label');
7057		else label = '';
7058
7059		if ( $(val).is($footer) )
7060			return;
7061
7062		if (label != '' ) {
7063			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
7064			$('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>");
7065		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
7066			$('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>");
7067		}
7068	});
7069
7070	var checkVisible = function( el, off ) {
7071		if (typeof jQuery === "function" && el instanceof jQuery) {
7072			el = el[0];
7073		}
7074
7075		off = typeof off=='undefined' ? 50 : off;
7076
7077		var rect = el.getBoundingClientRect();
7078
7079		return (
7080			(
7081				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7082				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7083				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
7084			)
7085		);
7086	};
7087
7088	var animationEndAction = function( index, nextIndex ) {
7089		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
7090			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7091			player, iframe;
7092
7093		if ( !$nextSlide.is($footer) ) {
7094			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
7095		}
7096
7097		if ( !UNCODE.isFullPageSnap ) {
7098			activateKBurns( nextIndex );
7099		}
7100
7101		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
7102			if ($(this).attr('data-provider') == 'vimeo') {
7103				iframe = $(this).find('iframe');
7104				player = new Vimeo.Player(iframe[0]);
7105				player.pause();
7106			} else if ($(this).attr('data-provider') == 'youtube') {
7107				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
7108			} else {
7109				if ($(this).is('video')) {
7110					$(this)[0].volume = 0;
7111					$(this)[0].pause();
7112				}
7113			}
7114		});
7115
7116		if ( ! UNCODE.isMobile && headerWithOpacity ) {
7117			if ( $nextSlide.is($header) )
7118				$header.removeClass('header-scrolled');
7119		}
7120
7121		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
7122		$otherEl.each(function(){
7123			var $otherThis = $(this),
7124				$bgwrapperOther = $('.background-inner', $otherThis);
7125			if ( !checkVisible($otherThis) )
7126				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
7127
7128		});
7129
7130		if ( !checkVisible($currentSlide) ) {
7131			$currentSlide.removeClass('uncode-scroll-visible');
7132			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
7133			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
7134				currentScroll.scrollTo(0, 0, 0);
7135		}
7136
7137		clearRequestTimeout(animationEndTimeOut);
7138		animationEndTimeOut = requestTimeout(function(){
7139			Waypoint.refreshAll();
7140			$( document.body ).trigger('uncode_waypoints');
7141			var eventFP = new CustomEvent('fp-slide-changed');
7142			window.dispatchEvent(eventFP);
7143			is_scrolling = false;
7144
7145			if ( is_first ) {
7146				$('ul.onepage-pagination a').removeClass('is-selected');
7147				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
7148				is_first = false;
7149			}
7150
7151		}, 500);
7152	};
7153
7154	var postLeaveActions = function( nextIndex ){
7155		if ( menuHidden && ! UNCODE.isMobile )
7156			return false;
7157
7158		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7159			$cols = $('.uncol', $el),
7160			anchor = $el.data('anchor');
7161
7162		if ( ! UNCODE.isFullPageSnap ) {
7163			$.each($cols, function(index, val){
7164				if ( $(val).hasClass('style-light') ){
7165					$masthead.removeClass('style-dark-override').addClass('style-light-override');
7166					return false;
7167				} else if ( $(val).hasClass('style-dark') ) {
7168					$masthead.removeClass('style-light-override').addClass('style-dark-override');
7169					return false;
7170				}
7171			});
7172		}
7173
7174		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
7175			$('.menu-item' ).removeClass('active');
7176			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
7177		}
7178
7179		if ( !UNCODE.isFullPageSnap ) {
7180			activateBackWash( nextIndex );
7181		}
7182	};
7183
7184	var activateBackWash = function( nextIndex ){
7185		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7186			$bgwrapper;
7187
7188		if ( $el.length ) {
7189			if ( $el.hasClass('with-zoomout') ) {
7190				$bgwrapper = $('.background-inner:nth-child(1)', $el);
7191			} else if ( $('.with-zoomout', $el).length ) {
7192				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
7193			} else {
7194				return false;
7195			}
7196		} else {
7197			return false;
7198		}
7199
7200		$bgwrapper.addClass('uncode-zoomout');
7201
7202	};
7203
7204	var activateKBurns = function( nextIndex ){
7205		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7206			$bgwrapper;
7207
7208		if ( $el.length ) {
7209			if ( $el.hasClass('with-kburns') ) {
7210				$bgwrapper = $('.background-inner:nth-child(1)', $el);
7211			} else if ( $('.with-kburns', $el).length ) {
7212				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
7213			} else {
7214				return false;
7215			}
7216		} else {
7217			return false;
7218		}
7219
7220		$bgwrapper.addClass('uncode-kburns');
7221
7222	};
7223
7224	var activateParallax = function( nextIndex, direction ){
7225
7226		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7227			$cell = $('.fp-tableCell', $el),
7228			animationEnd = 'webkitAnimationEnd animationend',
7229			cellAnim;
7230
7231		switch( direction ) {
7232			case 'up':
7233				cellAnim = 'moveFromTopInner';
7234				break;
7235			default:
7236				cellAnim = 'moveFromBottomInner';
7237		}
7238
7239		$cell.css({
7240			'animation-name': cellAnim,
7241			'animation-duration': fp_anim_time + 'ms',
7242			'animation-delay': '',
7243			'animation-timing-function': fp_easing,
7244			'animation-fill-mode': 'both',
7245		}).off(animationEnd)
7246		.on(animationEnd, function(event) {
7247			if ( event.originalEvent.animationName === cellAnim ) {
7248				$cell
7249					.css({
7250						'animation-name': '',
7251						'animation-duration': '',
7252						'animation-delay': '',
7253						'animation-timing-function': '',
7254						'animation-fill-mode': '',
7255					});
7256			}
7257		});
7258	};
7259
7260	var scrollHashes = function(){
7261		var hash = window.location.hash.replace('#', '').split('/'),
7262			hashInd;
7263		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
7264			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
7265				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
7266				$.fn.fullpage.moveTo(hashInd+1);
7267			}
7268		} else if( hash[0] === '' ) {
7269			$.fn.fullpage.moveTo(1);
7270		}
7271	};
7272
7273	var hideMenu = function( index, nextIndex ){
7274		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
7275			return false;
7276
7277		var hMenu = UNCODE.menuHeight,
7278			transTime = hMenu * 2;
7279
7280		if ( index === 1 && nextIndex > 1 ) {
7281			hMenu = hMenu * -1;
7282		} else if  ( index !== 1 && nextIndex === 1 ) {
7283			hMenu = 0;
7284		} else {
7285			return false;
7286		}
7287
7288		$masthead.css({
7289			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
7290			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
7291			'-webkit-transition': 'transform 0.5s ease-in-out',
7292			'transition': 'transform 0.5s ease-in-out'
7293		});
7294	};
7295
7296	var shrinkMenu = function( index, nextIndex ){
7297		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
7298			return false;
7299
7300		if ( index === 1 && nextIndex > 1 ) {
7301			$logo.addClass('shrinked');
7302			$('div', $logo).each(function(index, val){
7303				$(val).css({
7304					'height': logoMinScale,
7305					'line-height': logoMinScale
7306				});
7307				if ($(val).hasClass('text-logo')) {
7308					$(val).css({
7309						'font-size': logoMinScale + 'px'
7310					});
7311				}
7312			});
7313			requestTimeout(function() {
7314				UNCODE.menuMobileHeight = $masthead.outerHeight();
7315			}, 300);
7316		} else if ( index !== 1 && nextIndex === 1 ) {
7317			$logo.removeClass('shrinked');
7318			$('div', $logo).each(function(index, val){
7319				$(val).css({
7320					'height': logoMaxScale,
7321					'line-height': logoMaxScale
7322				});
7323				if ($(val).hasClass('text-logo')) {
7324					$(val).css({
7325						'font-size': logoMaxScale + 'px'
7326					});
7327				}
7328			});
7329			requestTimeout(function() {
7330				UNCODE.menuMobileHeight = $masthead.outerHeight();
7331			}, 300);
7332		} else {
7333			return false;
7334		}
7335
7336	};
7337
7338	var anchorLink = function(){
7339
7340		$container.add('.menu-item').find('a[href*="#"]').click(function(e) {
7341			var $this = $(e.currentTarget),
7342				hash = e.currentTarget.href.split('#'),
7343				current = window.location.href.split('#'),
7344				ind,
7345				currentMenuOpened = UNCODE.menuOpened,
7346				go = false;
7347
7348			var hash_url = hash[0].replace(/\/?$/, '/'),
7349				current_url = current[0].replace(/\/?$/, '/');
7350
7351			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
7352				hash = '#'+hash[1];
7353				e.preventDefault();
7354				go = true;
7355			}
7356
7357			if ( go ) {
7358
7359				if ( $(hash).length ) {
7360					ind = $(hash).closest('.fp-section').index();
7361				} else {
7362					hash = hash.slice(1);
7363					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
7364				}
7365
7366				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
7367					ind = $this.closest('.fp-section').index();
7368
7369				UNCODE.menuOpened = false;
7370
7371				$.fn.fullpage.moveTo(ind+1);
7372
7373				UNCODE.menuOpened = currentMenuOpened;
7374				if (UNCODE.menuOpened) {
7375					if (UNCODE.wwidth < UNCODE.mediaQuery) {
7376						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
7377					} else {
7378						$('.mmb-container-overlay .overlay-close').trigger('click');
7379						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
7380					}
7381				}
7382
7383			}
7384
7385		});
7386
7387		$('.header-scrolldown').on('click', function(event) {
7388			event.preventDefault();
7389			var scrollDown = $(this),
7390				ind = scrollDown.closest('.fp-section').index();
7391
7392			$.fn.fullpage.moveTo(ind+2);
7393		});
7394
7395		var anchor = $('.fp-section.active').data('anchor');
7396
7397		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
7398			$('.menu-item').removeClass('active');
7399			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
7400		}
7401
7402	};
7403
7404	var slideLeave = function( index, nextIndex, direction ) {
7405		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
7406			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7407			animationEnd = 'webkitAnimationEnd animationend',
7408			transitionEnd = 'webkitTransitionEnd transitionend',
7409			animOut = effect != 'scaleDown' ? effect + direction : effect,
7410			animIn,
7411			isFooter = false,
7412			isFooterNext = false,
7413			footerH = $footer.outerHeight(),
7414			timeout,
7415			player, iframe,
7416			footerCoeff;
7417		switch( direction ) {
7418			case 'up':
7419				animIn = 'moveFromTop';
7420				break;
7421			default:
7422				animIn = 'moveFromBottom';
7423		}
7424
7425		if ( $('body').hasClass('uncode-fullpage-trid') ) {
7426			animOut = animIn + 'trid';
7427			animIn = animOut + 'In';
7428		} else if ( UNCODE.isFullPageSnap ) {
7429			animIn = animOut = 'none';
7430		}
7431
7432		hideMenu(index, nextIndex);
7433		shrinkMenu(index, nextIndex);
7434
7435		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
7436			if ($(this).attr('data-provider') == 'vimeo') {
7437				iframe = $(this).find('iframe');
7438				player = new Vimeo.Player(iframe[0]);
7439				player.pause();
7440			} else if ($(this).attr('data-provider') == 'youtube') {
7441				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
7442			} else {
7443				if ($(this).is('video')) {
7444					$(this)[0].volume = 0;
7445					$(this)[0].pause();
7446				}
7447			}
7448		});
7449
7450		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
7451			if ($(this).attr('data-provider') == 'vimeo') {
7452				iframe = $(this).find('iframe');
7453				iframe.on('load', function(){
7454					player = new Vimeo.Player(iframe);
7455					player.setVolume(0);
7456					player.play();
7457				});
7458				player = new Vimeo.Player(iframe);
7459				player.setVolume(0);
7460				player.play();
7461			} else if ($(this).attr('data-provider') == 'youtube') {
7462				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
7463			} else {
7464				if ($(this).is('video')) {
7465					$(this)[0].volume = 0;
7466					$(this)[0].play();
7467				}
7468			}
7469		});
7470
7471		if ( $currentSlide.is($footer) )
7472			isFooter = true;
7473
7474		if ( $nextSlide.is($footer) )
7475			isFooterNext = true;
7476
7477		if ( ! UNCODE.isMobile && headerWithOpacity ) {
7478			if ( $currentSlide.is($header) )
7479				$header.addClass('header-scrolled');
7480		}
7481
7482		footerCoeff = footerH;
7483
7484		if ( UNCODE.isFullPageSnap ) {
7485			postLeaveActions( nextIndex );
7486			activateBackWash( nextIndex );
7487			activateKBurns( nextIndex );
7488			requestTimeout(function(){
7489				animationEndAction( index, nextIndex );
7490			}, fp_anim_time+150);
7491		} else {
7492			if ( isFooterNext ) {
7493
7494				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
7495				$iscrollWrapper.addClass('no-scrolloverflow');
7496
7497				$nextSlide
7498				.add($currentSlide)
7499				.addClass('uncode-scroll-front')
7500				.addClass('uncode-scroll-active')
7501				.addClass('uncode-scroll-visible');
7502				$container.css({
7503					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
7504					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
7505					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
7506					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
7507				}).off(transitionEnd)
7508				.one(transitionEnd, function(){
7509					animationEndAction( index, nextIndex );
7510				});
7511
7512			} else if ( isFooter ) {
7513
7514				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
7515				.add($currentSlide)
7516				.addClass('uncode-scroll-front')
7517				.addClass('uncode-scroll-active')
7518				.addClass('uncode-scroll-visible');
7519				$container.css({
7520					'-webkit-transform': 'translate3d(0, 0, 0)',
7521					'transform': 'translate3d(0, 0, 0)',
7522					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
7523					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
7524				})
7525				.one(transitionEnd, function(){
7526					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
7527						clearRequestTimeout(timeout);
7528						timeout = requestTimeout(function(){
7529							$.fn.fullpage.moveTo(nextIndex);
7530							slideLeave( index-1, nextIndex, 'up' );
7531							$container.off(transitionEnd);
7532						}, 50);
7533					}
7534					animationEndAction( index, nextIndex );
7535				});
7536
7537			} else {
7538
7539				postLeaveActions( nextIndex );
7540
7541				if ( !$('body').hasClass('uncode-fullpage-trid') )
7542					activateParallax( nextIndex, direction );
7543
7544				var $outBg = $('.background-wrapper', $currentSlide);
7545
7546				$nextSlide
7547				.addClass('uncode-scroll-front')
7548				.addClass('uncode-scroll-active')
7549				.addClass('uncode-scroll-visible')
7550				.addClass('uncode-scroll-animating-in')
7551				.css({
7552					'z-index':4,
7553					'animation-name': animIn,
7554					'animation-duration': fp_anim_time + 'ms',
7555					'animation-delay': '',
7556					'animation-timing-function': fp_easing,
7557					'animation-fill-mode': 'both',
7558					'transition': 'initial',
7559				}).off(animationEnd)
7560				.on(animationEnd, function(event) {
7561					if ( event.originalEvent.animationName === animIn ) {
7562						$(this)
7563							.addClass('uncode-scroll-already')
7564							.removeClass('uncode-scroll-front')
7565							.removeClass('uncode-scroll-animating-in')
7566							.css({
7567								'animation-name': '',
7568								'animation-duration': '',
7569								'animation-delay': '',
7570								'animation-timing-function': '',
7571								'animation-fill-mode': '',
7572								'transition': 'initial',
7573							});
7574
7575						$currentSlide
7576							.removeClass('uncode-scroll-active')
7577							.add($outBg)
7578							.css({
7579								'animation-name': '',
7580								'animation-duration': '',
7581								'animation-delay': '',
7582								'animation-timing-function': '',
7583								'animation-fill-mode': '',
7584								'transition': 'initial',
7585							});
7586
7587						animationEndAction( index, nextIndex );
7588
7589					}
7590
7591					if ( nextIndex > 1 )
7592						$('body').addClass('window-scrolled');
7593					else
7594						$('body').removeClass('window-scrolled');
7595				});
7596
7597				$currentSlide
7598					.addClass('uncode-scroll-animating-out')
7599					.removeClass('uncode-scroll-front')
7600					.css({
7601						'z-index':'1',
7602						'animation-name': animOut,
7603						'animation-duration': fp_anim_time + 'ms',
7604						'animation-delay': '',
7605						'animation-timing-function': fp_easing,
7606						'animation-fill-mode': 'both',
7607						'transition': 'initial',
7608						'will-change': 'auto'
7609					}).off(animationEnd)
7610					.on(animationEnd, function(event) {
7611						if ( event.originalEvent.animationName === animOut ) {
7612							$currentSlide.removeClass('uncode-scroll-animating-out');
7613						}
7614					});
7615
7616				if ( $('body').hasClass('uncode-fp-opacity') ) {
7617					$currentSlide.find('> div').css({
7618						'animation-name': 'opacityout',
7619						'animation-duration': fp_anim_time + 'ms',
7620						'animation-delay': '',
7621						'animation-timing-function': fp_easing,
7622						'animation-fill-mode': 'both',
7623						'transition': 'initial',
7624					}).off(animationEnd)
7625					.on(animationEnd, function(event) {
7626						if ( event.originalEvent.animationName === 'opacityout' ) {
7627							$(event.currentTarget).css({
7628								'animation-name': '',
7629								'animation-duration': '',
7630								'animation-delay': '',
7631								'animation-timing-function': '',
7632								'animation-fill-mode': '',
7633								'transition': '',
7634							});
7635						}
7636					});
7637				}
7638			}
7639		}
7640
7641		$('.scroll-top').on('click', function(e){
7642			$.fn.fullpage.moveTo(1);
7643			return false;
7644		});
7645
7646	};
7647
7648	var init_fullPage = function(mode){
7649
7650		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
7651		// 	scrollBar = false;
7652		// }
7653
7654		var checkFPeffects;
7655
7656		$container.fullpage({
7657			sectionSelector: '.uncode-scroll-lock',
7658			scrollOverflow: true,
7659			scrollOverflowOptions: {
7660				click: false,
7661				preventDefaultException: { tagName:/.*/ }
7662			},
7663			navigation: false,
7664			scrollBar: scrollBar,
7665			scrollingSpeed: fp_anim_time,
7666			verticalCentered: true,
7667			anchors: no_history ? false : dataNames,
7668			recordHistory: !no_history,
7669			afterRender: function(){
7670				$('body').removeClass('fp-waiting');
7671				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
7672					var $invisible = $(this).addClass('hidden-scroll');//,
7673				});
7674				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
7675					var $visible = $(this).addClass('uncode-scroll-visible'),
7676						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
7677					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
7678				});
7679
7680				$('ul.onepage-pagination a').on('click', function(e){
7681					e.preventDefault();
7682					var $a = $(this),
7683						toIndex = $a.data('index');
7684
7685					$.fn.fullpage.moveTo(toIndex+1);
7686				});
7687
7688				requestTimeout(function(){
7689					scrollHashes();
7690				}, 1000);
7691
7692				$(window).on('hashchange', function(e){
7693					requestTimeout(function(){
7694						scrollHashes();
7695					}, 500);
7696				});
7697
7698				anchorLink();
7699
7700				if ( $('body').hasClass('uncode-fp-opacity') ) {
7701					$all.each(function(index, row) {
7702						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
7703							classBg;
7704
7705						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
7706							classBg = testmatch[0];
7707							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
7708						}
7709					});
7710				}
7711
7712				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
7713					$(window).on('menuOpen gdprOpen', function(){
7714						$.fn.fullpage.setAutoScrolling(false);
7715					}).on('menuClose gdprClose', function(){
7716						$.fn.fullpage.setAutoScrolling(true);
7717					});
7718				}
7719
7720				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
7721					requestTimeout(function(){
7722						$.fn.fullpage.setAutoScrolling(false);
7723					}, 1000);
7724				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
7725					$.fn.fullpage.setAutoScrolling(true);
7726				});
7727
7728				if ( !UNCODE.isFullPageSnap ) {
7729					clearRequestTimeout(checkFPeffects);
7730					checkFPeffects = requestTimeout(function(){
7731						activateBackWash( 1 );
7732						activateKBurns( 1 );
7733					}, 100);
7734				}
7735
7736			},
7737			onLeave: function( index, nextIndex, direction ){
7738
7739				if ( UNCODE.menuOpened || is_scrolling )
7740					return false;
7741
7742				is_scrolling = true;
7743
7744				var event = new CustomEvent('fp-slide-leave');
7745				window.dispatchEvent(event);
7746
7747				slideLeave( index, nextIndex, direction );
7748
7749				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
7750					if ( direction === 'up' ) {
7751						$.fn.fullpage.moveTo(nextIndex-1);
7752					} else {
7753						$.fn.fullpage.moveTo(nextIndex+1);
7754					}
7755					return false;
7756				}
7757
7758				$('ul.onepage-pagination a').removeClass('is-selected');
7759				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
7760
7761			}
7762		});
7763	};
7764
7765	init_fullPage();
7766	$(window).on('load', function(){
7767		requestTimeout(function(){
7768			$.fn.fullpage.reBuild();
7769		}, 3000);
7770	});
7771
7772	var addScrollingClass,
7773		removeScrollingClass;
7774
7775	window.addEventListener("fp-slide-scroll", function(){
7776		addScrollingClass = requestTimeout( function(){
7777			$('body').addClass('fp-slide-scrolling');
7778		}, 10 );
7779
7780		clearRequestTimeout(removeScrollingClass);
7781		removeScrollingClass = requestTimeout( function(){
7782			$('body').removeClass('fp-slide-scrolling');
7783		}, 150 );
7784
7785		Waypoint.refreshAll();
7786	}, false);
7787
7788	var setFPheight = function(){
7789		var $body = document.body,
7790			$footer = document.getElementById('colophon'),
7791			$maincontainer = document.querySelector('.main-wrapper'),
7792			$boxcontainer = document.querySelector('.box-container'),
7793			$sections = document.querySelectorAll('.fp-section'),
7794			rect = $maincontainer.getBoundingClientRect(),
7795			rect2 = $boxcontainer.getBoundingClientRect(),
7796			$masthead = document.getElementById('masthead'),
7797			_hideMenu = false,
7798			menuHeight = UNCODE.menuHeight;
7799		$body.style.height = UNCODE.wheight + 'px';
7800
7801		if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) {
7802			_hideMenu = true;
7803		}
7804		if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) {
7805			menuHeight = 0
7806		}
7807
7808
7809		if ( theres_footer )
7810			$footer.style.top = (rect.height || rect2.height) + 'px';
7811
7812		for (var i = 0; i < $sections.length; i++) {
7813			$sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px';
7814		}
7815	};
7816
7817	setFPheight();
7818
7819	window.addEventListener('resize', setFPheight, false);
7820	window.addEventListener('orientationchange', setFPheight, false);
7821
7822};
7823
7824UNCODE.particles = function() {
7825	$(".vc-particles-background").each(function() {
7826		var $particle = $(this);
7827		var $parent = $particle.closest('[data-parent]');
7828
7829		$parent.prepend($particle);
7830		// $(window).trigger('resize');
7831	})
7832};
7833
7834
7835UNCODE.filters = function() {
7836	var $systems = $('.isotope-system, .cssgrid-system');
7837
7838	$systems.each(function(index, val){
7839		var $system = $(this),
7840			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system),
7841			$widgets = $('.widgetized-cb-wrapper', $system),
7842			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $system),
7843			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system),
7844			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system),
7845			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system);
7846
7847		if ($system.hasClass('isotope-processed')) {
7848			return;
7849		}
7850
7851		$cats_trigger.on('click', function(e) {
7852			if ( ! $('html').hasClass('screen-sm') ) {
7853				// $widgets.add($sorting_dd).slideUp(400);
7854				e.preventDefault();
7855				$widgets.slideUp(400, 'easeInOutCirc');
7856			}
7857		});
7858
7859		$('.filters-toggle-trigger', $system).on('click', function(e) {
7860			e.preventDefault();
7861			var $filters = $('.isotope-filters .menu-horizontal', $system);
7862			$filters.slideToggle(400, 'easeInOutCirc');
7863			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
7864		});
7865
7866		$widget_trgr.on('click', function(e) {
7867			e.preventDefault();
7868			$widgets.slideToggle(400, 'easeInOutCirc');
7869			if (!$('html').hasClass('screen-sm')) {
7870				$cats_filters.slideUp(400, 'easeInOutCirc');
7871			}
7872			window.dispatchEvent(new CustomEvent('boxResized'));
7873		});
7874
7875		$sorting_trgr.on('click', function(e) {
7876			e.preventDefault();
7877			if (!$('html').hasClass('screen-sm')) {
7878				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
7879			}
7880		});
7881
7882		$system.addClass('isotope-processed');
7883	});
7884
7885};
7886
7887UNCODE.widgets = function() {
7888	var widget_collapses = $('.widget-collapse');
7889
7890	widget_collapses.each(function(){
7891		var widget_collapse = $(this),
7892			widget_title = widget_collapse.find('.widget-title'),
7893			widget = widget_title.closest('.widget'),
7894			content = widget.children().not('.widget-title'),
7895			setCTA;
7896
7897		if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
7898			widget_title.toggleClass('open');
7899		}
7900
7901		widget_title.each(function() {
7902			var _this = $(this);
7903			var content = _this.closest('.widget').find('.widget-collapse-content');
7904
7905			$(window).on('load resize', function(){
7906				clearRequestTimeout(setCTA);
7907				setCTA = requestTimeout( function() {
7908					if ( content.is(':visible') ) {
7909						_this.addClass( 'open' );
7910					} else {
7911						_this.removeClass( 'open' );
7912					}
7913				}, 10 );
7914			})
7915
7916			_this.on( 'click', function(){
7917
7918				// Get content of :after element (+ icon) to check the visibility
7919				var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
7920
7921				if (icon_content === 'none' || !icon_content) {
7922					return false;
7923				}
7924
7925				_this.toggleClass('open');
7926				var isOpen = _this.hasClass('open'),
7927					hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27;
7928				content.animate({
7929					height: 'toggle',
7930					padding: 'toggle',
7931					opacity: 'toggle',
7932					top: isOpen ? 0 : hasBorder
7933				}, {
7934					duration: 400,
7935					easing: "easeInOutCirc",
7936				});
7937
7938				return false;
7939
7940			});
7941		});
7942	});
7943
7944	var $widgets_without_title = $('.collapse-init').removeClass('collapse-init');
7945};
7946
7947UNCODE.unmodal = function() {
7948	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
7949		$('.unmodal-overlay').fadeIn();
7950		$('.unmodal-overlay').addClass('loading');
7951		$('body').addClass('uncode-unmodal-overlay-visible');
7952		$(window).trigger('unmodal-open');
7953	});
7954
7955	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
7956		$('.unmodal-overlay').fadeOut();
7957		$('.unmodal').fadeOut();
7958		$('body').removeClass('uncode-unmodal-overlay-visible');
7959		$('body').removeClass('uncode-unmodal-open');
7960		$('html').removeClass('uncode-unmodal-body-disable-scroll');
7961		$(document).trigger('unmodal-close');
7962		UNCODE.isUnmodalOpen = false;
7963	});
7964
7965	$(document).on('uncode-unmodal-show-content', function() {
7966		$('.unmodal-overlay').removeClass('loading');
7967		$('.unmodal').show();
7968		$('.unmodal').addClass('show-unmodal-with-animation');
7969		$('.unmodal-content')[0].scrollTop = 0;
7970		$('body').addClass('uncode-unmodal-open');
7971		UNCODE.isUnmodalOpen = true;
7972
7973		if ($('body').hasClass('qw-body-scroll-disabled')) {
7974			$('html').addClass('uncode-unmodal-body-disable-scroll');
7975		}
7976
7977		if ($('.unmodal').hasClass('auto-height')) {
7978			set_modal_height();
7979		}
7980	});
7981
7982	var set_modal_height = function() {
7983		var modal = $('.unmodal');
7984		var window_height = $(window).outerHeight();
7985		var modal_height = modal.outerHeight();
7986
7987		modal.css('height', 'auto');
7988
7989		if (modal_height > window_height) {
7990			modal.outerHeight(window_height);
7991		}
7992	}
7993
7994	if ($('.unmodal').hasClass('auto-height')) {
7995		var setCTA;
7996
7997		$(window).on('resize', function() {
7998			clearRequestTimeout(setCTA);
7999			setCTA = requestTimeout(function() {
8000				set_modal_height();
8001			}, 100);
8002		});
8003	}
8004};
8005
8006UNCODE.bgChanger = function() {
8007	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
8008		$bg_first = $('.vc_row[data-bg-remove]'),
8009		bg_remove = $bg_first.attr('data-bg-remove'),
8010		$first = $bg_changers.first(),
8011		$last = $bg_changers.last(),
8012		$bg_wrapper = $('#changer-back-color'),
8013		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
8014		setCTA, localH = UNCODE.wheight,
8015		isScrolling;
8016
8017	$bg_first.removeClass(bg_remove);
8018
8019	var bgChange = function($col, bgColor, skin, tmbskin){
8020		$bg_wrapper.attr( 'class', bgColor );
8021		var menuskin;
8022		if ( typeof skin !== 'undefined' ) {
8023			menuskin = skin.replace('style', 'menu')
8024		}
8025
8026		if ( $col.length ) {
8027			$('.uncol[data-skin-change]').each(function(){
8028				var $isoFooter = $('.isotope-footer', this);
8029				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
8030				if ( menuskin !== '' ) {
8031					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
8032				}
8033			});
8034
8035			$('.tmb[data-skin-change]').each(function(){
8036				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
8037			});
8038		}
8039	};
8040
8041	var $masthead = $('#masthead'),
8042		transDesktop,
8043		transMobile,
8044		changeSkin,
8045
8046	checkTransparencyAndChange = function( skin ){
8047		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
8048		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
8049		changeSkin = $masthead.hasClass('menu-change-skin');
8050
8051		if ( ! transDesktop && ! transMobile ) {
8052			return false;
8053		}
8054
8055		if ( ! changeSkin ) {
8056			return false;
8057		}
8058
8059		if ( skin === 'style-light' ){
8060			$masthead.removeClass('style-dark-override').addClass('style-light-override');
8061			return false;
8062		} else if ( skin === 'style-dark' ) {
8063			$masthead.removeClass('style-light-override').addClass('style-dark-override');
8064			return false;
8065		}
8066	};
8067
8068	var bg_waypoints = function(){
8069		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
8070
8071			$.each($bg_changers, function(index, row) {
8072
8073				var $row = $(row),
8074					$col = $('.uncol[data-skin-change]', $row).eq(0),
8075					skin,
8076					$tmbs,
8077					tmbskin,
8078					bgColor = $row.attr('data-bg-color');
8079
8080				if ( ! $row.is(':visible') ) {
8081					return false;
8082				}
8083
8084				if ( $col.length ) {
8085					skin = $col.attr('data-skin-change');
8086					$tmbs = $('.tmb[data-skin-change]', $row);
8087					tmbskin = skin.replace('style', 'tmb');
8088				}
8089
8090				if ( ! $row.hasClass('unscroll-horizontal') ) {
8091					$row.waypoint(function( dir ) {
8092						if ( dir === 'down' ) {
8093							bgChange($col, bgColor, skin, tmbskin);
8094							checkTransparencyAndChange(skin);
8095						} else {
8096							return;
8097						}
8098					}, {
8099						offset: '50%'
8100		  			});
8101
8102					$row.waypoint(function( dir ) {
8103						if ( dir === 'up' ) {
8104							bgChange($col, bgColor, skin, tmbskin);
8105							checkTransparencyAndChange(skin);
8106						} else {
8107							return;
8108						}
8109					}, {
8110						offset: function() {
8111							var clH = this.element.clientHeight,
8112								wH = window.innerHeight,
8113								ret = clH > 200 ? -100 : clH * -0.5;
8114							return ( wH / 2 ) - clH;
8115						}
8116					});
8117				}
8118
8119			});
8120
8121			$('body').addClass('bg-changer-init');
8122
8123		}
8124	};
8125
8126	var body = document.body,
8127	edges = false;
8128
8129	var throttle = function(fn, wait) {
8130		var time = Date.now();
8131		return function() {
8132			if ((time + wait - Date.now()) < 0) {
8133				fn();
8134				time = Date.now();
8135			}
8136		}
8137	}
8138
8139	var $wrapper = document.querySelector(".main-wrapper"),
8140		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
8141
8142	var $title = document.querySelector('#rotating');
8143	if ( $title !== null ) {
8144		$title.style.whiteSpace = 'nowrap';
8145		$title.style.transition = 'transform 200ms linear';
8146	}
8147
8148	window.addEventListener( 'scroll', throttle( function() {
8149		window.clearRequestTimeout( isScrolling );
8150
8151		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
8152
8153			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
8154				body = document.body,
8155				html = document.documentElement,
8156				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
8157				$row = false,
8158				firstOff,
8159				lastOff;
8160
8161			if ( scrolled < 100 && $first.length ) {
8162				firstOff = $first.offset().top;
8163				if ( firstOff < 100 ) {
8164					var $row = $first;
8165				}
8166			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
8167				lastOff = $last.offset().top + $last.outerHeight();
8168				if ( lastOff > ( docH - 100 ) ) {
8169					var $row = $last;
8170				}
8171			}
8172
8173			if ( $row.length ) {
8174				var $col = $('.uncol[data-skin-change]', $row).eq(0),
8175					skin,
8176					$tmbs,
8177					tmbskin,
8178					bgColor = $row.attr('data-bg-color');
8179
8180				if ( $col.length ) {
8181					skin = $col.attr('data-skin-change');
8182					$tmbs = $('.tmb[data-skin-change]', $row);
8183					tmbskin = skin.replace('style', 'tmb');
8184				}
8185
8186				bgChange($col, bgColor, skin, tmbskin);
8187				checkTransparencyAndChange(skin);
8188				edges = true;
8189			}
8190
8191		}, 150);
8192
8193		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
8194			bg_waypoints();
8195			Waypoint.refreshAll();
8196			edges = false;
8197		}
8198
8199	}, 100), false);
8200
8201	$(window).on('resize', function() {
8202		clearRequestTimeout(setCTA);
8203		setCTA = requestTimeout(function() {
8204			if ( localH != UNCODE.wheight ) {
8205				localH = UNCODE.wheight;
8206				bg_waypoints();
8207				Waypoint.refreshAll();
8208			}
8209		}, 100);
8210	});
8211
8212	bg_waypoints();
8213
8214};
8215
8216UNCODE.skewIt = function() {
8217
8218	if ( $('body').hasClass('compose-mode') ) {
8219		return;
8220	}
8221
8222	var justscrolled = false;
8223
8224	var loadSkewIt = function(){
8225
8226		var $pageHeader = $('#page-header'),
8227			$page_body = $('.page-body'),
8228			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
8229
8230		if ( $header_skew.length ) {
8231			$pageHeader.addClass('uncode-skew').css({
8232				position: 'relative',
8233				zIndex: 1
8234			});
8235			$header_skew.removeClass('uncode-skew');
8236			$page_body.css({
8237				position: 'relative',
8238				zIndex: 0
8239			});
8240		}
8241
8242		var $skew = $('.uncode-skew'),
8243			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
8244			horizontal = $horizontal.length,
8245			stopSkewing,
8246			lastOffset = 0,
8247			lastDate = Date.now();
8248
8249		if ( ! $skew.length ) {
8250			return;
8251		}
8252
8253		var dropSkew = function(){
8254			if ( UNCODE.wwidth < UNCODE.mediaQuery )
8255				return;
8256
8257			$skew.each(function(){
8258				var $this = $(this),
8259					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
8260
8261				if ( $drop.length ) {
8262					$this.css({
8263						'transform': 'skew(0)'
8264					});
8265					var bound = $this[0].getBoundingClientRect();
8266					$drop.css({
8267						left: bound.x * -1,
8268						top: bound.y * -1,
8269					});
8270				}
8271			});
8272		};
8273		dropSkew();
8274
8275		$(window).on('resize', dropSkew);
8276
8277		window.addEventListener( 'scroll', function() {
8278
8279			if ( justscrolled !== true ) {
8280				justscrolled = true;
8281				return;
8282			}
8283
8284			window.clearRequestTimeout( stopSkewing );
8285
8286			var now = Date.now(),
8287				delayInMs = now - lastDate,
8288				offset = window.pageYOffset || window.document.documentElement.scrollTop,
8289				newOffset = offset - lastOffset,
8290				speed = Math.pow((newOffset / delayInMs), 3) * -1,
8291				body = document.body,
8292				html = document.documentElement,
8293				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
8294				wait = 50,
8295				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
8296
8297			if ((lastDate + wait - now) < 0) {
8298
8299				lastDate = now;
8300				lastOffset = offset;
8301
8302				if ( speed > 6 ) {
8303					speed = 6;
8304				} else if ( speed < -6 ) {
8305					speed = -6;
8306				}
8307
8308				if ( speed > 2 && offset < UNCODE.wheight ) {
8309					speed = 2;
8310				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
8311					speed = -2;
8312				}
8313
8314				var speedY = speed,
8315					speedX = speed * 1.25;
8316
8317				if ( horizontal ) {
8318					speedY = 0;
8319					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
8320						speedX = 0;
8321						return;
8322					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
8323						speedX = 0;
8324						return;
8325					}
8326				} else {
8327					speedX = 0;
8328				}
8329
8330				if ( ! $skew.closest('.enter-st').length ) {
8331					speedX = 0;
8332				}
8333
8334				gsap.killTweensOf($skew);
8335				gsap.to( $skew, {
8336					duration: 0.2,
8337					skewY: (speedY * maxSpeed) + "deg",
8338					skewX: (speedX * maxSpeed) + "deg",
8339					ease: Power0.easeNone,
8340					transformOrigin: 'center',
8341				});
8342
8343			}
8344
8345			stopSkewing = requestTimeout(function() {
8346				gsap.killTweensOf($skew);
8347				gsap.to( $skew, {
8348					duration: 0.5,
8349					skewY: "0deg",
8350					skewX: "0deg",
8351					transformOrigin: 'center',
8352					ease: Expo.easeOut,
8353				});
8354
8355				$skew.each(function(){
8356					var $this = $(this),
8357						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
8358
8359					if ( $drop.length ) {
8360						var bound = $this[0].getBoundingClientRect()
8361						$drop.css({
8362							left: bound.x * -1,
8363							top: bound.y * -1,
8364						});
8365					}
8366				});
8367
8368			}, 200);
8369
8370		}, false);
8371
8372	};
8373
8374	$(window).on('load', loadSkewIt);
8375
8376};
8377
8378UNCODE.rotateIt = function() {
8379
8380	if ( $('body').hasClass('compose-mode') ) {
8381		return;
8382	}
8383
8384	var loadRotateIt = function(){
8385
8386		var $toRotate = $('.uncode-rotate');
8387
8388		$toRotate.each(function(){
8389			var $rotate = $(this),
8390				deg = 0,
8391				dir = true,
8392				coeff = 1,
8393				lastOffset = 0,
8394				lastDate = Date.now();
8395
8396			var checkScroll = function($rotate){
8397				// if ( ! $rotate.length ) {
8398				// 	return;
8399				// }
8400
8401				var now = Date.now(),
8402					delayInMs = now - lastDate,
8403					offset = window.pageYOffset || window.document.documentElement.scrollTop,
8404					newOffset = offset - lastOffset,
8405					speed = (newOffset / delayInMs) * 5,
8406					body = document.body,
8407					html = document.documentElement,
8408					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
8409
8410				lastDate = now;
8411				lastOffset = offset;
8412
8413				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
8414					deg = 0;
8415				}
8416
8417				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
8418					deg = parseFloat(deg) + parseFloat(speed);
8419				}
8420
8421				if ( $rotate.hasClass('uncode-rotate-hover') ) {
8422					$rotate.hover(function(){
8423						coeff = 1.75;
8424					}, function(){
8425						coeff = 1;
8426					});
8427				}
8428
8429				// if ( speed > 0 ) {
8430				// 	dir = true
8431				// } else if ( speed < 0 ) {
8432				// 	dir = false
8433				// }
8434
8435				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
8436					deg = deg+coeff;
8437					// if ( dir ) {
8438					// 	deg = deg+coeff;
8439					// } else {
8440					// 	deg = deg-coeff;
8441					// }
8442				}
8443
8444				$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
8445
8446				requestAnimationFrame(function() {
8447					checkScroll($rotate);
8448				});
8449
8450			};
8451
8452			checkScroll($rotate);
8453
8454		});
8455
8456	};
8457
8458	$(window).on('load', loadRotateIt);
8459
8460};
8461
8462var marqueeAttempts = 0,
8463	marqueeTO;
8464
8465UNCODE.textMarquee = function( $titles ) {
8466
8467	var initTextMarquee = function( $titles ){
8468
8469		if ( typeof $titles == 'undefined' ) {
8470			$titles = $('.un-text-marquee');
8471		}
8472
8473		if ( ! $titles.length ) {
8474			return;
8475		}
8476
8477		$titles.each(function(){
8478			var $title = $(this),
8479				$span = $('> span', $title),
8480				txt,
8481				first = true,
8482				newW = UNCODE.wwidth;
8483
8484			$('.marquee-clone-wrap', $title).remove();
8485
8486			txt = $title.text();
8487
8488			if ( ! $('.marquee-original-core', $span).length ) {
8489				$span = $('> span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
8490			}
8491
8492			var checkResize,
8493				spanW,
8494				$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
8495				$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
8496				clearSpeed,
8497				speed = 10;
8498
8499			$span.prepend($prepended);
8500			$span.append($appended);
8501
8502			var continuousTextMarquee = function(){
8503				var bound = $title.css({
8504						'transform': 'none',
8505						'opacity': 0
8506					}).offset();
8507
8508				var xStrt = first || $title.hasClass('un-marquee-infinite') ? 0 : UNCODE.wwidth - bound.left,
8509					xEnd = $title.hasClass('un-marquee-infinite') ? spanW : ( spanW + bound.left ),
8510					xSpeed = $title.hasClass('un-marquee-infinite') ? ( spanW + bound.left ) : ( xStrt + ( UNCODE.wwidth + bound.left ) ),
8511					direction = $title.hasClass('un-marquee-opposite') ? 1 : -1;
8512
8513				var marqueeTL = new TimelineMax({paused:true, reversed:true});
8514
8515				var inViewElement = $title.closest('.sticky-trigger').length || $title.closest('.pin-spacer').length ? $title.closest('.vc_row')[0] : $title[0];
8516
8517				var inview = new Waypoint.Inview({
8518					element: inViewElement,
8519					enter: function(direction) {
8520						marqueeTL.play();
8521					},
8522					exited: function(direction) {
8523						marqueeTL.pause();
8524					}
8525				});
8526
8527				//gsap.killTweensOf($title);
8528				marqueeTL.fromTo( $title, {
8529					opacity: 1,
8530					x: xStrt * direction * -1
8531				},
8532				{
8533					duration: xSpeed / UNCODE.wwidth * speed,
8534					x: xEnd * direction,
8535					onComplete: function(){
8536						first = false;
8537						continuousTextMarquee();
8538					},
8539					ease: Linear.easeNone
8540				});
8541			};
8542
8543			var runTextMarquee = function(){
8544				var time = Date.now();
8545
8546				var textMarqueeScroll = function(){
8547					var $row = $title.closest('.vc_row'),
8548						$bound = $title.closest('.pin-spacer').length ? $row : $title,
8549						bound = $bound[0].getBoundingClientRect(),
8550						wait = 100,
8551						direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1;
8552
8553					if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 &&
8554						bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 &&
8555						marqueeAttempts < 2 ) {
8556
8557						clearRequestTimeout(marqueeTO);
8558
8559						marqueeTO = requestTimeout(function(){
8560							marqueeAttempts++;
8561							initTextMarquee();
8562						}, 100);
8563					}
8564
8565					//if ((time + wait - Date.now()) < 0) {
8566						//if ( bound.top > ( bound.height * -4 ) && ( bound.top - bound.height ) < UNCODE.wheight * 2 ) {
8567							// $title[0].style.transform = 'translateX(' + ( UNCODE.wheight * 0.5 - bound.top ) * 0.75 + 'px)';
8568							gsap.killTweensOf($title);
8569							gsap.to( $title, {
8570								duration: 0.24,
8571								x: ( UNCODE.wheight * 0.35 - bound.top ) * 0.5 * direction,
8572								//ease: Expo.easeOut,
8573							});
8574						//}
8575						//time = Date.now();
8576					//}
8577				};
8578
8579				textMarqueeScroll();
8580				$(window).on( 'load scroll', function() {
8581					textMarqueeScroll();
8582				});
8583
8584			};
8585
8586			var cloneSpan = function($_title, cntnt){
8587
8588				if ( $_title.hasClass('un-marquee-infinite') ) {
8589					$('> span.marquee-clone-wrap', $_title).text('');
8590				}
8591
8592				gsap.to( $_title, {
8593					duration: 0,
8594					x: 0
8595				});
8596				spanW = $span.outerWidth();
8597
8598				if ( !spanW ) {
8599					return;
8600				}
8601
8602				var part = Math.ceil( UNCODE.wwidth / spanW ) * 2;
8603
8604				if ( $_title.hasClass('un-marquee-infinite') ) {
8605
8606					for ( var i = 0; i < part; i++ ) {
8607						$prepended[0].textContent += cntnt + "\u00A0";
8608						$appended[0].textContent += cntnt + "\u00A0";
8609					}
8610				}
8611
8612				if ( $('body').hasClass('compose-mode') ) {
8613					return;
8614				}
8615
8616				if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
8617					continuousTextMarquee();
8618				}
8619
8620				if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
8621					runTextMarquee();
8622				}
8623
8624			};
8625
8626			var marqueResize = function(){
8627				clearRequestTimeout(checkResize);
8628				checkResize = requestTimeout(function(){
8629					if ( newW !== UNCODE.wwidth ) {
8630						gsap.killTweensOf($title);
8631						initTextMarquee();
8632						newW = UNCODE.wwidth;
8633					}
8634				}, 1000);
8635			};
8636
8637			$(window).off('resize', marqueResize)
8638			.on( 'resize', marqueResize);
8639
8640			cloneSpan($title, txt);
8641
8642			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
8643				window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
8644					// imageHover();
8645					var $_titles = $('.un-text-marquee',e.view.$el);
8646					initTextMarquee($_titles);
8647				});
8648			}
8649		});
8650	};
8651
8652	$(document).ready(function(){
8653		initTextMarquee();
8654	});
8655
8656};
8657
8658UNCODE.parallax = function() {
8659	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
8660		if ($('.parallax-el').length > 0) {
8661			var parallax_elements = new Rellax('.parallax-el');
8662			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
8663			window.addEventListener('boxResized', function(e) {
8664				parallax_elements.refresh();
8665			}, false);
8666			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
8667				requestTimeout(function() {
8668					parallax_elements.refresh();
8669				}, 100);
8670			});
8671
8672		}
8673	}
8674};
8675
8676UNCODE.magicCursor = function(){
8677	var $customCursor = $('#uncode-custom-cursor'),
8678		$customPilot = $('#uncode-custom-cursor-pilot'),
8679		$postLists = $('.uncode-post-titles'),
8680		currentCursor = 'auto',
8681		setTime,
8682		isScrolling,
8683		mouseEvent;
8684
8685	function delayChangeCursor(cursorType, delayt_time){
8686		clearRequestTimeout(setTime);
8687		setTime = requestTimeout(function() {
8688			$customCursor.attr('data-cursor', cursorType);
8689			if ( $customPilot.length ) {
8690				$customPilot.attr('data-cursor', cursorType);
8691			}
8692			currentCursor = cursorType;
8693		}, delayt_time);
8694	}
8695
8696	function changeCursor($wrap){
8697		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
8698		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]',
8699			$href = $wrap.find(href),
8700			cursorType,
8701			setTime, set_delay;
8702
8703		$href.hover(function(e) {
8704			var $this = $(this),
8705				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
8706				is_frontend_editor = $this.closest('.vc_controls').length,
8707				hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length,
8708				$parent_cursor = $this.closest('[class*="custom-cursor"]');
8709			if ( is_frontend_editor ) {
8710				cursorType = 'auto';
8711			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
8712				cursorType = data_cursor;
8713			} else if ( $parent_cursor.length ) {
8714				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
8715					cursorType = 'icon-light';
8716				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
8717					cursorType = 'icon-diff';
8718				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
8719					cursorType = 'icon-accent';
8720				} else {
8721					cursorType = 'icon-dark';
8722				}
8723			} else {
8724				cursorType = 'pointer';
8725			}
8726			delayChangeCursor(cursorType, 0);
8727		}, function(){
8728			delayChangeCursor('auto', 150);
8729		});
8730
8731		$(window).on('disable-hover', function(event) {
8732			document.addEventListener("mousemove", function(e) {
8733				mouseEvent = e;
8734			});
8735			delayChangeCursor('auto', 0);
8736		});
8737
8738		$(window).on('enable-hover', function(event) {
8739			if ( typeof mouseEvent !== 'undefined' ) {
8740				var x = mouseEvent.clientX,
8741					y = mouseEvent.clientY;
8742
8743				var elements = document.elementsFromPoint(x, y),
8744					$element = $(elements[0]);
8745
8746				$element.closest(href).trigger('mouseenter');
8747			}
8748		});
8749
8750	}
8751
8752	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
8753		changeCursor();
8754	});
8755
8756	$(document).ajaxComplete(function( event, xhr, settings ) {
8757		changeCursor();
8758	});
8759
8760	$('.isotope-container').on('isotope-layout-complete', function() {
8761		var $this = $(this);
8762		changeCursor($this);
8763	});
8764
8765};
8766
8767UNCODE.magneticCursor = function(){
8768	function magneticCursor($wrap){
8769		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
8770		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'));
8771
8772		$magnetics.on('mousemove', function(e){
8773			var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this),
8774				bound = e.currentTarget.getBoundingClientRect(),
8775				coeff = 30,
8776				hor = (bound.width / 2) - (e.clientX - bound.left),
8777				ver = (bound.height / 2) - (e.clientY - bound.top),
8778				toX = hor / bound.width * coeff,
8779				toY = ver / bound.height * coeff,
8780				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
8781				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
8782				toScale = Math.max(scaleX, scaleY);
8783
8784			gsap.killTweensOf($el);
8785			gsap.to( $el, {
8786				duration: 0.75,
8787				x: toX,
8788				y: toY,
8789				scale: toScale,
8790				ease: Power1.easeOut,
8791				transformPerspective: 900,
8792				transformOrigin: 'center',
8793				force3D: true
8794			});
8795		}).on('mouseout', function(e){
8796			var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this);
8797			gsap.killTweensOf($el);
8798			gsap.to( $el, {
8799				duration: 0.6,
8800				y: 0,
8801				x: 0,
8802				scale: 1,
8803				ease: Power1.easeOut,
8804				transformPerspective: 900,
8805				transformOrigin: 'center',
8806				force3D: true
8807			});
8808		});
8809	};
8810
8811	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
8812		magneticCursor();
8813	});
8814
8815	$(document).ajaxComplete(function( event, xhr, settings ) {
8816		magneticCursor();
8817	});
8818
8819	$('.isotope-container').on('isotope-layout-complete', function() {
8820		var $this = $(this);
8821		magneticCursor($this);
8822	});
8823
8824};
8825
8826UNCODE.dropImage = function() {
8827
8828	/****************************
8829	 * Image hover *
8830	****************************/
8831	function imageHover(){
8832		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
8833			return;
8834		}
8835
8836		var $postLists = $('.uncode-post-titles');
8837		$postLists.each(function(){
8838			var $list = $(this),
8839				timing = parseFloat( $list.attr('data-timing') ),
8840				default_image = $list.hasClass('uncode-post-titles-default-image'),
8841				default_title = $list.hasClass('uncode-post-titles-default-title'),
8842				$tmbs = $('.tmb', $list),
8843				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
8844				clientX,
8845				clientY,
8846				$row_parent = $list.closest('.vc_row'),
8847				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
8848				$col_parent = $list.closest('.uncell'),
8849				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
8850				setCTA;
8851
8852			timing *= 0.001;
8853
8854			var drop_bgs = function(){
8855				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
8856					var $drop = $(this),
8857						srcset = $drop.attr('data-bgset'),
8858						setArr = srcset.split(","),
8859						setArrOrder = [],
8860						biggest = 0,
8861						checkBg = false,
8862						desktopBG = $drop.data('[data-background-image]'),
8863						mobileBG = $drop.data('[data-mobile-background-image]');
8864
8865					if ( $drop.hasClass('srcset-bg-async') ) {
8866
8867						if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) {
8868							return;
8869						}
8870						
8871					}
8872
8873					if ( SiteParameters.uncode_adaptive == true ) {
8874						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
8875							$drop.css({
8876								'background-image' : 'url(' + setArr[0] + ')'
8877							});
8878						}
8879					} else {
8880						for ( var i = 0; i < setArr.length; i++ ) {
8881							var setLoop = setArr[i].trim().split(" ");
8882							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
8883								var parseSet = parseFloat(setLoop[1]);
8884								if ( biggest < parseSet ) {
8885									biggest = parseSet;
8886								}
8887								setArrOrder[parseSet] = setLoop[0];
8888								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
8889									checkBg = true;
8890									$drop.css({
8891										'background-image' : 'url(' + setLoop[0] + ')'
8892									});
8893								}
8894							}
8895						}
8896
8897						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
8898							$drop.css({
8899								'background-image' : 'url(' + setArrOrder[biggest] + ')'
8900							});
8901						}
8902					}
8903
8904				});
8905			};
8906
8907			drop_bgs();
8908
8909			var dropMovesSize = function(){
8910				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
8911					return;
8912				}
8913				$drop_moves.each(function(){
8914					var $drop_move = $(this),
8915						dataW = $drop_move.attr('data-w'),
8916						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
8917					if ( typeof dataW !== 'undefined' && dataW !== null ) {
8918						dataW = screenInfo.width / 12 * parseFloat( dataW );
8919					}
8920					$drop_moves.css({
8921						width: dataW
8922					});
8923
8924					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
8925						$anim_parent.on('animationend', function(){
8926							var bound = $anim_parent[0].getBoundingClientRect();
8927							$drop_move.css({
8928								left: bound.x * -1,
8929								top: bound.y * -1,
8930							});
8931						});
8932					}
8933				});
8934
8935
8936			};
8937
8938			dropMovesSize();
8939
8940			$(window).on( 'resize', function(){
8941				clearRequestTimeout(setCTA);
8942				setCTA = requestTimeout( function() {
8943					drop_bgs();
8944					dropMovesSize();
8945				}, 100 );
8946			});
8947
8948			if ( $drop_row_parents.length ) {
8949				$row_parent.addClass( 'drop-added' );
8950			}
8951
8952			$drop_row_parents.each(function(index, val){
8953				var $drop = $(val);
8954				$row_parent.prepend($drop);
8955				manageVideos($drop, false);
8956				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
8957					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
8958				}
8959				if ( default_image && index == 0 ) {
8960					manageVideos($drop, true);
8961					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
8962						image_ph = new Image();
8963					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
8964						image_ph.onload = function() {
8965							$drop.addClass('active');
8966							if ( default_title ) {
8967								$list.addClass('drop-hover');
8968								$tmbs.first().addClass('drop-active');
8969							}
8970						};
8971						image_ph.src = bg_img;
8972					}
8973				}
8974			});
8975
8976			if ( $drop_col_parents.length ) {
8977				$col_parent.addClass( 'drop-added' );
8978			}
8979
8980			$drop_col_parents.each(function(index, val){
8981				var $drop = $(this);
8982				$col_parent.prepend($drop);
8983				manageVideos($drop, false);
8984				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
8985					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
8986				}
8987				if ( default_image && index == 0 ) {
8988					manageVideos($drop, true);
8989					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
8990						image_ph = new Image();
8991					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
8992						image_ph.onload = function() {
8993							$drop.addClass('active');
8994							if ( default_title ) {
8995								$list.addClass('drop-hover');
8996								$tmbs.first().addClass('drop-active');
8997							}
8998						};
8999						image_ph.src = bg_img;
9000					}
9001				}
9002			});
9003
9004			function manageVideos( $el, start ) {
9005				var videoElem = $('video', $el),
9006					$iframe = $('iframe', $el),
9007					iframeID = $iframe.attr('id');
9008				if ( videoElem.length ) {
9009					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
9010						if ( start ) {
9011							videoElem[0].setCurrentTime(0);
9012							videoElem[0].play();
9013						} else {
9014							videoElem[0].pause();
9015							videoElem[0].setCurrentTime(0);
9016						}
9017					} else {
9018						if ( start ) {
9019							videoElem[0].currentTime = 0;
9020							videoElem[0].play();
9021						} else {
9022							videoElem[0].pause();
9023							videoElem[0].currentTime = 0;
9024						}
9025					}
9026				}
9027
9028				$el.data('active', start);
9029
9030				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
9031					var iframeIDv = iframeID.replace('okplayer-', ''),
9032						optionsV = $(window).data('okoptions-' + iframeIDv),
9033						vimeo = $iframe[0],
9034						playerV = new Vimeo.Player(vimeo),
9035						timeV = 0;
9036
9037					if (optionsV.time != null) {
9038						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
9039						for ( var i = 0; i < timeArr.length; i++ ) {
9040							if ( timeArr[i] === 'h' ) {
9041								timeV += parseFloat(timeArr[i-1]) * 3600;
9042							} else if ( timeArr[i] === 'm' ) {
9043								timeV += parseFloat(timeArr[i-1]) * 60;
9044							} else if ( timeArr[i] === 's' ) {
9045								timeV += parseFloat(timeArr[i-1]);
9046							}
9047						}
9048					}
9049					playerV.setCurrentTime(timeV);
9050					if ( start ) {
9051						playerV.setVolume(0);
9052						playerV.play();
9053					} else {
9054						playerV.pause();
9055					}
9056				} else if ( $el.attr('data-provider') === 'youtube' ) {
9057					if ( start ) {
9058						$el.trigger('uncode-resume');
9059					} else {
9060						$el.trigger('uncode-pause');
9061					}
9062				}
9063
9064			}
9065
9066			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
9067
9068				document.addEventListener("mousemove", function(e) {
9069					$drop_moves.each(function(){
9070						var $drop_move = $(this),
9071							duration = 0.4;
9072
9073						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
9074							duration = 0.8;
9075						}
9076
9077						clientX = e.clientX;
9078						clientY = e.clientY;
9079
9080						gsap.to( $drop_move, {
9081							duration: duration,
9082							x: clientX,
9083							y: clientY,
9084							ease: Power1.easeOut,
9085						});
9086					});
9087				});
9088
9089			} else {
9090
9091				$(window).on("touchend scroll", function(e) {
9092					$list.removeClass('drop-hover');
9093					$drop_moves.removeClass('active');
9094					$tmbs.removeClass('drop-active');
9095				});
9096
9097				$drop_moves.each(function(){
9098					var $drop_move = $(this),
9099						$tmb = $drop_move.closest('.tmb'),
9100						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
9101
9102					if ( $anim_parent.hasClass('uncode-skew') ) {
9103						$anim_parent.css({
9104							'transform': 'skew(0)'
9105						});
9106					}
9107
9108					$tmb.on('touchend', function(e){
9109						e.stopPropagation();
9110
9111						$drop_moves.removeClass('active');
9112						$tmbs.removeClass('drop-active');
9113
9114						$list.addClass('drop-hover');
9115						$tmb.addClass('drop-active');
9116						$drop_move.addClass('active');
9117						manageVideos($drop_move, true);
9118						clientX = e.changedTouches[0].clientX;
9119						clientY = e.changedTouches[0].clientY;
9120
9121						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
9122							var bound = $anim_parent[0].getBoundingClientRect();
9123							clientX = clientX - bound.x;
9124							clientY = clientY - bound.y;
9125						}
9126
9127						$drop_move.css({
9128							left: clientX,
9129							top: clientY
9130						});
9131					});
9132				});
9133
9134			}
9135
9136			$tmbs.each(function(e){
9137				var $tmb = $(this),
9138					// $trgr = $('a', $tmb),
9139					$trgr = $tmb,
9140					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
9141					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
9141(.t-inside), .parallax-el'),
9142					$video = $('video', $tmb),
9143					$iframe = $('iframe', $tmb),
9144					$entryTxt = $('.t-entry-text', $tmb),
9145					stopBounding;
9146
9147				$entryTxt.add($drop_move).css({
9148					'transition-duration': timing + 's'
9149				});
9150
9151				if ( $video.length ) {
9152					var vidH = $video[0].videoHeight,
9153						vidW = $video[0].videoWidth;
9154					$video.css({
9155						'height': vidH,
9156						'width': vidW
9157					});
9158				}
9159
9160				if ( $iframe.length ) {
9161					var vidH = $drop_move.attr('data-height'),
9162						vidW = $drop_move.attr('data-width');
9163					$iframe.css({
9164						'height': vidH,
9165						'width': vidW
9166					});
9167				}
9168
9169				$iframe.each(function(){
9170					var $video = $(this),
9171						vidH = $video[0].videoHeight,
9172						vidW = $video[0].videoWidth;
9173					$video.css({
9174						'height': vidH,
9175						'width': vidW
9176					});
9177				});
9178
9179				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
9180					$trgr.on('mouseenter',function(e){
9181						$list.addClass('drop-hover');
9182						$tmbs.removeClass('drop-active');
9183						$tmb.addClass('drop-active');
9184						$drop_move.addClass('active');
9185						manageVideos($drop_move, true);
9186
9187						var clientX = e.clientX,
9188							clientY = e.clientY;
9189						$drop_move.css({
9190							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
9191						});
9192
9193					})
9194					.on('mouseleave', function(e){
9195						$list.removeClass('drop-hover');
9196						$drop_move.css({
9197							'transition-duration': ( timing*1.25 ) + 's'
9198						});
9199						$drop_move.removeClass('active');
9200						$tmb.removeClass('drop-active');
9201						$drop_move.on('transitionend', function(e){
9202							$drop_move.off('transitionend');
9203							$drop_move.css({
9204								'transition-duration': timing + 's'
9205							});
9206							manageVideos($drop_move,false);
9207						});
9208					});
9209
9210					document.addEventListener('visibilitychange', function(){
9211						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
9212							$drop_move.css({
9213								'transition-duration': '0s'
9214							});
9215							$drop_move.removeClass('active');
9216							manageVideos($drop_move, false);
9217						}
9218					});
9219
9220					document.addEventListener('scroll', function(){
9221						window.clearRequestTimeout( stopBounding );
9222
9223						if ( $drop_move.hasClass('active') ) {
9224							$list.removeClass('drop-hover');
9225							$tmbs.removeClass('drop-active');
9226							$drop_move.removeClass('active');
9227							$drop_move.on('transitionend', function(e){
9228								$drop_move.off('transitionend');
9229								$drop_move.css({
9230									'transition-duration': timing + 's'
9231								});
9232								manageVideos($drop_move,false);
9233							});
9234						}
9235
9236						stopBounding = requestTimeout(function() {
9237							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
9238								var bound = $anim_parent[0].getBoundingClientRect();
9239								$drop_move.css({
9240									left: bound.x * -1,
9241									top: bound.y * -1,
9242								});
9243							}
9244						}, 200);
9245
9246					});
9247				}
9248
9249				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
9250					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
9251
9252				$drop.css({
9253					'transition-duration': timing + 's'
9254				});
9255
9256				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
9257					$trgr.on('mouseenter',function(e){
9258						$row_parent.add($col_parent).addClass('drop-list-loaded');
9259						$list.addClass('drop-hover');
9260
9261						if ( !$tmb.hasClass('drop-active') ) {
9262							$tmbs.removeClass('drop-active');
9263							$tmb.addClass('drop-active');
9264							if ( default_image && !$drop.hasClass('active') ) {
9265								var $prev = $('[data-drop].active', $row_parent);
9266								$prev.css({
9267									'transition-duration': (timing*1.5) + 's'
9268								});
9269								$prev.removeClass('active');
9270								$prev.on('transitionend', function(e){
9271									$prev.off('transitionend');
9272									manageVideos($prev,false);
9273								});
9274							}
9275							$drop.css({
9276								'transition-duration': timing + 's'
9277							});
9278							$drop.off('transitionend');
9279							$drop.addClass('active');
9280							manageVideos($drop, true);
9281						}
9282					})
9283					.on('mouseleave', function(e){
9284						if ( ( default_image && !default_title ) || !default_image ) {
9285							$list.removeClass('drop-hover');
9286							$tmb.removeClass('drop-active');
9287						}
9288						if ( ! default_image ) {
9289							$drop.css({
9290								'transition-duration': (timing*1.5) + 's'
9291							});
9292							$drop.removeClass('active');
9293
9294							$drop.on('transitionend', function(e){
9295								$drop.off('transitionend');
9296								manageVideos($drop,false);
9297							});
9298						}
9299					});
9300
9301					document.addEventListener('visibilitychange', function(){
9302						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
9303							$drop.css({
9304								'transition-duration': '0s'
9305							});
9306							$drop.removeClass('active');
9307							manageVideos($drop, false);
9308						}
9309					});
9310				}
9311			});
9312
9313		});
9314	};
9315
9316	$(window).on('load', function(event) {
9317		imageHover();
9318	});
9319
9320	var drop_wp_animation = function() {
9321		var $postLists = $('.uncode-post-titles');
9322		$postLists.each(function(){
9323			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
9324				new Waypoint({
9325					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
9326					element: val,
9327					handler: function() {
9328						var element = $(this.element),
9329							parent = element.closest('.tmb'),
9330							currentIndex = parent.index(),
9331							delay = currentIndex,
9332							delayAttr = parseInt(element.attr('data-delay'));
9333						if (isNaN(delayAttr)) delayAttr = 100;
9334						var objTimeout = requestTimeout(function() {
9335							element.addClass('start_animation');
9336
9337							var nextTimeout = requestTimeout(function() {
9338								$('.drop-image-separator', parent).addClass('start_animation');
9339							}, 50);
9340
9341						}, delay * delayAttr);
9342						if (!UNCODE.isUnmodalOpen) {
9343							this.destroy();
9344						}
9345					},
9346					offset: UNCODE.isFullPage ? '100%' : '90%'
9347				})
9348			});
9349		});
9350	}
9351
9352	var runWaypoints_TO,
9353		runWaypoints_delay = 0;
9354
9355	var runWaypoints = function(){
9356		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
9357			runWaypoints_delay = 400;
9358		}
9359		clearRequestTimeout(runWaypoints_TO);
9360		runWaypoints_TO = requestTimeout(function() {
9361			drop_wp_animation();
9362		}, runWaypoints_delay);
9363	};
9364	runWaypoints();
9365	$( document.body ).on( 'uncode_waypoints', runWaypoints );
9366	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9367		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
9368			// imageHover();
9369			runWaypoints();
9370		});
9371	}
9372};
9373
9374UNCODE.postTable = function() {
9375
9376	var clickRow = function(){
9377		var $postLists = $('.uncode-post-table');
9378
9379		$postLists.each(function(){
9380			var $postList = $(this),
9381				$tmbClicks = $('.tmb.tmb-click-row', $postList);
9382
9383			$tmbClicks.each(function(){
9384				var $tmb = $(this),
9385					$click = $('.table-click-row', $tmb);
9386				$('*:not(.table-click-row)', $tmb).on('click', function(e){
9387					e.preventDefault();
9388					e.stopPropagation();
9389					$click[0].click();
9390					return false;
9391				});
9392			});
9393
9394		})
9395	};
9396
9397	clickRow();
9398
9399	var hoverRow = function(){
9400		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
9401
9402		$postLists.on('mouseenter', function(){
9403			$(this).addClass('post-table-hover');
9404		});
9405		$postLists.on('mouseleave', function(){
9406			$(this).removeClass('post-table-hover');
9407		});
9408	}
9409
9410	hoverRow();
9411
9412	var drop_wp_animation = function() {
9413		var $postLists = $('.uncode-post-table');
9414		$postLists.each(function(){
9415			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
9416				new Waypoint({
9417					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
9418					element: val,
9419					handler: function() {
9420						var element = $(this.element),
9421							parent = element.closest('.tmb'),
9422							currentIndex = parent.index(),
9423							delay = currentIndex,
9424							delayAttr = parseInt(element.attr('data-delay'));
9425						if (isNaN(delayAttr)) delayAttr = 100;
9426						var objTimeout = requestTimeout(function() {
9427							element.addClass('start_animation');
9428						}, delay * delayAttr);
9429						if (!UNCODE.isUnmodalOpen) {
9430							this.destroy();
9431						}
9432					},
9433					offset: UNCODE.isFullPage ? '100%' : '90%'
9434				})
9435			});
9436		});
9437	}
9438
9439	var runWaypoints_TO,
9440		runWaypoints_delay = 0;
9441
9442	var runWaypoints = function(){
9443		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
9444			runWaypoints_delay = 400;
9445		}
9446		clearRequestTimeout(runWaypoints_TO);
9447		runWaypoints_TO = requestTimeout(function() {
9448			drop_wp_animation();
9449		}, runWaypoints_delay);
9450	};
9451	runWaypoints();
9452	$( document.body ).on( 'uncode_waypoints', runWaypoints );
9453	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9454		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
9455			runWaypoints();
9456			// clickRow();
9457		});
9458	}
9459};
9460
9461UNCODE.rotatingTxt = function($ctxt) {
9462
9463	if ( $('body').hasClass('compose-mode') ) {
9464		return;
9465	}
9466
9467	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
9468	var setCTA;
9469
9470	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
9471		var $heading = $(this),
9472			// debug = 0,
9473			cycle = 0,
9474			$trgt,
9475			$toMove,
9476			$highl,
9477			$col = $heading.closest('.uncont'),
9478			txt,
9479			arrTxt,
9480			textFadeIn, textFadeOut,
9481			removeWraps;
9482
9483		var defineObjs = function() {
9484			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
9485				var $rtx = $(this),
9486					fx = $rtx.attr('data-fx'),
9487					wait = $rtx.attr('data-wait'),
9488					$prev = $(this).prev().addClass('prev-rotating-start'),
9489					splitToMove = [],
9490					splitArray = [],
9491					lineArray = [],
9492					lineIndex = 0,
9493					lineStart = true,
9494					lineEnd = false,
9495					startSplit = false,
9496					$line_wrap = $rtx.closest('.heading-line-wrap'),
9497					same_line = true,
9498					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
9499					indexRtx = $splits.index($rtx);
9500
9501				fx = typeof fx === 'undefined' ? '' : fx;
9502				wait = typeof wait === 'undefined' ? '' : wait;
9503
9504				$splits.each(function(key, val){
9505					var $split = $(this),
9506						$new_line_wrap = $split.closest('.heading-line-wrap');
9507
9508					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
9509						splitArray.push( $split );
9510					}
9511
9512					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
9513						startSplit = false;
9514					}
9515
9516					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
9517						splitArray.push( $split );
9518
9519						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
9520							same_line = true;
9521						} else {
9522							same_line = false;
9523						}
9524					}
9525
9526					if ( key == indexRtx ) {
9527						if ( /\S/.test($split.text()) ) {
9528							startSplit = true;
9529							$line_wrap = $split.closest('.heading-line-wrap');
9530							splitArray.push( $split );
9531						} else {
9532							indexRtx++;
9533						}
9534					}
9535
9536					$line_wrap = $new_line_wrap;
9537				});
9538
9539				$toMove = $($.map(splitToMove, function(el){return el.get();}));
9540				$trgt = $($.map(splitArray, function(el){return el.get();}));
9541
9542				if ( same_line ) {
9543					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
9544					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
9545				}
9546
9547				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
9548					$prev.addClass('empty-span-hidden');
9549				}
9550
9551				$highl = $('.heading-text-highlight-inner', $trgt);
9552
9553				$rtx.attr('data-animated', 'true');
9554				if ( cycle == 0 ) {
9555					$( document.body ).trigger('defer-highlights');
9556					cycle++;
9557					defineObjs();
9558					return;
9559				}
9560				cycle++;
9561
9562				txt = $rtx.attr('data-text');
9563				arrTxt = txt.split("|");
9564
9565				textFadeOut($trgt);
9566
9567			});
9568		};
9569
9570		removeWraps = function(){
9571
9572			// if ( debug == 1 ) return;
9573			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
9574			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
9575
9576
9577				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
9578					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
9579
9580				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
9581
9582				$splitFlow.each(function(){
9583					$(this).append($temp_highl);
9584				});
9585
9586				var $line_wrap = $wraps[wrap_k];
9587				var $parent_wrap = $line_wrap.parentNode;
9588				if ( $parent_wrap !== null ) {
9589					while ( $line_wrap.firstChild ) {
9590						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
9591					}
9592					$parent_wrap.removeChild($line_wrap);
9593				}
9594			}
9595			// debug++;
9596			defineObjs();
9597		};
9598
9599		var loop = 0;
9600		textFadeIn = function($trgt){
9601			var word = arrTxt[loop].split(" "),
9602				worsSpan = '',
9603				$wrap = $trgt.closest('.uncode-rotating-wrap'),
9604				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
9605				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
9606
9607			for (var w = 0; w < word.length; w++) {
9608				var highl;
9609				if ( $highl.length ) {
9610					highl = $highl[0].outerHTML;
9611				} else {
9612					highl = '';
9613				}
9614
9615				if ( w > 0 ) {
9616					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
9617				}
9618				var charachters = word[w].split('');
9619				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
9620				for (var c = 0; c < charachters.length; c++) {
9621					worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
9622				}
9623				worsSpan += '</span>' + highl + '</span></span>';
9624			}
9625
9626			if ( $wrap.length && $wrap_inner.length ) {
9627				var words_w = $wrap_inner.outerWidth();
9628				$wrap.css({
9629					width: words_w
9630				});
9631
9632				$highl = $('.heading-text-highlight-inner', $wrap);
9633				$highl.prependTo($wrap);
9634
9635				$wrap_inner.css({
9636					opacity: 0
9637				});
9638
9639				$wrap_inner.html(worsSpan);
9640				$('.heading-text-highlight-inner', $wrap_inner).remove();
9641				words_w = $wrap_inner.innerWidth();
9642
9643				var duration = 0.45;
9644
9645				$heading.removeClass('auto-width');
9646				if ( words_w > $col.width() ) {
9647					$heading.addClass('auto-width');
9648					words_w = 'auto';
9649					duration = 0;
9650				}
9651
9652				$wrap.css({
9653					'width': words_w,
9654					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
9655				});
9656
9657				var $word_inner = $('.split-word-inner', $wrap_inner),
9658					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
9659
9660				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
9661
9662				if ( !$target_fx.length ) {
9663					return;
9664				}
9665
9666				gsap.killTweensOf($target_fx);
9667
9668				if ( fx !== 'zoom' ) {
9669					gsap.fromTo( $target_fx, {
9670						y: fx === 'opacity' ? '0%' : '-10%'
9671					},{
9672						delay: duration,
9673						duration: 0.25,
9674						y: '0%',
9675						ease: Circ.easeOut,
9676					});
9677
9678					if ( !$wrap_inner.length ) {
9679						return;
9680					}
9681
9682					gsap.fromTo( $wrap_inner, {
9683						opacity: 0,
9684					},{
9685						delay: duration,
9686						duration: 0.25,
9687						opacity: 1,
9688						ease: Circ.easeOut,
9689						onComplete: function(){
9690							$('> .heading-text-highlight-inner', $wrap).remove();
9691							$wrap_inner.html(worsSpan);
9692							removeWraps();
9693						}
9694					})
9695
9696				} else {
9697					gsap.fromTo( $target_fx, {
9698						transformOrigin: '50%',
9699						opacity: 0,
9700						scale: 0.875,
9701					},{
9702						opacity: 1,
9703						delay: duration,
9704						duration: 0.25,
9705						scale: 1,
9706						ease: Circ.easeOut,
9707						onComplete: function(){
9708							$('> .heading-text-highlight-inner', $wrap).remove();
9709							$wrap_inner.html(worsSpan);
9710							removeWraps();
9711						}
9712					});
9713				}
9714
9715			} else {
9716
9717				if ( !$wrap_inner.length ) {
9718					return;
9719				}
9720
9721				gsap.to( $wrap_inner, {
9722					duration: 0.4,
9723					opacity: 0,
9724					ease: Power1.easeOut,
9725					onComplete: function(){
9726						$wrap_inner.html(worsSpan);
9727						words_w = $wrap_inner.innerWidth();
9728
9729						gsap.to( $wrap_inner, {
9730							duration: 0.2,
9731							opacity: 1,
9732							ease: Power1.easeOut,
9733							onComplete: function(){
9734								$('> .heading-text-highlight-inner', $wrap).remove();
9735								$wrap_inner.html(worsSpan);
9736								removeWraps();
9737							}
9738						})
9739					}
9740				});
9741			}
9742
9743			if ( loop < arrTxt.length-1 ) {
9744				loop++;
9745			} else {
9746				loop = 0;
9747			}
9748
9749		};
9750
9751		textFadeOut = function($trgt){
9752			var $word_inner = $('.split-word-inner', $trgt),
9753				$wrap = $trgt.closest('.uncode-rotating-wrap'),
9754				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
9755				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
9756				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
9757
9758			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
9759
9760			var gsap_param = {
9761					delay: wait,
9762					duration: 0.25,
9763					y: fx === '' ? '10%' : '0%',
9764					opacity: 0,
9765					ease: Circ.easeOut,
9766					onStart: function(){
9767						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
9768							$highl = $('.heading-text-highlight-inner', $wrap);
9769							$highl.prependTo($wrap);
9770						}
9771					},
9772					onComplete: textFadeIn,
9773					onCompleteParams: [$trgt]
9774				};
9775
9776			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
9777
9778			if ( fx === '' ) {
9779				gsap_param.y = '10%';
9780			} else if ( fx === 'zoom' ) {
9781				gsap_param.scale = '1.045';
9782			}
9783
9784			if ( !$target_fx.length ) {
9785				return;
9786			}
9787
9788			if ( $heading.data('waypoint') !== true ) {
9789				var textInView = new Waypoint.Inview({
9790					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
9791					element: $heading[0],
9792					enter: function(direction) {
9793						$heading.data('waypoint',true);
9794						gsap.fromTo( $target_fx, {
9795							transformOrigin: '50%'
9796						}, gsap_param );
9797					}
9798				});
9799			} else {
9800				gsap.fromTo( $target_fx, {
9801					transformOrigin: '50%'
9802				}, gsap_param );
9803			}
9804		};
9805
9806		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9807			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
9808				var $el = model.view.$el,
9809					shortcode = model.attributes.shortcode;
9810
9811				UNCODE.rotatingTxt($el);
9812			});
9813		} else {
9814			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
9815				$heading.on('already-animated', function(){
9816					removeWraps();
9817					window.addEventListener('removeOldLines', function(){
9818						clearRequestTimeout(setCTA);
9819						setCTA = requestTimeout( removeWraps, 150 );
9820					});
9821				});
9822			} else {
9823				$(window).on('load', function(){
9824					removeWraps();
9825					window.addEventListener('removeOldLines', function(){
9826						clearRequestTimeout(setCTA);
9827						setCTA = requestTimeout( removeWraps, 150 );
9828					});
9829				});
9830			}
9831		}
9832	});
9833
9834};
9835
9836UNCODE.verticalText = function() {
9837	$(window).on('menuCanvasOpen', function(){
9838		$('.vertical-text--fixed').fadeOut(500);
9839		$('.horizontal-text--fixed').fadeOut(500);
9840	}).on('menuCanvasClose', function(){
9841		$('.vertical-text--fixed').fadeIn(500);
9842		$('.horizontal-text--fixed').fadeIn(500);
9843	});
9844
9845	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
9846	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
9847	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
9848	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
9849
9850	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
9851		window.addEventListener('scroll', function(e) {
9852			var totalPageHeight = document.body.scrollHeight;
9853			var scrollPoint = window.scrollY + window.innerHeight;
9854
9855			if (window.scrollY > 0) {
9856				showOnTopVerticalTexts.fadeOut();
9857				showOnTopHorizontalTexts.fadeOut();
9858			} else {
9859				showOnTopVerticalTexts.fadeIn();
9860				showOnTopHorizontalTexts.fadeIn();
9861			}
9862
9863			if (scrollPoint >= totalPageHeight) {
9864				hideOnBottomVerticalTexts.fadeOut();
9865				hideOnBottomHorizontalTexts.fadeOut();
9866			} else {
9867				hideOnBottomVerticalTexts.fadeIn();
9868				hideOnBottomHorizontalTexts.fadeIn();
9869			}
9870		}, false);
9871	}
9872};
9873
9874UNCODE.stickyScroll = function( $el ) {
9875	if ( typeof $el === 'undefined' || $el === null ) {
9876		$el = $('body');
9877	}
9878	var checkVisible = function( el, dir ) {
9879		if (typeof jQuery === "function" && el instanceof jQuery) {
9880			el = el[0];
9881		}
9882
9883		var off = 50;
9884		dir = typeof dir=='undefined' ? 'right' : dir;
9885		var rect = el.getBoundingClientRect();
9886
9887		return (
9888			(
9889				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
9890				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
9891				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
9892			) &&
9893			(
9894				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
9895				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
9896				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
9897				( rect.right <= window.innerWidth && rect.left >= 0 )
9898			)
9899		);
9900	};
9901
9902	var setItemsRelHeight = function(reset) {
9903		var $_el = $el;
9904		if ( $el.is('.index-scroll') ) {
9905			var $_el = $el.closest('.uncont');
9906		}
9907		$('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
9908			$.each($('.tmb', item), function(index, val) {
9909				if ( reset === true ) {
9910					$(val).css( 'visibility', 'hidden' );
9911				} else {
9912					$(val).css( 'visibility', 'visible' );
9913				}
9914			});
9915		});
9916		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
9917			$.each($('.tmb', item), function(index, val) {
9918				if ( reset === true ) {
9919					$(val).css( 'visibility', 'hidden' );
9920					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
9921				} else {
9922					var $rowParent = $(item).closest('.row-parent'),
9923						rowRatio = $rowParent.attr('data-height-ratio'),
9924						$rowInner = $(item).closest('.row-child'),
9925						rowRatioInner = $rowInner.attr('data-height'),
9926						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
9927						$colContainer = $(item).closest('.uncell'),
9928						$uncont = $(item).closest('.uncont'),
9929						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
9930						safe_heigth = $(item).data('safe-height'),
9931						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
9932						offSet = $(item).offset().top - $uncont.offset().top,
9933						multiplier_h,
9934						data_viewport_h,
9935						body_border = $('.body-borders .top-border').outerHeight() * 2,
9936						remove_menu = $(item).data('vp-menu');
9937
9938					if ( rowRatio === 'full' || rowRatio === '' ) {
9939						rowRatio = 1;
9940					} else {
9941						rowRatio = rowRatio / 100;
9942					}
9943
9944					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
9945						rowRatio = rowRatio;
9946					} else {
9947						rowRatio = rowRatio * rowRatioInner / 100;
9948					}
9949
9950					winHeight = winHeight * rowRatio;
9951
9952					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
9953						multiplier_h = parseInt($(item).attr('data-vp-height'));
9954					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
9955						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
9956					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
9957						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
9958					}
9959
9960					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
9961						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
9962						if ( remove_menu === true ) {
9963							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
9964						}
9965						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
9966					} else {
9967						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
9968					}
9969
9970				}
9971			});
9972		});
9973		$('.index-scroll', $_el).each(function(i, item){
9974			var $uncoltable = $(item).closest('.uncoltable'),
9975				$rowParent = $(item).closest('.row-parent'),
9976				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
9977				body_border = $('.body-borders .top-border').outerHeight() * 2,
9978				$index_row = $('.index-row', item),
9979				safe_heigth = $index_row.data('safe-height'),
9980				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
9981			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
9982				var data_viewport_h = winHeight - ( paddingRow + body_border );
9983				$uncoltable.css({
9984					'min-height': data_viewport_h
9985				});
9986			} else {
9987				$uncoltable.css({
9988					'min-height': 'auto'
9989				});
9990			}
9991		});
9992
9993	}
9994	setItemsRelHeight();
9995
9996	var $index_scrolls = $('.index-scroll', $el);
9997
9998	$index_scrolls.each(function(key, value){
9999		var $index = $(this),
10000			$parent_row = $index.closest('.vc_row[data-parent]'),
10001			$index_row = $('.index-row', $index),
10002			dir = $index_row.attr('data-direction');
10003		dir = typeof dir === 'undefined' ? 'right' : dir;
10004
10005		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
10006	});
10007
10008	var $horScrolls = $('.unscroll-horizontal', $el);
10009
10010	if ( $horScrolls.length ) {
10011
10012		$('body').addClass('scrolling-trigger');
10013
10014		$horScrolls.each(function(key, value){
10015			var $section = $(this),
10016				$index_scroll = $('.index-scroll', $section),
10017				$index_row = $('.index-row', $index_scroll),
10018				dir = $section.attr('data-direction'),
10019				wrap = $index_row.attr('data-wrap'),
10020				$pinWrap,
10021				$pinTrigger;
10022
10023			dir = typeof dir === 'undefined' ? 'right' : dir;
10024			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
10025			$pinWrap = $('<div class="pin-wrap" />');
10026			if ( SiteParameters.is_frontend_editor ) {
10027				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
10028				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
10029			} else {
10030				if ( wrap === 'column' ) {
10031					$index_scroll.wrapInner( $pinWrap );
10032				} else {
10033					$('> .row', $section).wrap( $pinWrap );
10034				}
10035				$section.wrapInner( $pinTrigger );
10036			}
10037
10038		});
10039
10040		var $pinWraps = $('.pin-wrap', $el);
10041
10042		var horScrollSizes = function(){
10043
10044			$pinWraps.each(function(key, val){
10045				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
10046					$pinTrigger = $pinWrap.closest('.pin-trigger'),
10047					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
10048					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
10049					$boxContainer = $('.box-container'),
10050					box_m = $boxContainer.css('margin-left'),
10051					st_active = true;
10052
10053				var setHorW,
10054				horWidth = function(){
10055					$index_scroll.each(function(){
10056						var $this = $(this),
10057							$index_row = $('.index-row', $this),
10058							$rowContainer = $index_row.closest('.vc_row'),
10059							$rowInner = $index_row.closest('.wpb_row'),
10060							$rowParent = $index_row.closest('.row-parent'),
10061							$tmbs = $('.tmb', $index_row),
10062							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
10063							$uncont = $index_row.closest('.uncont'),
10064							$parent_col = $index_row.closest('.wpb_column'),
10065							col_w = $uncont.width(),
10066							data_lg = parseFloat( $index_row.attr('data-lg') ),
10067							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
10068							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
10069							tmb_w;
10070
10071						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
10072						tmb_w = ( col_w + padding_tmb ) / data_lg;
10073
10074						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
10075							tmb_w = ( col_w + padding_tmb ) / data_sm;
10076						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
10077							tmb_w = ( col_w + padding_tmb ) / data_md;
10078						}
10079
10080						if ( !isNaN(tmb_w) ) {
10081							$tmbs.css({
10082								'width': tmb_w
10083							});
10084						}
10085
10086						$tmbs.css({
10087							'visibility': 'visible'
10088						});
10089
10090					});
10091				};
10092
10093				horWidth();
10094				clearRequestTimeout(setHorW);
10095				setHorW = requestTimeout( function(){
10096					setItemsRelHeight();
10097					horWidth();
10098				}, 100 );
10099
10100				if ( SiteParameters.is_frontend_editor ) {
10101					return;
10102				}
10103
10104				var $vmenu = $('body.vmenu .vmenu-container'),
10105					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
10106					winWidth = window.innerWidth - vmenuW,
10107					$tmb = $('.tmb', $index_scroll).eq(0),
10108					paddingRight = parseFloat( $tmb.css('padding-right') ),
10109					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_scroll.width() + paddingRight ) ),
10110					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
10111					scroll_anim;
10112
10113				if ( $('body').hasClass('rtl') ) {
10114					if ( dir === 'left' ) {
10115						scroll_anim = gsap.fromTo( $pinWrap, {
10116							x: stickyScrollLength
10117						},{
10118							x: 0,
10119							ease: "none"
10120						});
10121					} else {
10122						scroll_anim = gsap.fromTo( $pinWrap, {
10123							x: 0
10124						},{
10125							x: stickyScrollLength,
10126							ease: "none"
10127						});
10128					}
10129				} else {
10130					if ( dir === 'left' ) {
10131						scroll_anim = gsap.fromTo( $pinWrap, {
10132							x: -stickyScrollLength
10133						},{
10134							x: 0,
10135							ease: "none"
10136						});
10137					} else {
10138						scroll_anim = gsap.fromTo( $pinWrap, {
10139							x: 0
10140						},{
10141							x: -stickyScrollLength,
10142							ease: "none"
10143						});
10144					}
10145				}
10146
10147				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
10148					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
10149				}
10150
10151				var animationIncrease;
10152
10153				var checkForAnimations = function(){
10154					animationIncrease = 0
10155					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
10156						var _this = this,
10157							isScrolling;
10158						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
10159							var delayAttr = parseFloat( $(_this).attr('data-delay') );
10160							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
10161							requestTimeout(function() {
10162								$(_this).addClass('start_animation');
10163							}, delayAttr + animationIncrease);
10164							animationIncrease += 150;
10165						}
10166					});
10167				};
10168				checkForAnimations();
10169
10170				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
10171				var start = 0;
10172
10173				var horST = ScrollTrigger.create({
10174					id: "stickySectionScrolling" + key,
10175					scrub: true,
10176					trigger: $pinTrigger[0],
10177					pin: true,
10178					anticipatePin: 1,
10179					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
10180					end: function() { return "+="+stickyScrollLength; },
10181					animation: scroll_anim,
10182					ease: Sine.easeOut,
10183					onUpdate: checkForAnimations,
10184					invalidateOnRefresh: true,
10185					onEnter: function(){
10186						$pinTrigger.addClass('enter-st');
10187					},
10188					onEnterBack: function(){
10189						$pinTrigger.addClass('enter-st');
10190					},
10191					onLeave: function(){
10192						$pinTrigger.removeClass('enter-st');
10193					},
10194					onLeaveBack: function(){
10195						$pinTrigger.removeClass('enter-st');
10196					}
10197				});
10198
10199				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
10200				window.dispatchEvent(new CustomEvent('boxResized'));
10201
10202				var testSecondTrigger = function(){
10203					animationIncrease = 0
10204					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
10205						var _this = this;
10206						if ( checkVisible(_this) ) {
10207							var delayAttr = parseFloat( $(_this).attr('data-delay') );
10208							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
10209							requestTimeout(function() {
10210								$(_this).addClass('start_animation');
10211							}, delayAttr + animationIncrease);
10212							animationIncrease += 150;
10213						}
10214					});
10215
10216				};
10217
10218				var verST = ScrollTrigger.create({
10219					id: "verticalSectionScrolling" + key,
10220					trigger: $pinTrigger[0],
10221					start: "top center",
10222					end: function() { return "+="+UNCODE.wheight; },
10223					onUpdate: testSecondTrigger,
10224					invalidateOnRefresh: true
10225				});
10226
10227				var setCTA,
10228
10229				dis_enable_ST = function(){
10230					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
10231						horST.kill();
10232						verST.kill();
10233						$pinTrigger.addClass('disabled');
10234						st_active = false;
10235					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
10236						horST.kill();
10237						verST.kill();
10238						$pinTrigger.addClass('disabled');
10239						st_active = false;
10240					}
10241				};
10242
10243				$(window).on('resize load', function() {
10244					clearRequestTimeout(setCTA);
10245					setCTA = requestTimeout(function() {
10246						dis_enable_ST();
10247						checkForAnimations();
10248					}, 500);
10249				});
10250
10251			});
10252		};
10253
10254		$(window).on( 'load', function(){
10255			horScrollSizes();
10256		});
10257		var setResize,
10258			setReLayout,
10259			doubleResize = true,
10260			oldW = UNCODE.wwidth;
10261		$(window).on( 'load', function(){
10262			if ( $('.body-borders .top-border').outerHeight() > 0 ) {
10263				var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
10264				Array.prototype.forEach.call($row_inners, function(el) {
10265					el.style.height = '';
10266					el.style.marginBottom = '';
10267				});
10268				setItemsRelHeight();
10269				horScrollSizes();
10270				ScrollTrigger.refresh();
10271			}
10272		});
10273		$(window).on( 'resize orientationchange', function(){
10274			if ( 'onorientationchange' in window && oldW === UNCODE.wwidth ) {
10275				return;
10276			} else {
10277				oldW = UNCODE.wwidth;
10278			}
10279			setItemsRelHeight(true);
10280			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
10281			Array.prototype.forEach.call($row_inners, function(el) {
10282				el.style.height = '';
10283				el.style.marginBottom = '';
10284			});
10285			clearRequestTimeout(setResize);
10286			setResize = requestTimeout( function(){
10287				setItemsRelHeight();
10288				horScrollSizes();
10289				ScrollTrigger.refresh();
10290				if ( doubleResize === true ) {
10291					window.dispatchEvent(new Event('resize'));
10292					doubleResize = false;
10293				} else {
10294					doubleResize = true;
10295				}
10296				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true);
10297			}, 100 );
10298		});
10299
10300		var show_pins = function(){
10301			$('.index-scroll').css({'opacity':'1'});
10302			setResize = requestTimeout( function(){
10303			}, 10 );
10304		};
10305		ScrollTrigger.addEventListener("refresh", show_pins);
10306		$(window).on( 'uncode.re-layout', function(){
10307			//$('.index-scroll').css({'opacity':'0'});
10308			$('.pin-spacer').each(function(){
10309				var space_h = $(this).outerHeight(),
10310					$row = $(this).closest('.row-container');
10311				$row.css({
10312					'height': space_h,
10313					'overflow': 'hidden'
10314				});
10315			});
10316			ScrollTrigger.refresh(true);
10317			clearRequestTimeout(setReLayout);
10318			setReLayout = requestTimeout( function(){
10319				$('.row-container').each(function(){
10320					$(this).css({
10321						'height': '',
10322						'overflow': ''
10323					});
10324				});
10325			}, 1000);
10326		});
10327	}
10328
10329};
10330
10331UNCODE.stickyTrigger = function( $el ) {
10332	if ( SiteParameters.is_frontend_editor ) {
10333		return false;
10334	}
10335
10336	var stickyTrigger = function(){
10337		var stickyTrick = $('.sticky-trigger').each(function(){
10338			var $sticky = $(this),
10339				$inside = $('> div', $sticky),
10340				insideH = $inside.outerHeight(),
10341				$row = $sticky.closest('.vc_row'),
10342				$uncont = $sticky.closest('.uncont'),
10343				rowBottom,
10344				uncontBottom ,
10345				diffBottom;
10346
10347			ScrollTrigger.create({
10348				trigger: $sticky,
10349				start: function(){ return "top center-=" + insideH/2; },
10350				endTrigger: $row,
10351				end:  function(){
10352					rowBottom = $row.offset().top + $row.outerHeight();
10353					uncontBottom = $uncont.offset().top + $uncont.outerHeight();
10354					diffBottom = rowBottom - uncontBottom;
10355					return "bottom center+=" + ( insideH/2 + diffBottom );
10356				},
10357				anticipatePin: true,
10358				pin: true,
10359				pinSpacing: false,
10360				scrub: true,
10361				invalidateOnRefresh: true,
10362			});
10363
10364		});
10365	},
10366	setResizeSticky;
10367
10368	$(window).on( 'load', function(){
10369		stickyTrigger();
10370	});
10371
10372	var oldW = UNCODE.wwidth;
10373	$(window).on( 'resize uncode.re-layout', function(e){
10374		clearRequestTimeout(setResizeSticky);
10375		if ( e.type === 'resize' && oldW === UNCODE.wwidth ) {
10376			return;
10377		} else {
10378			oldW = UNCODE.wwidth;
10379		}
10380		setResizeSticky = requestTimeout( function(){
10381			stickyTrigger();
10382			ScrollTrigger.refresh();
10383		}, 1000 );
10384	});
10385
10386};
10387
10388UNCODE.revslider = function() {
10389	var revSliderIn = function(){
10390		$('rs-module').each(function(){
10391			var $slider = $(this);
10392
10393			$slider.on('revolution.slide.onloaded', function(e, data){
10394				if ( $(e.currentTarget).closest(".header-revslider").length ) {
10395					var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"),
10396						scrolltop = $(document).scrollTop();
10397					if ( style != undefined ) {
10398						UNCODE.switchColorsMenu(scrolltop, style);
10399					}
10400				}
10401			});
10402
10403			$slider.on('revolution.slide.onchange', function(e, data){
10404				if ( $(e.currentTarget).closest(".header-revslider").length ) {
10405					var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"),
10406						scrolltop = $(document).scrollTop();
10407					if ( style != undefined ) {
10408						UNCODE.switchColorsMenu(scrolltop, style);
10409					}
10410				}
10411			});
10412
10413		});
10414	};
10415	revSliderIn();
10416	$(window).on("load", revSliderIn );
10417};
10418UNCODE.layerslider = function() {
10419	$(window).on("load", function() {
10420
10421		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
10422
10423			var slideData = slider.slides.current.data,
10424				scrolltop = $(document).scrollTop();
10425			if( slideData && slideData.skin ) {
10426
10427				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
10428
10429			}
10430		});
10431
10432	});
10433};
10434
10435UNCODE.ajax_filters = function() {
10436
10437/*************************
10438 *
10439 * Filters Menu and Widgets Area
10440 *
10441 ************************/
10442
10443 	var clear_clicked = false;
10444
10445 	var init_ajax_grid = function(){
10446
10447		var $grids = $('.ajax-grid-system:not(.init-ajax-grid)');
10448		$grids.each(function(index, val){
10449			var $body = $('body'),
10450				$grid = $(val).addClass('init-ajax-grid'),
10451				starting_point = $grid.attr('data-toggle'),
10452				$trigger = $('.uncode-toggle-ajax-filters', $grid),
10453				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid),
10454				$isotope_wrapper = $('.isotope-wrapper', $grid),
10455				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper),
10456				$sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid),
10457				$footprint = $('.ajax-filter-footprint', $grid),
10458				sidebar_w,
10459				data_w = parseFloat( $sidebar.attr('data-max-width') ),
10460				$firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'),
10461				skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark',
10462				$positioned_top = $('.ajax-filter-position-horizontal', $grid),
10463				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
10464				$close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper),
10465				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0),
10466				sidew,
10467				$inside_row = $('> .row-parent', $vc_row),
10468				bg_row,
10469				$side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper),
10470				$side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper),
10471				$apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
10472				sidebar_overlay = false,
10473				sidebar_hover = false,
10474				switchMobile = false,
10475				scrollTop;
10476
10477			if ( $vc_row.attr('class') ) {
10478				bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/);
10479			}
10480
10481			if ( bg_row != null ) {
10482				$side_header.add($side_footer).addClass(bg_row[0]);
10483			}
10484
10485			$trigger.add($apply_filters).on('click', function(e){
10486				e.preventDefault();
10487				e.stopPropagation();
10488				$grid = $('.ajax-grid-system').eq(0);
10489				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
10490				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
10491				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
10492				sidebar_w = $sidebar_wrapper.width();
10493				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
10494				if ($(this).hasClass('ajax-filter-sidebar__button--clear')) {
10495					$(this).trigger('uncode-ajax-clear-filters');
10496				}
10497				if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
10498					$grid.toggleClass('ajax-hide-filters-blanks');
10499					$sidebar.slideToggle({
10500						duration: 400,
10501						easing: 'easeOutQuad',
10502					});
10503				} else {
10504					$grid.removeClass('ajax-hide-filters-blanks');
10505					$grid.toggleClass('ajax-hide-filters');
10506					if ( $grid.hasClass('ajax-hide-filters') ) {
10507						$body.addClass('ajax-hide-filters');
10508					} else {
10509						scrollTop = $('html, body').scrollTop();
10510						$body.removeClass('ajax-hide-filters');
10511					}
10512				}
10513				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
10514					$('html, body').scrollTop(scrollTop);
10515				}
10516				return false;
10517			});
10518
10519			$close_btn.on('click', function(e){
10520				e.preventDefault();
10521				$grid = $('.ajax-grid-system').eq(0);
10522				$grid.addClass('ajax-hide-filters');
10523				if ( $grid.hasClass('ajax-hide-filters') ) {
10524					$body.addClass('ajax-hide-filters');
10525				} else {
10526					scrollTop = $('html, body').scrollTop();
10527					$body.removeClass('ajax-hide-filters');
10528				}
10529				$('html, body').scrollTop(scrollTop);
10530			});
10531
10532			$sidebar_wrapper.on('mouseover',function(){
10533				sidebar_hover = true;
10534			}).on('mouseout', function(){
10535				sidebar_hover = false;
10536			});
10537
10538			$body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){
10539				if ( $(e.target).closest('.ajax-filter-sidebar').length ) {
10540					return;
10541				}
10542				if (undefined !== from && from === 'select_active_attributes') {
10543					return;
10544				}
10545				if ($(e.target).closest('.select2-container--open').length ) {
10546					return;
10547				}
10548				if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) {
10549					$grid.add($body).addClass('ajax-hide-filters');
10550				}
10551			});
10552
10553			$sorting_trgr.on('click', function(e) {
10554				e.preventDefault();
10555			});
10556
10557			var inside_width = function(){
10558				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
10559				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
10560				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
10561				$inside_row = $('> .row-parent', $vc_row);
10562				if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) {
10563					sidew = $sidebar.width();
10564					$inside_row.css({
10565						width: sidew
10566					});
10567				} else {
10568					$inside_row.css({
10569						width: ''
10570					});
10571				}
10572			};
10573			inside_width();
10574
10575			var ajax_sidebar_position = function(e, f_editor){
10576				$grid = $('.ajax-grid-system').eq(0);
10577				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
10578				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
10579				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
10580				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
10581				$inside_row = $('> .row-parent', $vc_row);
10582				scrollTop = $('html, body').scrollTop();
10583				if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) {
10584					$grid.add($body).addClass('ajax-hide-filters');
10585					$sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />');
10586					$body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
10587					sidebar_overlay = true;
10588					$body.addClass('ajax-filter-sidebar-overlay');
10589					$sidebar_wrapper.addClass(skin);
10590					var sideHeadH = $side_header.outerHeight(),
10591						sideFooterH = $side_footer.outerHeight();
10592					if ( data_w !== '' && data_w > 0 ) {
10593						if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
10594							$sidebar.css({
10595								'max-width': data_w
10596							});
10597						} else {
10598							$sidebar.css({
10599								'max-width':'none'
10600							});
10601						}
10602					}
10603					$vc_row.css({
10604						'padding-top':sideHeadH,
10605						'padding-bottom':sideFooterH
10606					});
10607					var sidew = $sidebar.width();
10608					$inside_row.css({
10609						width: sidew
10610					});
10611					switchMobile = true;
10612				} else {
10613					if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) {
10614						scrollTop = $('html, body').scrollTop();
10615						$grid.add($body).removeClass('ajax-hide-filters');
10616					}
10617					if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) {
10618						$grid.addClass('ajax-hide-filters-blanks');
10619						$sidebar.hide();
10620					}
10621					$('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas'));
10622					$('.ajax-sidebar-placeholder', $grid).remove();
10623					sidebar_overlay = false;
10624					$body.removeClass('ajax-filter-sidebar-overlay');
10625					$sidebar_wrapper.removeClass(skin);
10626					if ( data_w !== '' && data_w > 0 ) {
10627						$sidebar.css({
10628							'max-width':'none'
10629						});
10630					}
10631					$vc_row.css({
10632						'padding-top':0,
10633						'padding-bottom':0,
10634					});
10635
10636					$inside_row.css({
10637						width: ''
10638					});
10639
10640					if ( f_editor === true ) {
10641						UNCODE.ajax_filters();
10642					}
10643
10644					switchMobile = false;
10645				}
10646				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
10647					$('html, body').scrollTop(scrollTop);
10648				}
10649			};
10650
10651			var sidebar_width = function(){
10652				if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
10653					sidebar_w = $footprint.width();
10654					$sidebar.css({ width: sidebar_w });
10655				} else {
10656					$sidebar.css({ width: '' });
10657				}
10658			};
10659			sidebar_width();
10660
10661			if ( SiteParameters.is_frontend_editor ) {
10662				ajax_sidebar_position();
10663			}
10664
10665			$(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){
10666				if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) {
10667					ajax_sidebar_position(e);
10668				}
10669				sidebar_width();
10670			});
10671
10672			$(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){
10673				ajax_sidebar_position(e, true);
10674			});
10675
10676			$isotope_wrapper.on('transitionend', function(e){
10677				if ( $(e.target).hasClass('isotope-wrapper') ) {
10678					window.dispatchEvent(new CustomEvent('boxResized'));
10679				}
10680				return false;
10681			});
10682
10683			if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) {
10684				var $grid = $('.ajax-grid-system').eq(0);
10685				$grid.addClass('ajax-hide-filters');
10686			}
10687
10688		});
10689	};
10690
10691	init_ajax_grid();
10692	$(document).on('uncode-ajax-filtered', init_ajax_grid);
10693
10694/*************************
10695 *
10696 * Hover hack
10697 *
10698 ************************/
10699 	var widget_hover_hack = function() {
10700 		$('.widget, .uncode_widget').each(function(){
10701			var $widget = $(this),
10702				class_w = $widget.attr('class'),
10703				$lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'),
10704				$footer = $widget.closest('#colophon');
10705
10706			if ( class_w.indexOf('widget_yith') > 0 ) {
10707				return true;
10708			}
10709
10710			$lis.each(function(){
10711 				var $li = $(this),
10712 					$a = $('a', $li),
10713 					$label = $a.closest('label');
10714
10715				if ( !$footer.length ) {
10716					$li.addClass('no-evts');
10717				}
10718
10719				if ( ! $('span', $a).length ) {
10720 					$li.addClass( 'li-hover' );
10721 				}
10722
10723 				$('li', $li).hover(function(e){
10724 					$(e.target).parents('li').each(function(){
10725 						$(this).addClass( 'parent-li-hover' );
10726 					});
10727					}, function (e) {
10728 					$(e.target).parents('li').each(function(key, val){
10729 						if ( key === 0) {
10730	 						$(val).removeClass( 'parent-li-hover' );
10731	 					}
10732 					});
10733 				});
10734
10735				$li.off('mouseup').on('mouseup', function (e) {
10736					if (e.which !== 3) {
10737						e.stopPropagation();
10738						var $a = $('a', this).first();
10739						$a[0].click();
10740					}
10741	 			});
10742 			});
10743 		});
10744 	}
10745	if (SiteParameters.disable_hover_hack !== '1') {
10746		widget_hover_hack();
10747		$(document).on('uncode-ajax-filtered', widget_hover_hack);
10748	}
10749
10750/*************************
10751 *
10752 * Init Filters
10753 *
10754 ************************/
10755
10756	function init_filters() {
10757		$(document).on('click', '.term-filter-link', function(e) {
10758			var _this = $(this);
10759			var widget = _this.closest('.uncode_widget');
10760			var container = get_filters_container();
10761
10762			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
10763				return true;
10764			}
10765
10766			e.preventDefault();
10767
10768			if (widget.hasClass('widget-ajax-filters--checkbox')) {
10769				_this.parent().find('input[type="checkbox"]').trigger('click');
10770			} else {
10771				if (_this.hasClass('term-filter-link--active')) {
10772					_this.removeClass('term-filter-link--active');
10773				} else {
10774					_this.addClass('term-filter-link--active');
10775
10776					if (widget.hasClass('widget-ajax-filters--single')) {
10777						widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active');
10778					}
10779				}
10780
10781				var url = _this.attr('href');
10782
10783				reload_items(container, url, true);
10784			}
10785		});
10786
10787		$(document).on('click', '.term-filter input[type="checkbox"]', function(e) {
10788			var _this = $(this);
10789			var widget = _this.closest('.uncode_widget');
10790			var link = _this.closest('.term-filter').find('.term-filter-link');
10791			var url = link.attr('href');
10792			var container = get_filters_container();
10793
10794			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
10795				window.location = url;
10796				return;
10797			}
10798
10799			if (widget.hasClass('widget-ajax-filters--single')) {
10800				widget.find('input[type="checkbox"]').each(function() {
10801					if (_this.attr('id') !== $(this).attr('id')) {
10802						$(this).prop('checked', false);
10803						$(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active');
10804					}
10805				});
10806			}
10807
10808			if (_this.prop('checked')) {
10809				link.addClass('term-filter-link--active');
10810			} else {
10811				link.removeClass('term-filter-link--active');
10812			}
10813
10814			reload_items(container, url, true);
10815		});
10816
10817		$(document).on('change', 'select.select--term-filters', function(e) {
10818			var _this = $(this);
10819			var selected = _this.find('option:selected');
10820			var option = $(selected);
10821			var url = option.attr('data-term-filter-url');
10822			var container = get_filters_container();
10823			var widget = _this.closest('.uncode_widget');
10824
10825			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
10826				window.location = url;
10827			} else {
10828				reload_items(container, url, true);
10829			}
10830		});
10831
10832		$(document).on('click', '.filter-list__link', function(e) {
10833			if (SiteParameters.is_frontend_editor) {
10834				return false;
10835			}
10836
10837			e.preventDefault();
10838
10839			var _this = $(this);
10840			var container = get_filters_container();
10841			var url = _this.attr('href');
10842			reload_items(container, url, true);
10843		});
10844
10845		$('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) {
10846			var _this = $(this);
10847			var container = get_filters_container();
10848			var url = _this.attr('href');
10849			reload_items(container, url, true);
10850		});
10851
10852		$(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) {
10853
10854			var _this = $(this);
10855			var container = get_filters_container();
10856			var url = _this.attr('href');
10857
10858			if ( container.length ) {
10859				e.preventDefault();
10860				reload_items(container, url, true);
10861			}
10862		});
10863
10864		$(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) {
10865			var _this = $(this);
10866			var container = get_filters_container();
10867
10868			if (container.length > 0) {
10869				e.preventDefault();
10870
10871				var min_price = $('#min_price').val();
10872				var max_price = $('#max_price').val();
10873				var location = window.location;
10874				var url = location.href;
10875				var page_uri = location.origin + location.pathname;
10876				var is_filtered = page_uri !== url;
10877
10878				if (is_filtered) {
10879					url = remove_parameter_from_url(url, 'min_price');
10880					url = remove_parameter_from_url(url, 'max_price');
10881				}
10882
10883				var concat = page_uri === url ? '?' : '&';
10884				var params = {'min_price': min_price, 'max_price': max_price};
10885
10886				url = url + concat + $.param(params);
10887
10888				reload_items(container, url, true);
10889			}
10890		});
10891
10892		var search_timer;
10893
10894		$(document).on('keyup', '.term-filters-search-input', function(e) {
10895			var _this = $(this);
10896			var container = get_filters_container();
10897			var value = _this.val();
10898
10899			if (search_timer) {
10900				clearTimeout(search_timer);
10901			}
10902
10903			search_timer = setTimeout(function() {
10904				update_search_url(container, value);
10905			}, 500);
10906		});
10907	}
10908
10909	function update_search_url(container, search_value) {
10910		var location = window.location;
10911		var url = location.href;
10912		var page_uri = location.origin + location.pathname;
10913		var is_filtered = page_uri !== url;
10914		var key_search = SiteParameters.ajax_filter_key_search;
10915		var key_unfilter = SiteParameters.ajax_filter_key_unfilter;
10916
10917		if (is_filtered) {
10918			url = remove_parameter_from_url(url, key_search);
10919			url = remove_parameter_from_url(url, key_unfilter);
10920		}
10921
10922		if (search_value) {
10923			var concat = page_uri === url ? '?' : '&';
10924			var params = {};
10925
10926			params[key_search] = search_value;
10927			params[key_unfilter] = 1;
10928			url = url + concat + $.param(params);
10929		} else {
10930			url = remove_parameter_from_url(url, key_search);
10931		}
10932
10933		reload_items(container, url, true);
10934	}
10935
10936	function remove_parameter_from_url(url, parameter) {
10937		return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
10938	}
10939
10940	function get_filters_container() {
10941		var container = $('.ajax-grid-system');
10942
10943		if (container.length == 0) {
10944			container = $('.ajax-filters');
10945		}
10946
10947		return container;
10948	}
10949
10950	function update_widgets_state(widgets_states, container) {
10951		for (var i = widgets_states.length - 1; i >= 0; i--) {
10952			var state = widgets_states[i];
10953
10954			if (!state.collapse) {
10955				continue;
10956			}
10957
10958			var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"');
10959
10960			if (state.open) {
10961				new_widget.find('.widget-title').addClass('open');
10962				if (state.css) {
10963					new_widget.find('.widget-collapse-content').attr('style', state.css);
10964				}
10965			} else {
10966				new_widget.find('.widget-title').removeClass('open');
10967				if (state.css) {
10968					new_widget.find('.widget-collapse-content').attr('style', state.css);
10969				}
10970			}
10971		}
10972	}
10973
10974	// Reload items via AJAX
10975	function reload_items(container, url, push) {
10976		container.addClass('grid-filtering');
10977
10978		$.ajax({
10979			url     : url,
10980			success : function(response) {
10981				if (!response) {
10982					return;
10983				}
10984
10985				$(document).trigger('uncode-ajax-pre-filtered');
10986
10987				var container_id = container.attr('id');
10988				var pagination = $('.row-navigation');
10989
10990				if (container_id) {
10991					var container_to_append = $(response).find('#' + container_id);
10992					var pagination_to_append = $(response).find('.row-navigation');
10993					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
10994
10995					// Remember open/closed widgets
10996					var widgets = $('.uncode_widget');
10997					var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append;
10998					var widgets_states = [];
10999
11000					widgets.each(function() {
11001						var widget = $(this);
11002						var id = widget.attr('data-id');
11003						var state = {
11004							'id': id,
11005							'collapse': false,
11006							'open': false,
11007							'css': false,
11008						};
11009
11010						var collapse_wrapper = widget.find('.widget-collapse-content');
11011
11012						if (collapse_wrapper.length > 0) {
11013							state.collapse = true;
11014
11015							var collapse_wrapper_css = collapse_wrapper.attr('style');
11016							var title = widget.find('.widget-title');
11017
11018							state.css = collapse_wrapper_css;
11019
11020							if (title.hasClass('open')) {
11021								state.open = true;
11022							} else {
11023								state.open = false;
11024							}
11025						}
11026
11027						widgets_states.push(state);
11028					});
11029
11030					// Update widgets state
11031					if (offcanvas_sidebar_wrapper.length === 0) {
11032						update_widgets_state(widgets_states, container_to_append);
11033					}
11034
11035					// Update default sidebar state
11036					if (!container.hasClass('ajax-hide-filters')) {
11037						container_to_append.removeClass('ajax-hide-filters');
11038					}
11039
11040					// Update horizontal sidebar
11041					if (!container.hasClass('ajax-hide-filters-blanks')) {
11042						container_to_append.removeClass('ajax-hide-filters-blanks');
11043					}
11044					var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal');
11045					if (horizontal_sidebar_wrapper.length > 0) {
11046						var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar');
11047						var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style');
11048						var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0);
11049						var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style');
11050
11051						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style);
11052						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style);
11053					}
11054
11055					// Append container
11056					container.replaceWith(container_to_append);
11057
11058					// Hide first thumbnail until the new srcset is loaded
11059					if (SiteParameters.dynamic_srcset_active === '1') {
11060						container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations');
11061					}
11062
11063					// Remove loading attribute to images
11064					container_to_append.find('img').attr('loading', '');
11065
11066					// Append pagination
11067					if (pagination.length > 0) {
11068						if (pagination_to_append.length > 0) {
11069							pagination.html(pagination_to_append.html());
11070						} else {
11071							pagination.html('');
11072						}
11073					} else {
11074						if (pagination_to_append.length > 0) {
11075							$('.post-wrapper').append(pagination_to_append);
11076						}
11077					}
11078
11079					// Update off canvas sidebar (mobile and overlay)
11080					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
11081
11082					if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) {
11083						var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0);
11084						var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0);
11085						container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />');
11086						container_to_append.find('.ajax-filter-sidebar-wrapper').remove();
11087
11088						// Update widgets state
11089						update_widgets_state(widgets_states, sidebar_to_append);
11090
11091						// Update sidebar
11092						sidebar_container.html(sidebar_to_append.html());
11093					}
11094
11095					if (push) {
11096						UNCODE.lastURL = url;
11097						window.history.pushState(
11098							{ pageTitle: document.title },
11099							'',
11100							url
11101						);
11102					}
11103
11104					if (typeof UNCODE.isotopeLayout !== 'undefined') {
11105						UNCODE.isotopeLayout();
11106					}
11107					if (typeof UNCODE.justifiedGallery !== 'undefined') {
11108						UNCODE.justifiedGallery();
11109					}
11110					if (typeof UNCODE.cssGrid !== 'undefined') {
11111						UNCODE.cssGrid();
11112					}
11113					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
11114						UNCODE.lightbox();
11115					}
11116					if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
11117						UNCODE.lightgallery();
11118					}
11119					if (typeof UNCODE.carousel !== 'undefined') {
11120						UNCODE.carousel($('body'));
11121					}
11122					UNCODE.animations();
11123					if (typeof UNCODE.filters !== 'undefined') {
11124						UNCODE.filters();
11125					}
11126					if (typeof UNCODE.widgets !== 'undefined') {
11127						UNCODE.widgets();
11128					}
11129
11130					if (SiteParameters.dynamic_srcset_active === '1') {
11131						UNCODE.refresh_dynamic_srcset_size();
11132					}
11133
11134					if (typeof UNCODE.menuSmartInit !== 'undefined') {
11135						UNCODE.menuSmartInit();
11136					}
11137
11138					if (typeof UNCODE.parallax !== 'undefined') {
11139						UNCODE.parallax();
11140					}
11141
11142					maybe_scroll_to_top();
11143
11144					var woo_select2_cats = $('.dropdown_product_cat');
11145
11146					if (woo_select2_cats.length > 0) {
11147						woo_select2_cats.on( 'change', function() {
11148							if ( $(this).val() != '' ) {
11149								var this_page = '';
11150								var home_url  = UncodeWCParameters.uncode_wc_widget_product_categories_home_url;
11151								if ( home_url.indexOf( '?' ) > 0 ) {
11152									this_page = home_url + '&product_cat=' + $(this).val();
11153								} else {
11154									this_page = home_url + '?product_cat=' + $(this).val();
11155								}
11156								location.href = this_page;
11157							} else {
11158								location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url;
11159							}
11160						});
11161
11162						if ( $().selectWoo ) {
11163							var wc_product_cat_select = function() {
11164								woo_select2_cats.selectWoo( {
11165									placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder,
11166									minimumResultsForSearch: 5,
11167									width: '100%',
11168									allowClear: true,
11169									language: {
11170										noResults: function() {
11171											return UncodeWCParameters.uncode_wc_widget_product_categories_no_results;
11172										}
11173									}
11174								} );
11175							};
11176							wc_product_cat_select();
11177						}
11178					}
11179
11180					$(document).trigger('uncode-ajax-filtered');
11181					$(document.body).trigger('init_price_filter');
11182				}
11183			},
11184			error: function() {
11185				container.removeClass('grid-filtering');
11186
11187				if (SiteParameters.enable_debug == true) {
11188					// This console log is disabled by default
11189					// So nothing is printed in a typical installation
11190					//
11191					// It can be enabled for debugging purposes setting
11192					// the 'uncode_enable_debug_on_js_scripts' filter to true
11193					console.log('There was an error retrieving the products');
11194				}
11195			}
11196		});
11197	}
11198
11199	// Scroll to top after filtering
11200	function maybe_scroll_to_top() {
11201		var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
11202
11203		if (offcanvas_sidebar_wrapper.length > 0) {
11204			return;
11205		}
11206
11207		var container = get_filters_container();
11208		var bound = container[0].getBoundingClientRect();
11209
11210		if (bound.y < 0) {
11211			$(window).scrollTop(container.offset().top);
11212		}
11213	}
11214
11215	// Back/forward browser buttons
11216	$(window).on("popstate.ajaxfilters", function(e) {
11217		var location = window.location;
11218		var url = location.href;
11219		var params = UNCODE.getURLParams(window.location);
11220		var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
11221
11222		UNCODE.lastURL = url;
11223
11224		if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
11225			return;
11226		}
11227
11228		var container = get_filters_container();
11229
11230		reload_items(container, url, false);
11231	});
11232
11233	// Destroy load more before to init a new one
11234	$(window).on('uncode-ajax-pre-filtered', function() {
11235		if ($.fn.infinitescroll) {
11236			$('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy');
11237		}
11238	});
11239
11240	init_filters();
11241};
11242
11243UNCODE.videoThumbs = function() {
11244	var checkResize,
11245		newW = UNCODE.wwidth;
11246	var checkForVideos = function(){
11247
11248		$(window).on('okevents.y.change', function(e, y){
11249			var $video = $(y.target.g),
11250				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
11251				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
11252				restart = !$video_wrap.hasClass('play-pause'),
11253				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual'),
11254				setTime;
11255			if ( newW >= UNCODE.mediaQuery ) {
11256
11257				if( $video_wrap.length && $video_wrap.data('hovered') !== true ) {
11258					$video_wrap.data('hovered', true);
11259					$video_wrap.addClass('played-on');
11260					y.target.pauseVideo();
11261					$tmb.on('mouseenter', function(){
11262						if ( restart ) {
11263							y.target.seekTo(0);
11264						}
11265						y.target.playVideo();
11266					}).on('mouseleave', function(){
11267						clearTimeout(setTime);
11268						setTime = setTimeout(function(){
11269							y.target.pauseVideo();
11270						}, 300);
11271					});
11272				}
11273
11274			} else {
11275				if( $mobile_video_wrap.length ) {
11276					$video_wrap.addClass('played-on');
11277					y.target.playVideo();
11278				}
11279			}
11280
11281		});
11282
11283		$(window).on('okevents.v.loaded', function(e, playerV){
11284			var $video = $(playerV.element),
11285				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
11286				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
11287				restart = !$video_wrap.hasClass('play-pause'),
11288				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual'),
11289				setTime;
11290
11291			if ( newW >= UNCODE.mediaQuery ) {
11292				
11293				if( $video_wrap.length ) {
11294
11295					var playPromise = playerV.play();
11296					if (playPromise !== undefined) {
11297						playPromise.then(function( value ) {
11298							playerV.pause();
11299						});
11300					}
11301					$video_wrap.addClass('played-on');
11302					$tmb.on('mouseenter', function(){
11303						if ( restart ) {
11304							playerV.setCurrentTime(0)
11305						}
11306						playerV.play();
11307					}).on('mouseleave', function(){
11308						clearTimeout(setTime);
11309						setTime = setTimeout(function(){
11310							playerV.pause();
11311						}, 300);
11312					});
11313				}
11314
11315			} else {
11316
11317				if( $mobile_video_wrap.length ) {
11318					var playPromise = playerV.play();
11319					if (playPromise !== undefined) {
11320						playPromise.then(function( value ) {
11321							playerV.play();
11322						});
11323					}
11324					$video_wrap.addClass('played-on');
11325				}
11326			}
11327		});
11328
11329		$('.fluid-object.self-video.is-no-control video').each(function(key, video){
11330			var $video = $(video),
11331				$noscript = $('noscript', $video),
11332				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
11333				restart = !$video_wrap.hasClass('play-pause'),
11334				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
11335				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') 
11335: $video.closest('.t-entry-visual'),
11336				setTime,
11337			manageVideo = function(){
11338				video.currentTime = 0;
11339				video.pause();
11340				if ( newW >= UNCODE.mediaQuery ) {
11341					if ( $video_wrap.length ) {
11342						$video_wrap.addClass('played-on');
11343						$tmb.on('mouseenter', function(){
11344							if ( restart ) {
11345								video.currentTime = 0;
11346							}
11347							video.play();
11348						}).on('mouseleave', function(){
11349							clearTimeout(setTime);
11350							setTime = setTimeout(function(){
11351								video.pause();
11352							}, 300);
11353						});
11354					} else {
11355						video.play();
11356					}
11357				} else {
11358					if ( $mobile_video_wrap.length ) {
11359						$mobile_video_wrap.addClass('played-on');
11360						video.play();
11361					}
11362				}
11363
11364			};
11365			if ( $noscript.length && newW >= UNCODE.mediaQuery ) {
11366				$noscript.each(function(key, val){
11367					$noscript.after(val.textContent || val.innerText);
11368					$noscript.remove();
11369				});
11370			}
11371
11372			if (typeof MediaElement === "function") {
11373				$video.has('source[src]').mediaelementplayer({
11374					pauseOtherPlayers: false,
11375				});
11376			}
11377			if (video.readyState > 0) {
11378				manageVideo();
11379			} else {
11380				$video.on("loadedmetadata", function(_event) {
11381					manageVideo();
11382				});
11383			};
11384		});
11385	
11386	};
11387	
11388	checkForVideos();
11389
11390	var checkVideoResize = function(){
11391		clearRequestTimeout(checkResize);
11392		checkResize = requestTimeout(function(){
11393			if ( newW !== UNCODE.wwidth ) {
11394				checkForVideos();
11395				newW = UNCODE.wwidth;
11396			}
11397		}, 1000);
11398	};
11399
11400	$(window).off('resize.videos', checkVideoResize)
11401	.on( 'resize.videos', checkVideoResize);
11402
11403};
11404UNCODE.lottie = function() {
11405    if ( SiteParameters.is_frontend_editor ) {
11406        var $lottie_wraps = $('div.uncode-lottie-wrap');
11407        $lottie_wraps.each(function(){
11408            var $lottie_wrap = $(this),
11409                $div_player = $('div.uncode-lottie-player', $lottie_wrap),
11410                $player_clone = $div_player.clone(),
11411                player_id = $div_player.attr('data-id'),
11412                $lottie_players = $('lottie-player', $lottie_wrap).remove();
11413            if ( $div_player.attr('data-init') !== true && $player_clone.length ) {
11414                if ( $('#'+player_id).length ) {
11415                    player_id += '_' + Math.floor(Math.random() * 10000000000000000);
11416                }
11417                $player_clone.attr('id', player_id);
11418                $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player");
11419                $div_player.after($player_clone);
11420                $div_player.attr('data-init',true);
11421            }
11422        });
11423    }
11424    var $players = $('.uncode-lottie-wrap lottie-player');
11425    $players.each(function(){
11426        var player = this,
11427            this_id = $(player).attr('id'),
11428            _player = document.getElementById(this_id),
11429            trigger = $(player).attr('data-trigger'),
11430            pFrames = $(player).attr('data-frames').split(','),
11431            srcPlayer = $(player).attr('src');
11432
11433        _player.load(srcPlayer);
11434
11435        _player.addEventListener("ready", function() {
11436
11437            var $_shadow = _player.shadowRoot;
11438            $($_shadow).find('.error').remove();
11439
11440            var tFrames = _player.getLottie().totalFrames / 100,
11441                pFrame_from = Math.round(tFrames * pFrames[0]),
11442                pFrame_to = Math.round( tFrames * pFrames[1] ) - 1,
11443                loop = $(player).attr('loop'),
11444                mode,
11445                actions;
11446
11447            if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) {
11448                if ( trigger === 'scroll' ) {
11449                    mode = 'scroll';
11450                    actions = [
11451                        {
11452                            visibility:[0, 1.0],
11453                            type: "seek",
11454                            frames: [pFrame_from, pFrame_to],
11455                        }
11456                    ];
11457                } else if ( trigger === 'viewport') {
11458                    mode = 'scroll';
11459                    actions = [
11460                        {
11461                            visibility: [0.20, 1.0],
11462                            frames: [pFrame_from, pFrame_to],
11463                            type: loop ? "loop" : "play"
11464                        }
11465                    ];
11466                } else if ( trigger === 'hover') {
11467                    $(player).on('mouseenter', function(){
11468                        _player.play();
11469                    }).on('mouseleave', function(){
11470                        _player.pause();
11471                    });
11472                    if ( pFrame_from > 0 && pFrame_from < 99 ) {
11473                        _player.seek(pFrame_from);
11474                        _player.addEventListener("frame", function(){
11475                            if ( _player.getLottie().currentFrame >= pFrame_to ) {
11476                                _player.seek(pFrame_from);
11477                            }
11478                        });
11479                    }
11480                }
11481                LottieInteractivity.create({
11482                    player: '#' + this_id,
11483                    mode: mode,
11484                    actions: actions
11485                });
11486            } else {
11487                if ( pFrame_from > 0 && pFrame_from < 99 ) {
11488                    _player.seek(pFrame_from);
11489                    _player.addEventListener("frame", function(){
11490                        if ( _player.getLottie().currentFrame >= pFrame_to ) {
11491                            _player.seek(pFrame_from);
11492                        }
11493                    });
11494                }
11495            }
11496        });
11497
11498        $(window).on('unlottie-destroy', function(){
11499            _player.destroy();
11500        });
11501    });
11502};
11503
11504	UNCODE.init = function() {
11505		var wfl_check = false, wfl_request, waypoint_request;
11506		UNCODE.preventDoubleTransition();
11507		UNCODE.betterResize();
11508		UNCODE.utils();
11509		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
11510			UNCODE.changeSkinOnScroll();
11511		}
11512		if (typeof UNCODE.share !== 'undefined') {
11513			UNCODE.share();
11514		}
11515		if (typeof UNCODE.tooltip !== 'undefined') {
11516			UNCODE.tooltip();
11517		}
11518		if (typeof UNCODE.counters !== 'undefined') {
11519			UNCODE.counters();
11520		}
11521		if (typeof UNCODE.countdowns !== 'undefined') {
11522			UNCODE.countdowns();
11523		}
11524		if (typeof UNCODE.tabs !== 'undefined') {
11525			UNCODE.tabs();
11526		}
11527		if (typeof UNCODE.collapse !== 'undefined') {
11528			UNCODE.collapse();
11529		}
11530		if (typeof UNCODE.bigText !== 'undefined') {
11531			UNCODE.bigText();
11532		}
11533		UNCODE.menuSystem();
11534		if (typeof UNCODE.bgChanger !== 'undefined') {
11535			UNCODE.bgChanger();
11536		}
11537		if (typeof UNCODE.magicCursor !== 'undefined') {
11538			UNCODE.magicCursor();
11539		}
11540		if (typeof UNCODE.magneticCursor !== 'undefined') {
11541			UNCODE.magneticCursor();
11542		}
11543		if (typeof UNCODE.dropImage !== 'undefined') {
11544			UNCODE.dropImage();
11545		}
11546		if (typeof UNCODE.postTable !== 'undefined') {
11547			UNCODE.postTable();
11548		}
11549		if (typeof UNCODE.rotatingTxt !== 'undefined') {
11550			UNCODE.rotatingTxt();
11551		}
11552		if (typeof UNCODE.okvideo !== 'undefined') {
11553			UNCODE.okvideo();
11554		}
11555		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
11556			UNCODE.backgroundSelfVideos();
11557		}
11558		UNCODE.tapHover();
11559		if (typeof UNCODE.isotopeLayout !== 'undefined') {
11560			UNCODE.isotopeLayout();
11561		}
11562		if (typeof UNCODE.justifiedGallery !== 'undefined') {
11563			UNCODE.justifiedGallery();
11564		}
11565		if (typeof UNCODE.cssGrid !== 'undefined') {
11566			UNCODE.cssGrid();
11567		}
11568		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
11569			UNCODE.lightbox();
11570		}
11571		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
11572			$(window).on('load more-items-loaded',function(){
11573				UNCODE.lightgallery();
11574			});
11575		}
11576		if (typeof UNCODE.carousel !== 'undefined') {
11577			UNCODE.carousel($('body'));
11578		}
11579		if (typeof UNCODE.lettering !== 'undefined') {
11580			UNCODE.lettering();
11581		}
11582		UNCODE.animations();
11583		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
11584			UNCODE.stickyElements();
11585		}
11586		if (typeof UNCODE.twentytwenty !== 'undefined') {
11587			UNCODE.twentytwenty();
11588		}
11589		UNCODE.disableHoverScroll();
11590		UNCODE.printScreen();
11591		if (typeof UNCODE.particles !== 'undefined') {
11592			UNCODE.particles();
11593		}
11594		if (typeof UNCODE.filters !== 'undefined') {
11595			UNCODE.filters();
11596		}
11597		if (typeof UNCODE.ajax_filters !== 'undefined') {
11598			UNCODE.ajax_filters();
11599		}
11600		if (typeof UNCODE.widgets !== 'undefined') {
11601			UNCODE.widgets();
11602		}
11603		if (typeof UNCODE.unmodal !== 'undefined') {
11604			UNCODE.unmodal();
11605		}
11606		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
11607			if ( !UNCODE.isFullPage ) {
11608				UNCODE.checkScrollForTabs();
11609			}
11610		}
11611		if (typeof UNCODE.onePage !== 'undefined') {
11612			UNCODE.onePage(UNCODE.isMobile);
11613		}
11614		if (typeof UNCODE.fullPage !== 'undefined') {
11615			$(document).ready(function(){
11616				UNCODE.fullPage();
11617			});
11618		}
11619		if (typeof UNCODE.skewIt !== 'undefined') {
11620			UNCODE.skewIt();
11621		}
11622		if (typeof UNCODE.rotateIt !== 'undefined') {
11623			UNCODE.rotateIt();
11624		}
11625		if (typeof UNCODE.textMarquee !== 'undefined') {
11626			UNCODE.textMarquee();
11627		}
11628		if (typeof UNCODE.stickyScroll !== 'undefined') {
11629			UNCODE.stickyScroll();
11630		}
11631		if (typeof UNCODE.stickyTrigger !== 'undefined') {
11632			UNCODE.stickyTrigger();
11633		}
11634		if (typeof UNCODE.verticalText !== 'undefined') {
11635			UNCODE.verticalText();
11636		}
11637		if (typeof UNCODE.videoThumbs !== 'undefined') {
11638			UNCODE.videoThumbs();
11639		}
11640		if (typeof UNCODE.revslider !== 'undefined') {
11641			UNCODE.revslider();
11642		}
11643		if (typeof UNCODE.layerslider !== 'undefined') {
11644			UNCODE.layerslider();
11645		}
11646		if (typeof UNCODE.lottie !== 'undefined') {
11647			UNCODE.lottie();
11648		}
11649		$(window).on('load',function(){
11650			clearRequestTimeout(waypoint_request);
11651			waypoint_request = requestTimeout( function(){
11652				Waypoint.refreshAll();
11653			}, 1000);
11654
11655			if (typeof UNCODE.parallax !== 'undefined') {
11656				UNCODE.parallax();
11657			}
11658		});
11659	}
11660
11661	if ( ! SiteParameters.is_frontend_editor ) {
11662		UNCODE.init();
11663	}
11664
11665
11666})(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.