PageSourceSearch

https://artprom.cz/wp-content/themes/uncode/library/js/app.js?ver=1354492171

js artprom.cz collected 2026-10-09 21:41:49 UTC 333,104 bytes, 10,529 lines download raw bytes

1/* ----------------------------------------------------------
2 * Uncode App
3 * ---------------------------------------------------------- */
4
5(function($) {
6	"use strict";
7	var UNCODE = window.UNCODE || {};
8	window.UNCODE = UNCODE;
9
10	window.requestAnimFrame = (function() {
11	return  window.requestAnimationFrame	   ||
12			window.webkitRequestAnimationFrame ||
13			window.mozRequestAnimationFrame	||
14			window.oRequestAnimationFrame	  ||
15			window.msRequestAnimationFrame	 ||
16			function(/* function */ callback, /* DOMElement */ element){
17				window.setTimeout(callback, 1000 / 60);
18			};
19})();
20
21window.requestTimeout = function(fn, delay) {
22	if( !window.requestAnimationFrame	  	&&
23		!window.webkitRequestAnimationFrame &&
24		!(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) && // Firefox 5 ships without cancel support
25		!window.oRequestAnimationFrame	  &&
26		!window.msRequestAnimationFrame)
27			return window.setTimeout(fn, delay);
28
29	var start = new Date().getTime(),
30		handle = new Object();
31
32	function loop(){
33		var current = new Date().getTime(),
34			delta = current - start;
35
36		delta >= delay ? fn.call() : handle.value = requestAnimFrame(loop);
37	};
38
39	handle.value = requestAnimFrame(loop);
40	return handle;
41};
42
43window.clearRequestTimeout = function(handle) {
44	if ( typeof handle !== 'undefined' ) {
45		window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) :
46		window.webkitCancelAnimationFrame ? window.webkitCancelAnimationFrame(handle.value) :
47		window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value) : /* Support for legacy API */
48		window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) :
49		window.oCancelRequestAnimationFrame	? window.oCancelRequestAnimationFrame(handle.value) :
50		window.msCancelRequestAnimationFrame ? window.msCancelRequestAnimationFrame(handle.value) :
51		clearTimeout(handle);
52	}
53};
54
55UNCODE.betterResize = function() {
56	var setResize,
57		doubleResize = true,
58		oldW = UNCODE.wwidth;
59	$(window).on( 'resize orientationchange', function(){
60		if ( oldW === UNCODE.wwidth ) {
61			return;
62		} else {
63			oldW = UNCODE.wwidth;
64			$(window).trigger('wwResize');
65		}
66	});
67};
68
69Number.isInteger = Number.isInteger || function(value) {
70    return typeof value === "number" &&
71           isFinite(value) &&
72           Math.floor(value) === value;
73};
74
75UNCODE.utils = function() {
76	$(document).on('mouseover', 'a', function() {
77		$(this).attr('data-title', $(this).attr('title'));
78		$(this).removeAttr('title');
79	});
80	$(document).on('mouseout', 'a', function() {
81		$(this).attr('title', $(this).attr('data-title'));
82		$(this).removeAttr('data-title');
83	});
84
85	this.get_scroll_offset = function(e) {
86
87		var scroll_offset = 0,
88			target,
89			trigger;
90
91		if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) {
92			target = e.target;
93			trigger = e.currentTarget;
94		}
95
96		if ($('.menu-hide').length || $('.menu-hide-vertical').length) {
97			if (UNCODE.bodyTop > UNCODE.wheight / 2) {
98				UNCODE.hideMenu(100);
99			}
100		}
101
102		if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery  ) {
103			// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
104			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
105				if ( ( $('.menu-sticky').length && !$('.menu-hide').length && !UNCODE.isMobile ) || ( $('.menu-sticky-mobile').length && UNCODE.isMobile ) ) {
106					if ( !$('.menu-hided').length ) {
107						scroll_offset += $('.logo-container:visible').outerHeight();
108					}
109				} else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) {
110					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
111					scroll_offset += $('.menu-sticky .menu-container').outerHeight() - ( $('.navbar-brand').data('minheight') + shrink );
112				} else {
113					if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) {
114						scroll_offset += UNCODE.menuMobileHeight;
115					} else {
116						if ( typeof target !== 'undefined' && target.closest('.main-menu-container') != null && UNCODE.wwidth < UNCODE.mediaQuery && ! $('body').hasClass('vmenu') && ! $('body').hasClass('menu-mobile-transparent') && ! $('.menu-sticky').length ) {
117							scroll_offset += $('.main-menu-container > div:first-child()').height() - 2;
118						} else {
119							if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) {
120								scroll_offset += UNCODE.menuMobileHeight;
121							}
122						}
123					}
124				}
125			}
126	
127		}
128
129		scroll_offset += UNCODE.bodyBorder;
130
131		return scroll_offset;
132	}
133
134	if ( !UNCODE.isFullPage ) {
135		$(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) {
136
137			var hash = (e.currentTarget).hash,
138			is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false,
139			anchor = '';
140			if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return;
141			if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) {
142				e.preventDefault();
143				if (!$('#tab-reviews').is(':visible')) {
144					$('a[href="#tab-reviews"]').trigger('click');
145				}
146				var calc_scroll = $('.wootabs .tab-content').offset().top;
147				calc_scroll -= UNCODE.get_scroll_offset(e);
148
149				if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
150					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
151
152					if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
153						scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
154					}
155				}
156
157				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
158					delta = bodyTop - calc_scroll,
159					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
160				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
161
162				requestTimeout(function(){
163					if (scrollSpeed == 0) {
164						$('html, body').scrollTop(calc_scroll);
165						UNCODE.scrolling = false;
166					} else {
167   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
168							$(this).stop();
169						}).animate({
170								scrollTop: calc_scroll
171							}, scrollSpeed, 'easeInOutCubic', function() {
172								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
173								UNCODE.scrolling = false;
174							}
175						);
176					}
177				}, 200);
178				return;
179			}
180			if (hash != undefined) {
181				var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
182				var anchor = this.hash.slice(1);
183				if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) {
184			  		if ( !specialFormat.test(hash) ) {
185			  			if ( $(hash).length )
186			  				anchor = $(hash);
187			  		}
188				}
189			}
190
191			if (is_scrolltop || anchor != '') {
192				if (is_scrolltop) {
193					e.preventDefault();
194					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
195					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
196					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
197
198					if (scrollSpeed == 0) {
199						$('html, body').scrollTop(0);
200						UNCODE.scrolling = false;
201					} else {
202   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
203							$(this).stop();
204						}).animate({
205							scrollTop: 0
206						}, scrollSpeed, 'easeInOutCubic', function() {
207							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
208							UNCODE.scrolling = false;
209						});
210					}
211				} else {
212					var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor;
213					$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) {
214						var get_href = $(val).attr('href');
215						if (get_href != undefined) {
216							if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active');
217							else $(val).parent().removeClass('active');
218						}
219					});
220					if (scrollSection.length) {
221						if ( $('body').hasClass('uncode-scroll-no-history') ) {
222							e.preventDefault();
223						}
224
225						if (UNCODE.menuOpened) {
226							if (UNCODE.wwidth < UNCODE.mediaQuery) {
227								window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
228							} else {
229								$('.mmb-container-overlay .overlay-close').trigger('click');
230								$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
231							}
232						}
233
234						var calc_scroll = scrollSection.offset().top,
235							getOffset = UNCODE.get_scroll_offset(e),
236							$logo = $('.logo-container:visible'),
237							logoH,
238							$menu = $('#masthead .menu-container'),
239							menuH;
240
241						calc_scroll -= isNaN(getOffset) ? 0 : getOffset;
242
243						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
244							delta = bodyTop - calc_scroll,
245							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
246						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
247
248						if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
249							if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) {
250								logoH = $logo.outerHeight(),
251								menuH = $menu.outerHeight();
252								if ( calc_scroll < ( logoH + menuH ) ) {
253									calc_scroll = 0;
254								}
255							}
256						}
257
258
259						if (scrollSpeed == 0) {
260							$('html, body').scrollTop(calc_scroll);
261							UNCODE.scrolling = false;
262						} else {
263	   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
264								$(this).stop();
265							}).animate({
266								scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
267							}, scrollSpeed, 'easeInOutCubic', function() {
268								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
269								UNCODE.scrolling = false;
270								if  ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
271								||
272								$('.menu-hided').length ) {
273									calc_scroll = scrollSection.offset().top;
274									getOffset = UNCODE.get_scroll_offset(e);
275									calc_scroll -= getOffset;
276									$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
277										$(this).stop();
278									}).animate({
279										scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
280										}, scrollSpeed, 'easeInOutCubic', function() {
281											$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
282											UNCODE.scrolling = false;
283										}
284									);
285								}
286							});
287						}
288					}
289				}
290			}
291		});
292		$('.header-scrolldown').on('click', function(event) {
293
294			event.preventDefault();
295
296			var pageHeader = $(event.target).closest('#page-header'),
297				pageHeaderTop = pageHeader.offset().top,
298				pageHeaderHeight = pageHeader.outerHeight(),
299				scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
300			if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
301
302			var calc_scroll = pageHeaderTop + pageHeaderHeight,
303			getOffset = UNCODE.get_scroll_offset(event);
304			calc_scroll -= getOffset;
305
306			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
307				var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
308
309				if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
310					scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
311				}
312			}
313
314			if (scrollSpeed == 0) {
315				$('html, body').scrollTop(calc_scroll);
316				UNCODE.scrolling = false;
317			} else {
318					$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
319						$(this).stop();
320					}).animate({
321						scrollTop: calc_scroll
322					}, scrollSpeed, 'easeInOutCubic', function() {
323						$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
324						UNCODE.scrolling = false;
325						if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) {
326							calc_scroll = pageHeaderTop + pageHeaderHeight;
327							getOffset = UNCODE.get_scroll_offset(event);
328							calc_scroll -= getOffset;
329								$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
330									$(this).stop();
331								}).animate({
332									scrollTop: calc_scroll
333								}, scrollSpeed, 'easeInOutCubic', function() {
334									$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
335									UNCODE.scrolling = false;
336								}
337							);
338						}
339					}
340				);
341			}
342		});
343	}
344
345	// Colomun hover effect
346	// =================
347	$(document).on('mouseenter', '.col-link', function(e) {
348		var uncol = $(e.target).prev('.uncol'),
349		el = uncol.find('.column-background');
350		if (el) {
351			$('.btn-container .btn', uncol).toggleClass('active');
352			var elOverlay = $(el[0]).find('.block-bg-overlay');
353			if (elOverlay.length) {
354				var getOpacity = $(elOverlay).css('opacity');
355				if (getOpacity != 1) {
356					getOpacity = Math.round(getOpacity * 100) / 100;
357					var newOpacity = getOpacity + .1;
358					$(elOverlay).data('data-opacity', getOpacity);
359					$(elOverlay).css('opacity', newOpacity);
360				}
361			}
362		}
363	}).on('mouseleave', '.col-link', function(e) {
364		var uncol = $(e.target).prev('.uncol'),
365		el = uncol.find('.column-background');
366		$('.btn-container .btn', uncol).toggleClass('active');
367		if (el) {
368			var elOverlay = $(el[0]).find('.block-bg-overlay');
369			if (elOverlay.length) {
370				var getOpacity = $(elOverlay).data('data-opacity');
371				$(elOverlay).css('opacity', getOpacity);
372			}
373		}
374	});
375
376	// Admin bar
377	// ============
378	var fixAdminBar = function() {
379		if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) {
380			var getAdminBar = $('#wpadminbar');
381			if (getAdminBar.length) {
382				if (getAdminBar.css('position') !== 'hidden') {
383					var getAdminBarHeight = getAdminBar.height();
384					if (getAdminBar.css('position') === 'fixed') {
385						$('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'});
386						$('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'});
387					} else {
388						$('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'});
389						$('.body-borders .top-border').css({'margin-top':'0px'});
390					}
391				}
392			}
393		}
394	};
395	window.addEventListener('load', fixAdminBar);
396	window.addEventListener('resize', fixAdminBar);
397	// Print
398	// ===========
399	var beforePrint = function() {
400		window.dispatchEvent(new CustomEvent('resize'));
401		window.dispatchEvent(UNCODE.boxEvent);
402	};
403
404	if (window.matchMedia) {
405		var mediaQueryList = window.matchMedia('print');
406		mediaQueryList.addListener(function(mql) {
407			if (mql.matches) {
408				beforePrint();
409			}
410		});
411	}
412
413	window.onbeforeprint = beforePrint;
414
415	// Safari srcset
416	var safariSrcSet = function(){
417		if ( !SiteParameters.is_frontend_editor ) {
418			$('html.safari img[sizes]').each(function(){
419				var $img = $(this),
420					sizeImg = parseInt($img.attr('sizes'));
421				if ( typeof(sizeImg) === 'number' ) {
422					$img.attr('sizes', (sizeImg) + 'px');
423				}
424			});
425		}
426	};
427	window.addEventListener('load', safariSrcSet);
428}
429
430UNCODE.lettering = function() {
431
432	var setCTA;
433	var highlightStill = function(){
434
435		var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)');
436
437		$.each($heading_texts, function(key, el) {
438			var $heading = $(el);
439
440			if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) {
441				return;
442			}
443
444			if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) {
445				return;
446			}
447
448			var waypoint = new Waypoint({
449				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
450				element: el,
451				handler: function() {
452					var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element),
453						anims_l = $anims.length;
454					$anims.each(function(_key_, _el_){
455						var $anim = $(_el_);
456
457						if ( ! $anim.hasClass('heading-text-highlight-animated') ) {
458							$anim.addClass('heading-text-highlight-animated');
459
460							if ( $heading.data('animate') === true ) {
461								$anim.css({
462									'-webkit-transition-duration': '0ms',
463									'-moz-transition-duration': '0ms',
464									'-o-transition-duration': '0ms',
465									'transition-duration': '0ms',
466								});
467							} else {
468								$anim.css({
469									'-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms',
470									'-moz-transition-delay': ((_key_ + 2) * 200) + 'ms',
471									'-o-transition-delay': ((_key_ + 2) * 200) + 'ms',
472									'transition-delay': ((_key_ + 2) * 200) + 'ms',
473								});
474							}
475						}
476
477					});
478					$anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) {
479						$heading.data('animate', true);
480					});
481					$anims.removeAttr('data-animated');
482				},
483				offset: '100%'
484			});
485
486		});
487
488		Waypoint.refreshAll();
489		$( document.body ).trigger('uncode_waypoints');
490
491	}
492
493	requestTimeout(function(){
494		highlightStill();
495		$(window).on( 'resize', function(){
496			clearRequestTimeout(setCTA);
497			setCTA = requestTimeout( highlightStill, 100 );
498		});
499	}, 400);
500
501};
502
503UNCODE.isUnmodalOpen = false;
504
505var manageVideoSize = function(){
506
507	var setVideoFit;
508	$('.wp-block-embed').each(function(){
509
510		var $this = $(this);
511
512		if ( $('iframe', $this).length ) {
513
514			var $iframe = $('> iframe, > a > iframe', $this),
515				w = parseFloat($iframe.attr('width')),
516				h = parseFloat($iframe.attr('height')),
517				url = $iframe.attr('src'),
518				ratio, frW;
519
520			if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0  ) {
521
522				ratio = h / w;
523				var setResizeiFto,
524					resizeiFrame = function(){
525					frW = $iframe.width();
526					$iframe.css({
527						height: frW * ratio
528					});
529				};
530				resizeiFrame();
531				$(window).on( 'resize load', function(){
532					clearRequestTimeout(setResizeiFto);
533					setResizeiFto = requestTimeout( function() {
534						resizeiFrame();
535					}, 10 );
536				});
537
538			}
539
540		}
541
542	});
543
544};
545
546manageVideoSize();
547
548UNCODE.vivus = function(icon, time, delay, file) {
549	if (typeof Vivus !== 'undefined') {
550		var icon_options = {
551			type: 'delayed',
552			pathTimingFunction: Vivus.EASE_OUT,
553			animTimingFunction: Vivus.LINEAR,
554			duration: time,
555		}
556
557		if (delay) {
558			icon_options.delayStart = delay;
559		}
560
561		if (file) {
562			icon_options.file = file;
563		}
564
565		new Vivus(icon, icon_options);
566	}
567};
568
569UNCODE.lastURL = '';
570
571UNCODE.getURLParams = function(current_location, is_string) {
572	var params = {};
573	if (is_string) {
574		var url = current_location.split('?')[1];
575	} else {
576		var url = current_location.search;
577		url = url.substring(1);
578	}
579	if (url) {
580		var parts = url.split('&');
581		for (var i = 0; i < parts.length; i++) {
582			var nv = parts[i].split('=');
583			if (!nv[0]) {
584				continue;
585			}
586			params[nv[0]] = nv[1] || true;
587		}
588	}
589	return params;
590}
591
592UNCODE.hasEqualURLParams = function(obj1, obj2) {
593	for (var i in obj1) {
594		if (obj1.hasOwnProperty(i)) {
595			if (!obj2.hasOwnProperty(i)) {
596				return false;
597			}
598			if (obj1[i] != obj2[i]) {
599				return false;
600			}
601		}
602	}
603	for (var i in obj2) {
604		if (obj2.hasOwnProperty(i)) {
605			if (!obj1.hasOwnProperty(i)) {
606				return false;
607			}
608			if (obj1[i] != obj2[i]) {
609				return false;
610			}
611		}
612	}
613    return true;
614}
615
616UNCODE.changeSkinOnScroll = function(){
617	if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) {
618		return;
619	}
620	var $masthead = $('#masthead'),
621		transDesktop,
622		transMobile,
623		changeSkin,
624
625	checkTransparencyAndChange = function( $col ){
626		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
627		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
628		changeSkin = $masthead.hasClass('menu-change-skin');
629
630		if ( ! transDesktop && ! transMobile ) {
631			return false;
632		}
633
634		if ( ! changeSkin ) {
635			return false;
636		}
637
638		if ( $col.hasClass('style-light') ){
639			$masthead.removeClass('style-dark-override').addClass('style-light-override');
640			return false;
641		} else if ( $col.hasClass('style-dark') ) {
642			$masthead.removeClass('style-light-override').addClass('style-dark-override');
643			return false;
644		}
645	};
646
647	var prev_row = 'normal',
648		odd = true,
649		$rows = $('.vc_row[data-parent]:visible');
650	$.each($rows, function(index, row){
651		var $row = $(row),
652			$col = $('.uncol', $row).first(),
653			$slider = $('.uncode-slider', $row);
654
655		var wayDown = new Waypoint({
656			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
657			element: row,
658			handler: function(direction) {
659				if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
660					if ( $slider.length ) {
661						$col = $('.owl-item.index-active .uncol', $slider).first();
662					}
663					checkTransparencyAndChange($col);
664				}
665				if ( odd === false ) {
666					if ( row.hasAttribute('data-bg-changer') ) {
667						prev_row = 'bg-changer';
668					} else {
669						prev_row = 'normal';
670					}
671					odd = true;
672				} else {
673					odd = false;
674				}
675			},
676			offset: function() {
677				return UNCODE.menuHeight / 2
678			}
679		});
680		var wayUp = new Waypoint({
681			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
682			element: row,
683			handler: function(direction) {
684				if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
685					if ( $slider.length ) {
686						$col = $('.owl-item.index-active .uncol', $slider).first();
687					}
688					checkTransparencyAndChange($col);
689				}
690				if ( odd === false ) {
691					if ( row.hasAttribute('data-bg-changer') ) {
692						prev_row = 'bg-changer';
693					} else {
694						prev_row = 'normal';
695					}
696					odd = true;
697				} else {
698					odd = false;
699				}
700			},
701			offset: function() {
702				return -row.clientHeight + ( UNCODE.menuHeight / 2 )
703			}
704		});
705	});
706
707};
708
709UNCODE.share = function() {
710	if (typeof Share !== 'undefined') {
711		var share_button_element = $('.share-button');
712		var share_button_url = share_button_element.data('url');
713
714		var share_button_config = {
715			ui: {
716				flyout: "top center",
717				button_font: false,
718				button_text: '',
719				icon_font: false
720			}
721		};
722
723		if (share_button_url) {
724			share_button_config.url = share_button_url.replace("&", "%26");
725		}
726
727		var share_button_top = new Share('.share-button', share_button_config);
728	}
729};
730
731UNCODE.tooltip = function() {
732	if (typeof jQuery.fn.tooltip !== 'undefined') {
733		$('.btn-tooltip').tooltip();
734	}
735};
736
737UNCODE.counters = function() {
738	var $counters = $('.uncode-counter:not(.counter-init)');
739	$counters.each(function(){
740		var $counter = $(this).addClass('counter-init');
741		if ( $counter.closest( '.owl-carousel' ).length ) {
742			return;
743		}
744		$counter.addClass('started').counterUp({
745			delay: 10,
746			time: 1500
747		});
748	});
749};
750
751UNCODE.countdowns = function() {
752	var $countdowns = $('[data-uncode-countdown]:not(.counter-init)');
753	$countdowns.each(function() {
754		var $this = $(this).addClass('counter-init'),
755			finalDate = $(this).data('uncode-countdown');
756		$this.countdown(finalDate, function(event) {
757			$this.html(event.strftime('%D <small>' + SiteParameters.days + '</small> %H <small>' + SiteParameters.hours + '</small> %M <small>' + SiteParameters.minutes + '</small> %S <small>' + SiteParameters.seconds + '</small>'));
758		});
759	});
760};
761
762UNCODE.tabs = function() {
763	$(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function(e) {
764		e.preventDefault()
765		$(this).tab('show');
766		requestTimeout(function() {
767			window.dispatchEvent(UNCODE.boxEvent);
768			$(window).trigger('uncode.re-layout');
769		}, 300);
770	});
771};
772
773UNCODE.collapse = function() {
774	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
775		var $this = $(this),
776			href
777		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
778		var $target = $(target)
779		var data = $target.data('bs.collapse')
780		var option = data ? 'toggle' : $this.data()
781		var parent = $this.attr('data-parent')
782		var $parent = parent && $(parent)
783		var $title = $(this).parent()
784		if ($parent) {
785			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
786			if ($title.hasClass('active')) {
787				$title.removeClass('active');
788			} else {
789				$parent.find('.panel-title').removeClass('active')
790				$title[!$target.hasClass('in') ? 'addClass' : 'removeClass']('active')
791			}
792		}
793		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
794		requestTimeout(function() {
795			$(window).trigger('uncode.re-layout');
796		}, 500);
797	});
798};
799
800UNCODE.bigText = function(el) {
801	if (el == undefined) {
802		el = $('body');
803	}
804	$.each($('.bigtext', el), function(index, val) {
805		$(val).bigtext({
806			minfontsize: 24
807		});
808		if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
809			opacity: 1
810		});
811		requestTimeout(function() {
812			if ($(val).find('.animate_when_almost_visible').length != 0) {
813				$(val).css({opacity: 1});
814			}
815		}, 400);
816	});
817};
818
819UNCODE.process_shortpixel_image = function(image) {
820	var data = {
821		action: 'shortpixel_manual_optimization',
822		image_id: image,
823		cleanup: true
824	};
825
826	$.get(SiteParameters.ajax_url, data);
827};
828
829UNCODE.menuSystem = function() {
830
831	function menuMobile() {
832		var $body = $('body'),
833			$mobileToggleButton = $('.mobile-menu-button'),
834			$masthead = $('#masthead'),
835			$box,
836			$el,
837			$el_transp,
838			elHeight,
839			check,
840			animating = false,
841			stickyMobile = false,
842			menuClose = new CustomEvent('menuMobileClose'),
843			menuOpen = new CustomEvent('menuMobileOpen');
844		UNCODE.menuOpened = false;
845		$mobileToggleButton.on('click', function(event) {
846			var btn = this;
847			if ($(btn).hasClass('overlay-close')) return;
848			event.preventDefault();
849			$('.overlay-search.open .menu-close-dd', $masthead).trigger('click');
850			if (UNCODE.wwidth <= UNCODE.mediaQuery) {
851				$box = $(this).closest('.box-container').find('.main-menu-container');
852				$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner');
853				$el_transp = $('.menu-absolute.menu-transparent');
854				if (UNCODE.isMobile) {
855					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 ) {
856						stickyMobile = true;
857						elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
858					} else {
859						elHeight = 0;
860						$.each($box.find('> div'), function(index, val) {
861							elHeight += $(val).outerHeight();
862						});
863					}
864				} else {
865					elHeight = 0;
866					$.each($el, function(index, val) {
867						elHeight += $(val).outerHeight();
868					});
869				}
870				var open = function() {
871					if (!animating) {
872						$body.addClass('open-overlay-menu').addClass('opening-overlay-menu');
873						window.dispatchEvent(menuOpen);
874						animating = true;
875						UNCODE.menuOpened = true;
876						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) {			
877							if ( $body.hasClass('menu-sticky-mobile') || $('#masthead.menu-transparent').length ) {
878								$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
879							}
880							if ($('body.menu-offcanvas').length) {
881								$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
882								$('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + 
882UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
883							} else {
884								if ( $('.menu-hide, .menu-sticky').length ) {
885									if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length  ) {
886										$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
887									}
888								}
889							}
890						}
891						if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-hide, .menu-sticky-mobile').length) )) {
892							$("#masthead")[0].scrollIntoView();
893							$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
894						}
895						btn.classList.add('close');
896						$box.addClass('open-items');
897						if ($el_transp.length && $('body.menu-mobile-transparent').length) {
898							$el_transp.addClass('is_mobile_open');
899						}
900						$box.animate({
901							height: elHeight
902						}, 600, "easeInOutCirc", function() {
903							animating = false;
904							if (!stickyMobile) $box.css('height', 'auto');
905						});
906					}
907				};
908
909				var close = function() {
910					if (!animating) {
911						window.dispatchEvent(menuClose);
912						animating = true;
913						UNCODE.menuOpened = false;
914						btn.classList.remove('close');
915						btn.classList.add('closing');
916						$box.addClass('close');
917						requestTimeout(function() {
918							$box.removeClass('close');
919							$box.removeClass('open-items');
920							btn.classList.remove('closing');
921							if ($el_transp.length) {
922								$el_transp.removeClass('is_mobile_open');
923							}
924						}, 500);
925						$body.removeClass('opening-overlay-menu');
926						$box.animate({
927							height: 0
928						}, {
929							duration: 600,
930							easing: "easeInOutCirc",
931							complete: function(elements) {
932								$(elements).css('height', '');
933								animating = false;
934								if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) {
935									$('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative');
936								}
937								$body.removeClass('open-overlay-menu');
938							}
939						});
940					}
941				};
942				check = (!UNCODE.menuOpened) ? open() : close();
943			}
944		});
945		window.addEventListener('menuMobileTrigged', function(e) {
946			$('.mobile-menu-button.close').trigger('click');
947		});
948		window.addEventListener('orientationchange', function(e) {
949			$('#logo-container-mobile .mobile-menu-button.close').trigger('click');
950		});
951		window.addEventListener("resize", function() {
952			if ($(window).width() < UNCODE.mediaQuery) {
953				if (UNCODE.isMobile) {
954					var $box = $('.box-container .main-menu-container'),
955						$el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner');
956					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto') {
957						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
958							elHeight = 0;
959							$.each($el, function(index, val) {
960								elHeight += $(val).outerHeight();
961							});
962							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;
963							$($box).css('height', elHeight + 'px');
964						}
965					}
966				}
967			} else {
968				$('.menu-hide-vertical').removeAttr('style');
969				$('.menu-container-mobile').removeAttr('style');
970				$('.vmenu-container.menu-container').removeAttr('style');
971			}
972		});
973	};
974
975	function menuOffCanvas() {
976		var menuClose = new CustomEvent('menuCanvasClose'),
977			menuOpen = new CustomEvent('menuCanvasOpen');
978		$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').click(function(event) {
979			if ($(window).width() > UNCODE.mediaQuery) {
980				if ($(event.currentTarget).hasClass('close')) {
981					$(event.currentTarget).removeClass('close');
982					$(event.currentTarget).addClass('closing');
983					requestTimeout(function() {
984						$(event.currentTarget).removeClass('closing');
985						window.dispatchEvent(menuClose);
986					}, 500);
987
988				} else {
989					$(event.currentTarget).addClass('close');
990					window.dispatchEvent(menuOpen);
991				}
992			}
993
994			$('body').toggleClass('off-opened');
995		});
996	};
997
998	function menuOverlay() {
999		if ( $('.overlay').length ) {
1000			$('.overlay').removeClass('hidden');
1001		}
1002		if ($('.overlay-sequential, .menu-mobile-animated').length > 0) {
1003			$('.overlay-sequential .menu-smart > li, .menu-sticky .menu-container .menu-smart > li, .menu-hide.menu-container .menu-smart > li, .vmenu-container .menu-smart > li').each(function(index, el) {
1004				var transDelay = (index / 20) + 0.1;
1005				if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery )
1006					transDelay = transDelay + 0.3;
1007				$(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');
1008			});
1009		}
1010	};
1011	function menuAppend() {
1012		var $body = $('body'),
1013			$menuCont = $('.menu-container'),
1014			$cta = $('.navbar-cta'),
1015			$socials = $('.navbar-social'),
1016			$ul = $('.navbar-main ul.menu-primary-inner'),
1017			$ulCta,
1018			$ulSocials,
1019			$firstMenu = $('.main-menu-container:first-child', $menuCont),
1020			$secondMenu = $('.main-menu-container:last-child', $menuCont),
1021			$firstNav = $('.navbar-nav:first-child', $firstMenu),
1022			$secondNav = $('.navbar-nav:first-child', $secondMenu),
1023			$ulFirst = $('> ul', $firstNav),
1024			$ulSecond = $('> ul', $secondNav),
1025			setCTA,
1026			appendCTA = function(){
1027				return true;
1028			},
1029			appendSocials = function(){
1030				return true;
1031			},
1032			appendSplit = function(){
1033				return true;
1034			};
1035
1036		if ( $body.hasClass('cta-not-appended') )
1037			return false;
1038
1039		if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) {
1040			$ulCta = $('> ul', $cta);
1041
1042			appendCTA = function(){
1043				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1044					$ul.after($ulCta);
1045				} else {
1046					$cta.append($ulCta);
1047				}
1048			}
1049		}
1050		appendCTA();
1051
1052		if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') ) && $socials.length ) {
1053			$ulSocials = $('> ul', $socials);
1054
1055			appendSocials = function(){
1056				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1057					$ul.after($ulSocials);
1058				} else {
1059					$socials.append($ulSocials);
1060				}
1061			}
1062		}
1063		appendSocials();
1064
1065		if ( ( $body.hasClass('hmenu-center-double') ) ) {
1066			appendSplit = function(){
1067				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1068					if ( $secondNav.length ) {
1069						$secondNav.prepend($ulFirst);
1070					}
1071					$firstMenu.hide();
1072				} else {
1073					$firstNav.append($ulFirst);
1074					$firstMenu.css({
1075						'display': 'table-cell'
1076					});
1077				}
1078			}
1079		}
1080		appendSplit();
1081
1082		$(window).on( 'resize', function(){
1083			clearRequestTimeout(setCTA);
1084			setCTA = requestTimeout( function() {
1085				appendCTA();
1086				appendSocials();
1087				appendSplit();
1088			}, 10 );
1089		});
1090	}
1091	//menuMobileButton();
1092	menuMobile();
1093	menuOffCanvas();
1094	UNCODE.menuSmartInit();
1095	menuAppend();
1096	menuOverlay();
1097	var setMenuOverlay;
1098	$(window).on( 'resize', function(){
1099		if ( $('.overlay').length && $(window).width() > 1024 ) {
1100			$('.overlay').addClass('hidden');
1101		}
1102		clearRequestTimeout(setMenuOverlay);
1103		setMenuOverlay = requestTimeout( menuOverlay, 150 );
1104	});
1105};
1106
1107UNCODE.menuSmartInit = function() {
1108	var $menusmart = $('[class*="menu-smart"]'),
1109		$masthead = $('#masthead'),
1110		$hMenu = $('.menu-horizontal-inner', $masthead),
1111		$focus = $('.overlay-menu-focus'),
1112		showTimeout = 50,
1113		hideTimeout = 50,
1114		showTimeoutFunc, hideTimeoutFunc;
1115
1116	$('> li.menu-item-has-children', $menusmart).hover(function(){
1117		$(this).data('hover', true);
1118	}, function(){
1119		$(this).data('hover', false);
1120	});
1121
1122	if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) {
1123		var $notLis = $('> .nav > ul > li a', $hMenu),
1124			$menuA = $('a', $masthead).not($notLis),
1125			$hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'),
1126			showFuncCond = function() { return true };
1127
1128		if ( $('body').hasClass('focus-megamenu') ) {
1129			$hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner');
1130			showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') };
1131		} else if ( $('body').hasClass('focus-links') ) {
1132			$hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA);
1133		}
1134
1135		$hoverSelector.hover(function(){
1136			clearRequestTimeout(hideTimeoutFunc);
1137			showTimeoutFunc = requestTimeout(function(){
1138				$('body').addClass('navbar-hover');
1139			}, showTimeout*2);
1140		}, function(){
1141			hideTimeoutFunc = requestTimeout(function(){
1142				if ( ! $('.overlay-search.open', $masthead).length ) {
1143					$('body').removeClass('navbar-hover');
1144				}
1145			}, hideTimeout*2);
1146		});
1147	} else {
1148		showFuncCond = function() { return false };
1149	}
1150
1151	if ($menusmart.length > 0) {
1152		$menusmart.smartmenus({
1153			subIndicators: false,
1154			subIndicatorsPos: 'append',
1155			//subMenusMinWidth: '13em',
1156			subIndicatorsText: '',
1157			showTimeout: showTimeout,
1158			hideTimeout: hideTimeout,
1159			showFunction: function($ul, complete) {
1160				clearRequestTimeout(showTimeoutFunc);
1161				$ul.fadeIn(0, 'linear', function(){
1162					complete();
1163					if ( $ul.hasClass('vc_row') ) {
1164						$ul.css({
1165							'display': 'table'
1166						});
1167					}
1168					if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) {
1169						$('body').addClass('open-megamenu');
1170					}
1171					if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) {
1172						$('body').addClass('navbar-hover');
1173					}
1174				}).addClass('open-animated');
1175			},
1176			hideFunction: function($ul, complete) {
1177				if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') && ! $('.overlay-search.open', $masthead).length ) {
1178					$('body').removeClass('open-megamenu');
1179				}
1180				var fixIE = $('html.ie').length;
1181				if (fixIE) {
1182					var $rowParent = $($ul).closest('.main-menu-container');
1183					$rowParent.height('auto');
1184				}
1185				$ul.fadeOut(0, 'linear', function(){
1186					complete();
1187					$ul.removeClass('open-animated');
1188					if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) {
1189						$('body').removeClass('open-submenu');
1190					}
1191				});
1192			},
1193			collapsibleShowFunction: function($ul, complete) {
1194				$ul.slideDown(400, 'easeInOutCirc', complete);
1195			},
1196			collapsibleHideFunction: function($ul, complete) {
1197				$ul.slideUp(200, 'easeInOutCirc', complete);
1198			},
1199			hideOnClick: true
1200		});
1201
1202		if ( $('body').hasClass('menu-accordion-active') ) {
1203			requestTimeout(function(){
1204				$menusmart.addClass('menu-smart-init');
1205				$menusmart.smartmenus( 'itemActivate', $menusmart.find( '.current-menu-item > a' ).eq( -1 ) );
1206			}, 1000);
1207		}
1208	}
1209}
1210
1211UNCODE.okvideo = function() {
1212	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
1213	$.okvideo = function(options) {
1214		// if the option var was just a string, turn it into an object
1215		if (typeof options !== 'object') options = {
1216			'video': options
1217		};
1218		var base = this;
1219		// kick things off
1220		base.init = function() {
1221			base.options = $.extend({}, $.okvideo.options, options);
1222			// support older versions of okvideo
1223			if (base.options.video === null) base.options.video = base.options.source;
1224			base.setOptions();
1225			var target = base.options.target || $('body');
1226			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
1227			var zIndex = base.options.controls === 3 ? -999 : "auto";
1228			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
1229				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>';
1230				if (OKEvents.utils.isMobile()) {
1231					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>');
1232				} else {
1233					if (base.options.controls === 3) {
1234						target.append(mask)
1235					}
1236					if (base.options.adproof === 1) {
1237						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>');
1238					} else {
1239						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>');
1240					}
1241				}
1242				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
1243				if (base.options.playlist.list === null) {
1244					if (base.options.video.provider === 'youtube') {
1245						base.loadYouTubeAPI();
1246					} else if (base.options.video.provider === 'vimeo') {
1247						base.options.volume /= 100;
1248						base.loadVimeoAPI();
1249					}
1250				} else {
1251					base.loadYouTubeAPI();
1252				}
1253			}
1254		};
1255		// clean the options
1256		base.setOptions = function() {
1257			// exchange 'true' for '1' and 'false' for 3
1258			for (var key in this.options) {
1259				if (this.options[key] === true) this.options[key] = 1;
1260				if (this.options[key] === false) this.options[key] = 3;
1261			}
1262			if (base.options.playlist.list === null) {
1263				base.options.video = base.determineProvider();
1264			}
1265			// pass options to the window
1266			$(window).data('okoptions-' + base.options.id, base.options);
1267		};
1268		// insert js into the head and exectue a callback function
1269		base.insertJS = function(src, callback){
1270			var tag;
1271			if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) {
1272				tag = UNCODE.insertedSripts[src];
1273				if (callback){
1274					if (tag.readyState){  //IE
1275						tag.onreadystatechange = function(){
1276							if (tag.readyState === "loaded" ||
1277								tag.readyState === "complete"){
1278								tag.onreadystatechange = null;
1279								callback();
1280							}
1281						};
1282					} else {
1283						$(tag).on('load', callback);
1284					}
1285				}
1286				return;
1287			}
1288			tag = document.createElement('script');
1289			if (callback){
1290				if (tag.readyState){  //IE
1291					tag.onreadystatechange = function(){
1292						if (tag.readyState === "loaded" || tag.readyState === "complete"){
1293							tag.onreadystatechange = null;
1294							callback();
1295						}
1296					};
1297				} else {
1298					tag.onload = function() {
1299						callback();
1300					};
1301				}
1302			}
1303			tag.src = src;
1304			var firstScriptTag = document.getElementsByTagName('script')[0];
1305			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
1306			if ( ! UNCODE.insertedSripts ) {
1307				UNCODE.insertedSripts = [];
1308			}
1309			UNCODE.insertedSripts[src] = tag;
1310		};
1311		// load the youtube api
1312		base.loadYouTubeAPI = function(callback) {
1313			base.insertJS('https://www.youtube.com/player_api');
1314		};
1315		base.loadYouTubePlaylist = function() {
1316			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
1317		};
1318		// load the vimeo api by replacing the div with an iframe and loading js
1319		base.loadVimeoAPI = function() {
1320			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,
1321			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen>');
1322			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
1323			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
1324			base.insertJS('//player.vimeo.com/api/player.js', function() {
1325				vimeoPlayerReady(base.options.id);
1326			});
1327		};
1328		// is it from youtube or vimeo?
1329		base.determineProvider = function() {
1330			var a = document.createElement('a');
1331			a.href = base.options.video;
1332			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
1333				var videoid = a.href.split('/')[3].toString();
1334				var query = videoid.substring(videoid.indexOf('?') + 1);
1335				if (query != '') {
1336					var vars = query.split('&');
1337					for (var i = 0; i < vars.length; i++) {
1338						var pair = vars[i].split('=');
1339						if (pair[0] == 'v') {
1340							videoid = pair[1];
1341						}
1342					}
1343				}
1344				return {
1345					"provider": "youtube",
1346					"id": videoid
1347				};
1348			} else if (/vimeo.com/.test(base.options.video)) {
1349				return {
1350					"provider": "vimeo",
1351					"id": (a.href.split('/')[3].toString()).split('#')[0],
1352				};
1353			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
1354				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
1355				if (id.length == 11) {
1356					return {
1357						"provider": "youtube",
1358						"id": id.toString()
1359					};
1360				} else {
1361					for (var i = 0; i < base.options.video.length; i++) {
1362						if (typeof parseInt(base.options.video[i]) !== "number") {
1363							throw 'not vimeo but thought it was for a sec';
1364						}
1365					}
1366					return {
1367						"provider": "vimeo",
1368						"id": base.options.video
1369					};
1370				}
1371			} else {
1372				throw "OKVideo: Invalid video source";
1373			}
1374		};
1375		base.init();
1376	};
1377	$.okvideo.options = {
1378		id: null,
1379		source: null, // Deprecate dis l8r
1380		video: null,
1381		playlist: { // eat ur heart out @brokyo
1382			list: null,
1383			index: 0,
1384			startSeconds: 0,
1385			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
1386		},
1387		disableKeyControl: 1,
1388		captions: 0,
1389		loop: 1,
1390		hd: 1,
1391		volume: 0,
1392		adproof: false,
1393		unstarted: null,
1394		onFinished: null,
1395		onReady: null,
1396		onPlay: null,
1397		onPause: null,
1398		buffering: null,
1399		controls: false,
1400		autoplay: true,
1401		annotations: true,
1402		cued: null
1403	};
1404	$.fn.okvideo = function(options) {
1405		options.target = this;
1406		return this.each(function() {
1407			(new $.okvideo(options));
1408		});
1409	};
1410
1411	$(".no-touch .uncode-video-container.video").each(function(index, el) {
1412		var $this = $(this),
1413			url = $this.attr('data-video'),
1414			id = $this.attr('data-id'),
1415			cloned = $this.closest('.owl-item');
1416		if (!cloned.hasClass('cloned') || cloned.length == 0) {
1417			$this.okvideo({
1418				id: id,
1419				source: url.split('#')[0],
1420				time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
1421				autoplay: 1,
1422				controls: 0,
1423				volume: 0,
1424				adproof: 0,
1425				caller: $this,
1426				hd: 1,
1427				onReady: function(player) {
1428					var getPlayer = player.c || player.h || player,
1429					$iframe,
1430					getContainer = $(getPlayer).closest('.background-element');
1431					if (getContainer.length) {
1432						UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)');
1433					}
1434
1435					if ( $this.hasClass('drop-move') ) {
1436
1437						var $iframe = $(getPlayer),
1438							w = parseFloat($iframe.attr('width')),
1439							h = parseFloat($iframe.attr('height')),
1440							ratio = h / w,
1441							setResizeiFto,
1442						resizeiFrame = function(){
1443							var dataW = $this.attr('data-w'),
1444								newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
1445								newH = newW * ratio;
1446							$iframe.css({
1447								width: newW,
1448								height: newH
1449							});
1450						};
1451						resizeiFrame();
1452						$(window).on( 'load', resizeiFrame );
1453						$(window).on( 'resize', function(){
1454							clearRequestTimeout(setResizeiFto);
1455							setResizeiFto = requestTimeout( function() {
1456								resizeiFrame();
1457							}, 10 );
1458						});
1459
1460					}
1461
1462				}
1463			});
1464		}
1465	});
1466
1467	$(window).on('load', function(){
1468		$('.mejs-fullscreen-button button').on('click', function(){
1469			var $button = $(this),
1470				$stuck = $button.closest('.is_stucked');
1471
1472			if ( $stuck.length ) {
1473				$stuck = $(this).trigger("sticky_kit:detach");
1474				window.scrollTo(0, 0);
1475			}
1476		});
1477	});
1478};
1479
1480UNCODE.backgroundSelfVideos = function( $ctx ) {
1481
1482	if ( typeof $ctx === 'undefined' ) {
1483		$ctx = $('body');
1484	}
1485
1486	var backgroundSelfVideosInit = function( $ctx ) {
1487		$(".background-video-shortcode", $ctx).each(function(index, el) {
1488			if ( SiteParameters.block_mobile_videos === true ) {
1489				return false;
1490			}
1491			if ( $(this).closest('mediaelementwrapper').length ) {
1492				return true;
1493			}
1494			var $video_el = $(this),
1495				$parent_carousel = $video_el.parents('.uncode-slider').eq(0),
1496				$parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'),
1497				video_id = $video_el.attr('id');
1498
1499			if ( SiteParameters.is_frontend_editor ) {
1500				video_id = video_id + '_' + index;
1501				$video_el.attr('id', video_id);
1502			}
1503
1504			if (typeof MediaElement === "function") {
1505				var media = new MediaElement(video_id, {
1506					startVolume: 0,
1507					loop: true,
1508					success: function(mediaElement, domObject) {
1509						domObject.volume = 0;
1510						$(mediaElement).data('started', false);
1511						mediaElement.addEventListener('timeupdate', function(e) {
1512							if (!$(e.target).data('started')) {
1513								$(mediaElement).data('started', true);
1514							}
1515						});
1516						mediaElement.addEventListener('loadedmetadata', function(e) {
1517							mediaElement.play();
1518						});
1519						if (!UNCODE.isMobile) {
1520							requestTimeout(function() {
1521								UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)');
1522							}, 100);
1523						}
1524						if ( ($('html.firefox').length) && !$parent_carousel.length  ) {
1525							mediaElement.play();
1526						}
1527
1528						if ( $parent_drop_move.length ) {
1529							var setResizeMEto,
1530								resizeMediaElement = function(){
1531								var dataW = $parent_drop_move.attr('data-w'),
1532									videoW = domObject.width,
1533									videoH = domObject.height,
1534									newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
1535									newH = newW / ( videoW / videoH );
1536
1537								$(domObject).css({
1538									'height': newH,
1539									'width': newW
1540								});
1541							};
1542							$(window).on( 'resize load', function(){
1543								clearRequestTimeout(setResizeMEto);
1544								setResizeMEto = requestTimeout( function() {
1545									resizeMediaElement();
1546								}, 10 );
1547							});
1548						}
1549
1550						mediaElement.addEventListener('play', function() {
1551							$(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
1552							$(mediaElement).closest('#page-header').addClass('video-started');
1553							$(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
1554						}, true);
1555
1556					},
1557					// fires when a problem is detected
1558					error: function() {}
1559				});
1560
1561			} else {
1562				$video_el[0].play();
1563				$video_el[0].addEventListener('play', function() {
1564					$video_el[0].muted = true;
1565					$video_el[0].loop = true;
1566					$video_el.closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
1567					$video_el.closest('#page-header').addClass('video-started');
1568					$video_el.closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
1569				}, false);
1570			}
1571		});
1572	};
1573
1574	backgroundSelfVideosInit( $ctx );
1575
1576	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
1577		window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
1578			var $el = model.view.$el,
1579				shortcode = model.attributes.shortcode;
1580
1581			backgroundSelfVideosInit( $el );
1582		});
1583	}
1584};
1585
1586UNCODE.is_scrolling = false;
1587
1588UNCODE.disableHoverScroll = function() {
1589
1590	if (!UNCODE.isMobile && !UNCODE.isFullPage) {
1591		var body = document.body,
1592		timer;
1593
1594		window.addEventListener('scroll', function() {
1595			var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300;
1596			clearRequestTimeout(timer);
1597			if ( body.classList && !body.classList.contains('disable-hover') ) {
1598				body.classList.add('disable-hover');
1599				window.dispatchEvent(new CustomEvent('disable-hover'));
1600			}
1601			UNCODE.is_scrolling = true;
1602
1603			timer = requestTimeout(function() {
1604				if ( body.classList ) {
1605					body.classList.remove('disable-hover');
1606					window.dispatchEvent(new CustomEvent('enable-hover'));
1607				}
1608				UNCODE.is_scrolling = false;
1609			}, delay);
1610		}, false);
1611	}
1612};
1613
1614UNCODE.isotopeLayout = function() {
1615	if ($('.isotope-layout').length > 0) {
1616		var isotopeContainersArray = [],
1617			typeGridArray = [],
1618			layoutGridArray = [],
1619			screenLgArray = [],
1620			screenMdArray = [],
1621			screenSmArray = [],
1622			transitionDuration = [],
1623			$filterItems = [],
1624			$filters = $('.isotope-system .isotope-filters'),
1625			$itemSelector = '.tmb-iso',
1626			$items,
1627			itemMargin,
1628			correctionFactor = 0,
1629			firstLoad = true,
1630			isOriginLeft = $('body').hasClass('rtl') ? false : true;
1631		$('[class*="isotope-container"]').each(function(index) {
1632			var _this = $(this);
1633			var isoData = _this.data(),
1634			$data_lg,
1635			$data_md,
1636			$data_sm;
1637			_this.children('.tmb').addClass('tmb-iso');
1638			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
1639			else $data_lg = '1000';
1640			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
1641			else $data_md = '600';
1642			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
1643			else $data_sm = '480';
1644			screenLgArray.push($data_lg);
1645			screenMdArray.push($data_md);
1646			screenSmArray.push($data_sm);
1647			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
1648			if (isoData.type == 'metro') typeGridArray.push(true);
1649			else typeGridArray.push(false);
1650			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
1651			else layoutGridArray.push('masonry');
1652			isotopeContainersArray.push(_this);
1653			_this.attr('data-iso-index', index);
1654		});
1655		var colWidth = function(index) {
1656				$(isotopeContainersArray[index]).width('');
1657				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
1658					widthAvailable = $(isotopeContainersArray[index]).width(),
1659					columnNum = 12,
1660					columnWidth = 0,
1661					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
1662					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
1663					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
1664					$rowContainer,
1665					paddingRow,
1666					$colContainer,
1667					paddingCol;
1668
1669				if ( consider_menu )
1670					winHeight = winHeight - UNCODE.menuHeight;
1671
1672				if ( data_vp_height === '1' ) {
1673					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
1674					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
1675					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
1676					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
1677					winHeight = winHeight - ( paddingRow + paddingCol );
1678				}
1679
1680				if (isPx) {
1681					columnWidth = Math.ceil(widthAvailable / columnNum);
1682					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
1683				} else {
1684					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
1685				}
1686				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
1687				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
1688				for (var i = 0, len = $items.length; i < len; i++) {
1689					var $item = $($items[i]),
1690						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
1691						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
1692						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
1693
1694
1695					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
1696						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
1697					}
1698
1699					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
1700						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
1701					}
1702
1703					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
1704						if (multiplier_w != null && multiplier_w[1] !== undefined) {
1705							switch (parseInt(multiplier_w[1])) {
1706								case (5):
1707								case (4):
1708								case (3):
1709									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
1710									multiplier_w[1] = 6;
1711									break;
1712								case (2):
1713								case (1):
1714									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
1715									multiplier_w[1] = 3;
1716									break;
1717								default:
1718									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
1719									multiplier_w[1] = 12;
1720									break;
1721							}
1722
1723							if (multiplier_w[1] == 2.4) { // 5 columns
1724								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
1725								multiplier_w[1] = 6;
1726							}
1727						}
1728					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
1729						if (multiplier_w != null && multiplier_w[1] !== undefined) {
1730							switch (parseInt(multiplier_w[1])) {
1731								case (5):
1732								case (4):
1733								case (3):
1734								case (2):
1735								case (1):
1736									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
1737									multiplier_w[1] = 6;
1738									break;
1739								default:
1740									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
1741									multiplier_w[1] = 12;
1742									break;
1743							}
1744
1745							if (multiplier_w[1] == 2.4) { // 5 columns
1746								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
1747								multiplier_w[1] = 6;
1748							}
1749						}
1750					} else if (widthAvailable < screenSmArray[index]) {
1751						if (multiplier_w != null && multiplier_w[1] !== undefined) {
1752							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
1753							multiplier_w[1] = 12;
1754							if (typeGridArray[index]) multiplier_h[1] = 12;
1755						}
1756					}
1757					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
1758						height;
1759
1760					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
1761						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
1762						if ( widthAvailable < screenSmArray[index] ) {
1763							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
1764						}
1765					} else {
1766						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
1767					}
1768
1769					if (width >= widthAvailable) {
1770						$item.css({
1771							width: widthAvailable
1772						});
1773						if (typeGridArray[index]) {
1774							$item.children().add($item.find('.backimg')).css({
1775								height: height
1776							});
1777						}
1778					} else {
1779						$item.css({
1780							width: width
1781						});
1782						if (typeGridArray[index]) {
1783							$item.children().add($item.find('.backimg')).css({
1784								height: height
1785							});
1786						}
1787					}
1788				}
1789				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
1790					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
1791				} else {
1792					return columnWidth;
1793				}
1794			},
1795			init_isotope = function() {
1796				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
1797					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
1798						isotopeId = isotopeSystem.attr('id'),
1799						$layoutMode = layoutGridArray[i],
1800						setIsotopeFirstRowTimeOut,
1801					setIsotopeFirstRow = function(items){
1802						var firstRow = true;
1803						$(items).each(function(index, val){
1804							var el = items[index].element,
1805								el_top = items[index].position.y,
1806								$el = $(el);
1807							if ( index > 0 && el_top > 0 && firstRow ) {
1808								firstRow = false;
1809							} else if ( index == 0 && el_top == 0 ) {
1810								firstRow = true;
1811							}
1812							if ( firstRow ) {
1813								$el.removeClass('tmb-isotope-further-row');
1814							} else {
1815								$el.addClass('tmb-isotope-further-row');
1816							}
1817						});
1818					};
1819					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
1820						//resizable: true,
1821						itemSelector: $itemSelector,
1822						layoutMode: $layoutMode,
1823						transitionDuration: transitionDuration[i],
1824						masonry: {
1825							columnWidth: colWidth(i)
1826						},
1827						vertical: {
1828							horizontalAlignment: 0.5,
1829						},
1830						sortBy: 'original-order',
1831						isOriginLeft: isOriginLeft
1832					})
1833					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
1834					.on('layoutComplete', function( event, items ){
1835						if ( typeof items[0] !== 'undefined' ) {
1836							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
1837								setIsotopeFirstRow(items);
1838							}
1839						}
1840					})
1841					.on('arrangeComplete', function( event, items ){
1842						if ( typeof items[0] !== 'undefined' ) {
1843							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
1844								clearRequestTimeout(setIsotopeFirstRowTimeOut);
1845								setIsotopeFirstRowTimeOut = requestTimeout(function(){
1846									setIsotopeFirstRow(items);
1847								}, 100);
1848							}
1849						}
1850					});
1851					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
1852						$(isotopeContainersArray[i]).infinitescroll({
1853								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
1854								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
1855								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat', // selector for all items you'll retrieve
1856								animate: false,
1857								behavior: 'local',
1858								debug: false,
1859								loading: {
1860									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
1861									speed: 0,
1862									finished: undefined,
1863									msg: $('#' + isotopeId + ' .loadmore-button'),
1864								},
1865								errorCallback: function() {
1866									var isotope_system = $(this).closest('.isotope-system');
1867									$('.loading-button', isotope_system).hide();
1868									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
1869								}
1870							},
1871							// append the new items to isotope on the infinitescroll callback function.
1872							function(newElements, opts) {
1873								var $isotope = $(this),
1874									isotopeId = $isotope.closest('.isotope-system').attr('id'),
1875									filters = new Array(),
1876									$loading_button = $isotope.closest('.isotope-system').find('.loading-button'),
1877									$infinite_button = $isotope.closest('.isotope-system').find('.loadmore-button'),
1878									$numPages = $('a', $infinite_button).data('pages'),
1879									delay = 300;
1880								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
1881								$infinite_button.show();
1882								$loading_button.hide();
1883								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
1884								$('> li', $isotope).remove();
1885								$.each($(newElements), function(index, val) {
1886									$(val).addClass('tmb-iso');
1887									if ($(val).is("li")) {
1888										filters.push($(val)[0]);
1889									}
1890								});
1891								newElements = newElements.filter(function(x) {
1892									return filters.indexOf(x) < 0
1893								});
1894								$.each($(filters), function(index, val) {
1895									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
1896								});
1897								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
1898								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
1899									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
1900									if (typeof getLightbox === 'object') {
1901										getLightbox.refresh();
1902									} else {
1903										UNCODE.lightbox();
1904									}
1905								}
1906								if ( typeof twttr !== 'undefined' )
1907									twttr.widgets.load(isotopeContainersArray[i]);
1908
1909								requestTimeout(function() {
1910									Waypoint.refreshAll();
1911									$isotope.trigger('more-items-loaded');
1912								}, 1000);
1913
1914							});
1915						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
1916							var $infinite_isotope = $(isotopeContainersArray[i]),
1917								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
1918							$infinite_isotope.infinitescroll('pause');
1919							$infinite_button.on('click', function(event) {
1920								event.preventDefault();
1921								var $infinite_system = $(event.target).closest('.isotope-system'),
1922								$infinite_isotope = $infinite_system.find('.isotope-container'),
1923								isotopeId = $infinite_system.attr('id');
1924								$(event.currentTarget).html(SiteParameters.loading);
1925								$infinite_isotope.infinitescroll('resume');
1926								$infinite_isotope.infinitescroll('retrieve');
1927								$infinite_isotope.infinitescroll('pause');
1928							});
1929						}
1930					}
1931				}
1932			},
1933			onLayout = function(isotopeObj, startIndex, needsReload) {
1934				var needsReload = needsReload ? true : false;
1935
1936				if (typeof UNCODE.bigText !== 'undefined') {
1937					UNCODE.bigText();
1938				}
1939				isotopeObj.css('opacity', 1);
1940				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
1941
1942				requestTimeout(function() {
1943					if (startIndex > 0) {
1944						reloadIsotope(isotopeObj);
1945						if (SiteParameters.dynamic_srcset_active === '1') {
1946							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
1947							UNCODE.adaptive_srcset(isotopeObj);
1948						}
1949						// window.dispatchEvent(UNCODE.boxEvent);
1950					} else if (needsReload) {
1951						reloadIsotope(isotopeObj);
1952					}
1953
1954					UNCODE.adaptive();
1955					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
1956						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
1957					}
1958					if (typeof MediaElement === "function") {
1959						$(isotopeObj).find('audio,video').each(function() {
1960							$(this).mediaelementplayer({
1961	 							pauseOtherPlayers: false,
1962							});
1963						});
1964					}
1965					if ($(isotopeObj).find('.nested-carousel').length) {
1966						if (typeof UNCODE.carousel !== 'undefined') {
1967							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
1968						}
1969						requestTimeout(function() {
1970							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
1971						}, 200);
1972					} else {
1973						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
1974					}
1975					isotopeObj.trigger('isotope-layout-complete');
1976
1977				}, 100);
1978
1979			},
1980			boxAnimation = function(items, startIndex, sequential, container) {
1981				var $allItems = items.length - startIndex,
1982					showed = 0,
1983					index = 0;
1984				if (container.closest('.owl-item').length == 1) return false;
1985				$.each(items, function(index, val) {
1986					var $this = $(val),
1987						elInner = $('> .t-inside', val);
1988					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
1989						return;
1990					}
1991					if (val[0]) val = val[0];
1992					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
1993						new Waypoint({
1994							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
1995							element: val,
1996							handler: function() {
1997								var element = $('> .t-inside', this.element),
1998									parent = $(this.element),
1999									currentIndex = parent.index();
2000								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
2001									delayAttr = parseInt(element.attr('data-delay'));
2002								if (isNaN(delayAttr)) delayAttr = 100;
2003								delay -= showed;
2004								var objTimeout = requestTimeout(function() {
2005									element.removeClass('zoom-reverse').addClass('start_animation');
2006									showed = parent.index();
2007									if ( container.data('isotope') ) {
2008										container.isotope('layout');
2009									}
2010								}, delay * delayAttr)
2011								parent.data('objTimeout', objTimeout);
2012								if (!UNCODE.isUnmodalOpen) {
2013									this.destroy();
2014								}
2015							},
2016							offset: '100%'
2017						})
2018					} else {
2019						if (elInner.hasClass('force-anim')) {
2020							elInner.addClass('start_animation');
2021						} else {
2022							elInner.css('opacity', 1);
2023						}
2024						container.isotope('layout');
2025					}
2026
2027					index++;
2028				});
2029			},
2030			reloadIsotope = function(isotopeObj) {
2031				var isoIndex = $(isotopeObj).attr('data-iso-index');
2032				var $layoutMode = ($(isotopeObj).data('layout'));
2033				if ($layoutMode === undefined) {
2034					$layoutMode = 'masonry';
2035				}
2036				if (isotopeObj.data('isotope')) {
2037					isotopeObj.isotope({
2038						itemSelector: $itemSelector,
2039						layoutMode: $layoutMode,
2040						transitionDuration: transitionDuration[isoIndex],
2041						masonry: {
2042							columnWidth: colWidth(isoIndex)
2043						},
2044						vertical: {
2045							horizontalAlignment: 0.5,
2046						},
2047						sortBy: 'original-order',
2048						isOriginLeft: isOriginLeft
2049					});
2050				}
2051			}
2052			;
2053		if ($('.isotope-pagination').length > 0) {
2054			$('.isotope-system').on('click', '.pagination a', function(evt) {
2055				evt.preventDefault();
2056
2057                var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
2058					container = $(this).closest('.isotope-system'),
2059                    calc_scroll = container.closest('.row-parent').offset().top;
2060                calc_scroll -= UNCODE.get_scroll_offset();
2061
2062                var menu_container = $('.menu-sticky');
2063				var menu = menu_container.find('.menu-container');
2064
2065				if (menu_container.length > 0 && menu.length > 0) {
2066					calc_scroll = calc_scroll - menu.outerHeight();
2067				}
2068
2069				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
2070					delta = bodyTop - calc_scroll,
2071					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
2072				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
2073
2074				if ( !UNCODE.isFullPage ) {
2075					if (scrollSpeed == 0) {
2076						$('html, body').scrollTop(calc_scroll);
2077					} else {
2078						$('html, body').animate({
2079							scrollTop: calc_scroll
2080						},{
2081							easing: 'easeInOutQuad',
2082							duration: scrollSpeed,
2083							complete: function(){
2084								UNCODE.scrolling = false;
2085							}
2086						});
2087					}
2088				}
2089
2090				loadIsotope($(this), true);
2091				evt.preventDefault();
2092			});
2093		}
2094		$filters.on('click', 'a.isotope-nav-link', function(evt) {
2095			if ($(this).hasClass('no-isotope-filter')) {
2096				return;
2097			}
2098			var $filter = $(this),
2099				filterContainer = $filter.closest('.isotope-filters'),
2100				filterValue = $filter.attr('data-filter'),
2101				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
2102				transitionDuration = container.data().isotope.options.transitionDuration,
2103				delay = 300,
2104				filterItems = [];
2105
2106			var filter_items = function(){
2107				if (filterValue !== undefined) {
2108					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
2109						var parent = $(val).parent(),
2110							objTimeout = parent.data('objTimeout');
2111						if (objTimeout) {
2112							$(val).removeClass('zoom-reverse').removeClass('start_animation')
2113							clearRequestTimeout(objTimeout);
2114						}
2115						if (transitionDuration == 0) {
2116							if ($(val).hasClass('animate_when_almost_visible')) {
2117								$(val).addClass('zoom-reverse').removeClass('start_animation');
2118							} else {
2119								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
2120							}
2121						}
2122					});
2123					requestTimeout(function(){
2124						if ( filterValue == '*' ) {
2125							container.removeClass('isotope-filtered');
2126						} else {
2127							container.addClass('isotope-filtered');
2128						}
2129						container.isotope({
2130							filter: function() {
2131								var block = $(this),
2132								filterable = (filterValue == '*') || block.hasClass(filterValue),
2133								lightboxElements = $('[data-lbox^=ilightbox]', block);
2134								if (filterable) {
2135									if (lightboxElements.length) {
2136										lightboxElements.removeClass('lb-disabled');
2137										container.data('lbox', $(lightboxElements[0]).data('lbox'));
2138									}
2139									filterItems.push(block);
2140								} else {
2141									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
2142								}
2143								container.trigger('more-items-loaded');
2144								return filterable;
2145							}
2146						});
2147						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
2148
2149					}, delay);
2150
2151					/** once filtered - start **/
2152					container.isotope('once', 'arrangeComplete', function() {
2153						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2154							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
2155							if (typeof getLightbox === 'object') {
2156								getLightbox.refresh();
2157							} else {
2158								UNCODE.lightbox();
2159							}
2160						}
2161						if (transitionDuration == 0) {
2162							requestTimeout(function() {
2163								boxAnimation(filterItems, 0, false, container);
2164							}, 100);
2165						}
2166						requestTimeout(function() {
2167							Waypoint.refreshAll();
2168						}, 2000);
2169					});
2170					/** once filtered - end **/
2171				} else {
2172					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2173						$.each(UNCODE.lightboxArray, function(index, val) {
2174							UNCODE.lightboxArray[index].destroy();
2175						});
2176					}
2177					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
2178						var parent = $(val).parent(),
2179							objTimeout = parent.data('objTimeout');
2180						if (objTimeout) {
2181							$(val).removeClass('zoom-reverse').removeClass('start_animation')
2182							clearRequestTimeout(objTimeout);
2183						}
2184						if (transitionDuration == 0) {
2185							if ($(val).hasClass('animate_when_almost_visible')) {
2186								$(val).addClass('zoom-reverse').removeClass('start_animation');
2187							} else {
2188								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
2189							}
2190						}
2191					});
2192					container.parent().addClass('grid-loading');
2193					loadIsotope($filter);
2194				}
2195			};
2196
2197			if (!$filter.hasClass('active')) {
2198				/** Scroll top with filtering */
2199				if (filterContainer.hasClass('filter-scroll')) {
2200                    var calc_scroll = container.closest('.row-parent').offset().top;
2201                    calc_scroll -= UNCODE.get_scroll_offset();
2202
2203					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
2204						delta = bodyTop - calc_scroll,
2205						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
2206						filterTolerance = false,
2207						filter_timeout;
2208					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
2209
2210					if ( !UNCODE.isFullPage ) {
2211						if (scrollSpeed == 0) {
2212							$('html, body').scrollTop(calc_scroll);
2213							UNCODE.scrolling = false;
2214							filter_items();
2215						} else {
2216
2217							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
2218								filter_items();
2219								filterTolerance = true;
2220							}
2221
2222							$('html, body').animate({
2223								scrollTop: calc_scroll
2224							},{
2225								easing: 'easeInOutQuad',
2226								duration: scrollSpeed,
2227								complete: function(){
2228									UNCODE.scrolling = false;
2229									if ( !filterTolerance ) {
2230										filter_timeout = setTimeout(function(){
2231											clearTimeout(filter_timeout);
2232											filter_items();
2233										}, 200);
2234									}
2235								}
2236							});
2237						}
2238					}
2239				} else {
2240					filter_items();
2241				}
2242			}
2243			evt.preventDefault();
2244		});
2245
2246		$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) {
2247			var params = UNCODE.getURLParams(window.location);
2248			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
2249
2250			UNCODE.lastURL = window.location.href;
2251
2252			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
2253				return;
2254			}
2255
2256			if (params.id === undefined) {
2257				$.each($('.isotope-system'), function(index, val) {
2258					loadIsotope($(val));
2259				});
2260			} else {
2261				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
2262					loadIsotope($('#' + params.id));
2263				}
2264			}
2265		});
2266
2267		var loadIsotope = function($href, $paginating) {
2268			var is_paginating = false;
2269
2270			if (undefined !== $paginating && $paginating) {
2271				var is_paginating = $paginating;
2272			}
2273
2274			var href = ($href.is("a") ? $href.attr('href') : location),
2275				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
2276				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
2277				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
2278				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
2279				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
2280				isotopeId = isotopeSystem.attr('id');
2281			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
2282				UNCODE.lastURL = href;
2283				history.pushState({
2284					myIsotope: true
2285				}, document.title, href);
2286			}
2287			if (is_paginating) {
2288				isotopeWrapper.addClass('grid-filtering');
2289			}
2290			$.ajax({
2291				url: href
2292			}).done(function(data) {
2293				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
2294					$resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0],
2295					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
2296				isotopeWrapper.addClass('isotope-reloaded');
2297				requestTimeout(function() {
2298					isotopeWrapper.removeClass('grid-loading');
2299					isotopeWrapper.removeClass('isotope-reloaded');
2300					isotopeWrapper.removeClass('grid-filtering');
2301				}, 500);
2302				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
2303					var parent = $(val).parent(),
2304						objTimeout = parent.data('objTimeout');
2305					if (objTimeout) {
2306						$(val).removeClass('zoom-reverse').removeClass('start_animation')
2307						clearRequestTimeout(objTimeout);
2308					}
2309					if ($(val).hasClass('animate_when_almost_visible')) {
2310						$(val).addClass('zoom-reverse').removeClass('start_animation');
2311					} else {
2312						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
2313					}
2314				});
2315				requestTimeout(function() {
2316					if (isotopeContainer.data('isotope')) {
2317						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
2318						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
2319						UNCODE.adaptive();
2320						if (SiteParameters.dynamic_srcset_active === '1') {
2321							UNCODE.adaptive_srcset(isotopeContainer);
2322						}
2323						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2324							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
2325							if (typeof getLightbox === 'object') {
2326								getLightbox.refresh();
2327							} else {
2328								UNCODE.lightbox();
2329							}
2330						}
2331					}
2332					isotopeContainer.trigger('more-items-loaded');
2333				}, 300);
2334				$('.pagination', isotopeFooter).remove();
2335				isotopeFooter.append($resultPagination);
2336
2337				if (isotopeResultCount.length > 0) {
2338					$('.woocommerce-result-count', isotopeResultCount).remove();
2339					isotopeResultCount.append($resultCount);
2340				}
2341			});
2342		};
2343		$filters.each(function(i, buttonGroup) {
2344			var $buttonGroup = $(buttonGroup);
2345			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
2346				$buttonGroup.find('.active').removeClass('active');
2347				$(this).addClass('active');
2348
2349			});
2350
2351			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
2352				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
2353				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
2354			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
2355				e.preventDefault();
2356				$cats_filters.slideToggle(400, 'easeInOutCirc');
2357			});
2358
2359		});
2360		window.addEventListener('boxResized', function(e) {
2361			if (UNCODE.printDialogOpen !== false) {
2362				return false;
2363			}
2364			$.each($('.isotope-layout'), function(index, val) {
2365				var $layoutMode = ($(this).data('layout'));
2366				if ($layoutMode === undefined) $layoutMode = 'masonry';
2367				if ($(this).data('isotope')) {
2368					$(this).isotope({
2369						itemSelector: $itemSelector,
2370						layoutMode: $layoutMode,
2371						transitionDuration: transitionDuration[index],
2372						masonry: {
2373							columnWidth: colWidth(index)
2374						},
2375						vertical: {
2376							horizontalAlignment: 0.5,
2377						},
2378						sortBy: 'original-order',
2379						isOriginLeft: isOriginLeft
2380					});
2381					$(this).isotope('unbindResize');
2382					if (SiteParameters.dynamic_srcset_active === '1') {
2383						UNCODE.refresh_dynamic_srcset_size($(this));
2384					}
2385				}
2386				$(this).find('.mejs-video,.mejs-audio').each(function() {
2387					$(this).trigger('resize');
2388				});
2389			});
2390		}, false);
2391
2392		init_isotope();
2393	};
2394}
2395
2396UNCODE.lightbox = function() {
2397	if ( SiteParameters.lbox_enhanced ) {
2398		return true;
2399	}
2400	UNCODE.lightboxArray = {};
2401	requestTimeout(function() {
2402		var groupsArr = {};
2403		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() {
2404			var group = this.getAttribute("data-lbox"),
2405				values = $(this).data();
2406			$(this).attr('data-lbox-init','true')
2407			groupsArr[group] = values;
2408		});
2409		for (var i in groupsArr) {
2410			var skin = groupsArr[i].skin || 'black',
2411				path = groupsArr[i].dir || 'horizontal',
2412				thumbs = !groupsArr[i].notmb || false,
2413				arrows = !groupsArr[i].noarr || false,
2414				social = groupsArr[i].social || false,
2415				deeplink = groupsArr[i].deep || false,
2416				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'),
2417				counter = $els.length,
2418				dataAlbum = $els.attr('data-album');
2419			if (social) social = {
2420				facebook: true,
2421				twitter: true,
2422				reddit: true,
2423				digg: true
2424			};
2425			UNCODE.lightboxArray[i] = $els.iLightBox({
2426				selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)',
2427				skin: skin,
2428				path: path,
2429				linkId: deeplink,
2430				infinite: false,
2431				//fullViewPort: 'fit',
2432				smartRecognition: false,
2433				fullAlone: true,
2434				maxScale: 1,
2435				minScale: .02,
2436				//fullStretchTypes: 'flash, video',
2437				overlay: {
2438					opacity: .94
2439				},
2440				controls: {
2441					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
2442					fullscreen: true,
2443					thumbnail: thumbs,
2444					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
2445				},
2446				show: {
2447					speed: 200
2448				},
2449				hide: {
2450					speed: 200
2451				},
2452				social: {
2453					start: false,
2454					buttons: social
2455				},
2456				caption: {
2457					start: false
2458				},
2459				styles: {
2460					nextOpacity: 1,
2461					nextScale: 1,
2462					prevOpacity: 1,
2463					prevScale: 1
2464				},
2465				effects: {
2466					switchSpeed: 400
2467				},
2468				slideshow: {
2469					pauseTime: 5000
2470				},
2471				thumbnails: {
2472					maxWidth: 60,
2473					maxHeight: 60,
2474					activeOpacity: .2
2475				},
2476				html5video: {
2477					preload: true
2478				},
2479				callback: {
2480					onOpen: function(){
2481						$(window).trigger('uncode-custom-cursor');
2482						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
2483							iNoBounce.enable();
2484						}
2485					},
2486					onHide: function(){
2487						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
2488							iNoBounce.disable()
2489						}
2490					},
2491				}
2492			});
2493
2494			$(document).on('infinite-loaded', function(){
2495				UNCODE.lightboxArray[i].refresh();
2496			});
2497
2498			$(window).on('gdprOpen', function(){
2499				UNCODE.lightboxArray[i].close();
2500			});
2501		};
2502	}, 100);
2503
2504	$(document).on('click', '.lb-disabled', function(e){
2505		e.preventDefault();
2506	});
2507};
2508
2509UNCODE.lightgallery = function( $el ) {
2510	var createSelectors = function(){
2511		$('a[data-lbox]:not([data-lbox-init]):not([data-album])').each(function(){
2512			if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
2513				$(this).addClass('lbox-trigger-item');
2514			} else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
2515				$(this).addClass('lbox-nested-item');
2516			} else {
2517				$(this).removeClass('lbox-trigger-item');
2518				$(this).removeClass('lbox-nested-item');
2519			}
2520		});
2521	};
2522
2523	createSelectors();
2524
2525	var galleries = [],
2526		nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
2527			return !$(this).closest('.nested-carousel').length;
2528		}),
2529		$_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 *'),
2530		$galleries = $_galleries.filter(function( index ) {
2531			return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
2532		}),
2533		$nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item');
2534
2535	if ( typeof $el === 'undefined' ) {
2536		$el = $galleries.add( $nested );
2537	}
2538
2539	var $disabled = $('a.lb-disabled');
2540	$disabled.on('click', function(e){
2541		e.preventDefault();
2542	});
2543
2544	var beforeSlide = function(event) {
2545		var detail = event.detail,
2546			info = detail.info,
2547			item = detail.item,
2548			$slide = $(detail.currentSlide.selector),
2549			$video = $('video', $slide),
2550			$previous = $(detail.previousSlide.selector),
2551			$prevVideo = $('video', $previous),
2552			isAudio = false;
2553
2554		if ( typeof info.src !== 'undefined' ) {
2555			isAudio = info.src.search(/.mp3|.m4a/i) > -1;
2556		}
2557
2558		if ( ! $video.length && ( info.video || isAudio ) ) {
2559			if ( info.video ) {
2560				if ( typeof info.video === 'object' ) {
2561					var infoJson = info.video;
2562				} else {
2563					var infoJson = JSON.parse(info.video);
2564				}
2565				var src = infoJson.source[0].src,
2566					autoplay = $(item).attr('data-autoplay'),
2567					loop = $(item).attr('data-loop');
2568
2569			} else if ( isAudio ) {
2570				var src = info.src,
2571					autoplay = true,
2572					loop = false;
2573			}
2574			if ( typeof src !== 'undefined' ) {
2575				$slide.addClass('has-html5');
2576				var video = document.createElement('video');
2577				video.src = src;
2578				video.preload = 'auto';
2579				video.controls = 'controls';
2580				video.controlsList = 'nodownload';
2581				if ( autoplay ) {
2582					video.autoplay = 'autoplay';
2583				}
2584				if ( loop ) {
2585					video.loop = 'loop';
2586				}
2587				$(video).appendTo($slide);
2588			}
2589		} else {
2590			var $video = $('video', $slide);
2591			if ( $video.length ) {
2592				$video[0].currentTime = 0;
2593				if ( $video[0].autoplay ) {
2594					$video[0].play();
2595				}
2596			}
2597		}
2598		if ( $prevVideo.length ) {
2599			$prevVideo[0].currentTime = 0;
2600			$prevVideo[0].pause();
2601		}
2602	};
2603
2604	var beforeOpen = function(event) {
2605		var detail = event.detail,
2606			items = detail.items,
2607			galleryItems = detail.galleryItems,
2608			outer = detail.outer.selector,
2609			i, ii;
2610		for ( i = 0; i < galleryItems.length; i++ ) {
2611			var item = galleryItems[i];
2612			if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) {
2613				$(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video');
2614			}
2615		}
2616		for ( ii = 0; ii < items.length; ii++ ) {
2617			var item = items[ii];
2618			if ( $(item).attr('data-icon') === 'video' ) {
2619				$(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video');
2620			}
2621		}
2622
2623	};
2624
2625	//caption builder
2626	$el.each( function( index, val ) {
2627		var $gallery = $(this).attr('data-lbox-init','true'),
2628			$_a = '.lbox-trigger-item',
2629			$_nested_a = '.lbox-nested-item';
2630
2631		$gallery.find($_a, $_nested_a).each(function(){
2632			var $a = $(this),
2633				$img = $('img', $a).first(),
2634				imgw = $img.attr('data-width'),
2635				imgh = $img.attr('data-height'),
2636				caption = $a.attr('data-caption'),
2637				title = $a.attr('data-title');
2638
2639			if ( $img.length && $img.attr('data-crop') != true ) {
2640				if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) {
2641					$a.attr('data-external-thumb-image', $img.attr('data-guid'));
2642				} else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) {
2643					$a.attr('data-external-thumb-image', $img[0].src);
2644				}
2645			}
2646
2647			if ( typeof title !== 'undefined' && title !== '' ) {
2648				title = '<h6>' + title + '</h6>';
2649			} else {
2650				title = '';
2651			}
2652
2653			if ( typeof caption !== 'undefined' && caption !== '' ) {
2654				caption = '<p>' + caption + '</p>';
2655				title += caption;
2656			}
2657
2658			if ( title !== '' ) {
2659				$a.attr( 'title', title );
2660			}
2661
2662			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') ) ) {
2663				$a.attr('data-lg-size', imgw + '-' + imgh);
2664			}
2665		});
2666	});
2667
2668	//regular galleries
2669	$el.each( function( index, val ) {
2670		var $gallery = $(this),
2671			$_a = '.lbox-trigger-item',
2672			$_nested_a = '.lbox-nested-item',
2673			$_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(),
2674			galleryID = $_first.attr('data-lbox'),
2675			$_connected_a = $_a + '[data-lbox="' + galleryID + '"]',
2676			tmb = $_first.attr('data-notmb'),
2677			social = $_first.attr('data-social'),
2678			deep = $_first.attr('data-deep'),
2679			zoom = $_first.attr('data-zoom-origin'),
2680			actual = $_first.attr('data-actual-size'),
2681			download = $_first.attr('data-download'),
2682			controls = $_first.attr('data-arrows') !== 'no',
2683			fullScreen = $_first.attr('data-full'),
2684			counter = $_first.attr('data-counter'),
2685			transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide',
2686			containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
2687			connect = $_first.attr('data-connect'),
2688			$currentVideo = false,
2689			lgPlugins = [lgVideo],
2690			itemsLoadedTimeOut;
2691
2692		containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
2693		containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
2694
2695		if ( typeof tmb == 'undefined' || !tmb ) {
2696			lgPlugins.push(lgThumbnail);
2697		}
2698		if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) {
2699			lgPlugins.push(lgZoom);
2700		}
2701		if ( typeof deep != 'undefined' && deep != '' ) {
2702			lgPlugins.push(lgHash);
2703		}
2704		if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
2705			lgPlugins.push(lgFullscreen);
2706		}
2707		if ( social ) {
2708			lgPlugins.push(lgShare);
2709		}
2710
2711		if ( galleries.indexOf( galleryID ) !== -1 ) {
2712			return true;
2713		}
2714
2715		galleries.push( galleryID );
2716		var $triggerGal = connect ? $('.page-wrapper') : $gallery,
2717			$selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a;
2718		var gallery = lightGallery( $triggerGal[0], {
2719			addClass: containerClass,
2720			plugins: lgPlugins,
2721			mode: transition,
2722			selector: $selector,
2723			galleryId: galleryID,
2724			thumbnail: ( typeof tmb == 'undefined' || !tmb ),
2725			iframeWidth: '848px',
2726			iframeMaxWidth: '90%',
2727			iframeMaxHeight: '90%',
2728			exThumbImage: 'data-external-thumb-image',
2729			loadYouTubeThumbnail: false,
2730			// autoplayFirstVideo: false,
2731			pager: false,
2732			startClass: 'lg-start-opacity',
2733			zoomFromOrigin: zoom,
2734			controls: controls,
2735			download: ( typeof download != 'undefined' && download != '' ),
2736			thumbWidth: 50,
2737			thumbHeight: '50px',
2738			counter: $triggerGal.find($selector).length > 1 ? counter : false,
2739			loadYouTubePoster: false,
2740			enableDrag: $triggerGal.find($selector).length > 1
2741		});
2742
2743		$('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){
2744			e.preventDefault();
2745			var index = $(this).closest('.owl-item.cloned').attr('data-index');
2746			gallery.openGallery(index-1);
2747		});
2748
2749		$triggerGal.on('more-items-loaded', function(e, items) {
2750			clearRequestTimeout(itemsLoadedTimeOut);
2751			itemsLoadedTimeOut = requestTimeout(function(){
2752				createSelectors();
2753				gallery.refresh();
2754			}, 100);
2755		});
2756
2757		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2758			window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
2759				$el = model.view.$el;
2760				if ( $el.find($triggerGal).length ) {
2761					gallery.destroy();
2762				}
2763			});
2764		}
2765
2766		$triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide);
2767		$triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen);
2768		$triggerGal[0].addEventListener('lgAfterOpen', function(){
2769			$(window).trigger('uncode-custom-cursor');
2770		});
2771
2772	});
2773
2774	if ( typeof $el !== 'undefined' ) {
2775
2776		//album galleries
2777		$('a[data-album]:not([data-lbox-init])').each(function(index, val) {
2778			var album = val,
2779				galleryID = index,
2780				$album = $(album),
2781				params = $album.attr('data-album'),
2782				tmb = $(val).attr('data-notmb'),
2783				social = $(val).attr('data-social'),
2784				deep = $(val).attr('data-deep'),
2785				zoom = $(val).attr('data-zoom-origin'),
2786				actual = $(val).attr('data-actual-size'),
2787				download = $(val).attr('data-download'),
2788				controls = $(val).attr('data-arrows') !== 'no',
2789				fullScreen = $(val).attr('data-full'),
2790				counter = $(val).attr('data-counter'),
2791				transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide',
2792				containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
2793				$currentVideo = false,
2794				lgPlugins = [lgVideo];
2795
2796			$(val).attr('data-lbox-init','true');
2797
2798			containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
2799			containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
2800
2801			if ( typeof tmb == 'undefined' || !tmb ) {
2802				lgPlugins.push(lgThumbnail);
2803			}
2804			if ( typeof actual != 'undefined' && actual != '' ) {
2805				lgPlugins.push(lgZoom);
2806			}
2807			if ( typeof deep != 'undefined' && deep != '' ) {
2808				lgPlugins.push(lgHash);
2809			}
2810			if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
2811				lgPlugins.push(lgFullscreen);
2812			}
2813			if ( social ) {
2814				lgPlugins.push(lgShare);
2815			}
2816
2817			var gallery = window.lightGallery(album, {
2818				dynamic: true,
2819				plugins: lgPlugins,
2820				dynamicEl: JSON.parse(params),
2821				galleryId: galleryID,
2822				addClass: containerClass,
2823				mode: transition,
2824				thumbnail: ( typeof tmb == 'undefined' || !tmb ),
2825				iframeWidth: '848px',
2826				iframeMaxWidth: '90%',
2827				iframeMaxHeight: '90%',
2828				loadYouTubeThumbnail: false,
2829				// autoplayFirstVideo: false,
2830				pager: false,
2831				startClass: 'lg-start-opacity',
2832				zoomFromOrigin: false,
2833				controls: controls,
2834				download: ( typeof download != 'undefined' && download != '' ),
2835				thumbWidth: 50,
2836				thumbHeight: '50px',
2837				loadYouTubePoster: false,
2838				counter: counter
2839			});
2840
2841			$album.on('click', function(){
2842				gallery.openGallery(0);
2843			});
2844
2845			album.addEventListener('lgBeforeSlide', beforeSlide);
2846			album.addEventListener('lgBeforeOpen', beforeOpen);
2847			album.addEventListener('lgAfterOpen', function(){
2848				$(window).trigger('uncode-custom-cursor');
2849			});
2850
2851			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2852				window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
2853					$el = model.view.$el;
2854					if ( $el.find($album).length ) {
2855						gallery.destroy();
2856					}
2857				});
2858			}
2859
2860		});
2861
2862		//single images
2863		$('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) {
2864			var gallery = lightGallery( $('.page-wrapper')[0], {
2865				selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])',
2866				iframeWidth: '848px',
2867				iframeMaxWidth: '90%',
2868				iframeMaxHeight: '90%',
2869				loadYouTubeThumbnail: false,
2870				// autoplayFirstVideo: false,
2871				startClass: 'lg-start-opacity',
2872				thumbWidth: 50,
2873				thumbHeight: '50px',
2874				download: false,
2875				loadYouTubePoster: false,
2876				counter: false
2877			});
2878
2879			$('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide);
2880			$('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen);
2881		});
2882	}
2883};
2884
2885UNCODE.carousel = function(container) {
2886	var $owlContainers = $('.owl-carousel-container', container);
2887	$owlContainers.each(function() {
2888		var $owlContainer = $(this),
2889			$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
2890			$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
2891			values = {},
2892			tempTimeStamp,
2893			currentIndex,
2894			$owlInsideEqual = [];
2895		$owlSelector.each(function() {
2896			var itemID = $(this).attr('id'),
2897				$elSelector = $(('#' + itemID).toString());
2898			values['id'] = itemID;
2899			values['items'] = 1;
2900			values['columns'] = 3;
2901			values['fade'] = false;
2902			values['nav'] = false;
2903			values['navmobile'] = false;
2904			values['navskin'] = 'light';
2905			values['navspeed'] = 400;
2906			values['dots'] = false;
2907			values['dotsmobile'] = false;
2908			values['loop'] = false;
2909			values['autoplay'] = false;
2910			values['timeout'] = 3000;
2911			values['autoheight'] = false;
2912			values['stagepadding'] = 0;
2913			values['margin'] = 0;
2914			values['lg'] = 1;
2915			values['md'] = 1;
2916			values['sm'] = 1;
2917			$.each($(this).data(), function(i, v) {
2918				values[i] = v;
2919			});
2920
2921			if ($(this).closest('.uncode-slider').length) {
2922				values['navskin'] = '';
2923				values['navmobile'] = false;
2924				//values['dotsmobile'] = true;
2925			} else {
2926				values['navskin'] = ' style-'+values['navskin']+' style-override';
2927			}
2928
2929			var setIndexActive = function(event, init){
2930				var init = typeof init === 'undefined' ? false : init,
2931					thiis = $(event.currentTarget);
2932				if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
2933					var scrolltop = $(document).scrollTop(),
2934						size = event.page.size,
2935						i;
2936					var setIndex = requestTimeout(function() {
2937						for ( i = 0; i < size; i++ ) {
2938							var itemCont = event.item.index != null ? (event.item.index + i) : i;
2939							var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
2940							if (thiis.closest('.row-slider').length) {
2941								if (currentItem == undefined) {
2942									currentItem = thiis.children()[i];
2943								}
2944								if ($(currentItem).closest('#page-header').length) {
2945									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
2946										UNCODE.switchColorsMenu(scrolltop, 'dark');
2947									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
2948										UNCODE.switchColorsMenu(scrolltop, 'light');
2949									}
2950								}
2951							}
2952							var itendIndex = $(currentItem).attr('data-index');
2953							if ( isNaN(itendIndex) ) {
2954								itendIndex = 1;
2955							}
2956							$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
2957							$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
2958							if ($.fn.counterUp) {
2959								$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){
2960									var $counter = $(this);
2961									$counter.addClass('started').counterUp({
2962										delay: 10,
2963										time: 1500
2964									});
2965								});
2966							}
2967						}
2968						$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
2969					}, 200);
2970				}
2971				tempTimeStamp = event.timeStamp;
2972			}
2973
2974			/** Initialized */
2975			$elSelector.on('initialized.owl.carousel', function(event) {
2976
2977				if ( $('.isotope-container', event.currentTarget).length ) {
2978					window.dispatchEvent(UNCODE.boxEvent);
2979				}
2980
2981				$('.owl-dot.active', $elSelector).on('click', function(){
2982					return false;
2983				});
2984
2985				var thiis = $(event.currentTarget),
2986					// get the time from the data method
2987					time = thiis.data("timer-id"),
2988					rowParent = thiis.closest('.row-parent');
2989
2990				if ( typeof rowParent[0] !== 'undefined' ) {
2991					rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
2992				}
2993
2994				if (time) {
2995					clearRequestTimeout(time);
2996				}
2997
2998				thiis.addClass('showControls');
2999				var new_time = requestTimeout(function() {
3000					thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
3001					if (thiis.hasClass('owl-height-viewport'))
3002						setItemsRelHeight(thiis);
3003					if (thiis.hasClass('owl-height-equal'))
3004						setItemsHeight(thiis);
3005					if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
3006					if (thiis.closest('.unequal, .unexpand').length) {
3007						UNCODE.setRowHeight(rowParent[0], true);
3008					}
3009					if (SiteParameters.dynamic_srcset_active === '1') {
3010						UNCODE.refresh_dynamic_srcset_size(thiis);
3011					}
3012				}, 350);
3013				// save the new time
3014				thiis.data("timer-id", new_time);
3015
3016				var scrolltop = $(document).scrollTop();
3017				thiis.closest('.uncode-slider').find('video').removeAttr('poster');
3018
3019				//if (!UNCODE.isMobile) {
3020					/** fix autoplay when visible **/
3021				$(window).on('load', function(){
3022					if (thiis.data('autoplay')) {
3023						if ( !thiis.closest('.sticky-element').length ) {
3024							thiis.trigger('stop.autoplay.owl');
3025						} else {
3026							thiis.trigger('play.owl.autoplay');
3027						}
3028					}
3029					if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) {
3030						return;
3031					}
3032					if ( ! thiis.closest('.sticky-element').length ) {
3033						var carouselInView = new Waypoint.Inview({
3034							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3035							element: thiis[0],
3036							exited: function() {
3037								var el = $(this.element);
3038								if (el.data('autoplay') ) {
3039									el.trigger('stop.owl.autoplay');
3040									el.data('stopped','true');
3041								}
3042							},
3043							enter: function(direction) {
3044								var el = $(this.element);
3045								requestTimeout(function() {
3046									if (el.data('autoplay')) {
3047										el.trigger('play.owl.autoplay');
3048										el.data('stopped','false');
3049									}
3050								}, 100);
3051							}
3052						});
3053					}
3054				});
3055				//}
3056
3057				// $(window).on('frontend:carousel_updated', function(){
3058				// 	Waypoint.refreshAll();
3059				// });
3060
3061				if (!thiis.closest('.isotope-system').length) {
3062					requestTimeout(function() {
3063						animate_thumb($('.t-inside', el), event);
3064					}, 400);
3065				} else {
3066					requestTimeout(function() {
3067						thiis.closest('.isotope-container').isotope('layout');
3068					}, 400);
3069				}
3070
3071				var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
3072				currentIndex = $(currentItem).attr('data-index');
3073
3074				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
3075					if ($(val).closest('.uncode-slider').length) {
3076						$(val).removeClass('start_animation');
3077					}
3078				});
3079				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
3080					if ($(val).closest('.uncode-slider').length) {
3081						$(val).removeClass('already-animated');
3082					}
3083				});
3084
3085				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
3086					if ($(val).closest('.uncode-slider').length) {
3087						$(val).removeAttr('data-animated');
3088					}
3089				});
3090
3091				$.each($('.owl-item.cloned', thiis), function(index, val) {
3092					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
3093				});
3094
3095				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
3096					if ($(val).attr('data-index') != currentIndex) {
3097						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
3098						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
3099					}
3100					if ($(val).attr('data-index') != currentIndex) {
3101						$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
3102					}
3103					if ($(val).attr('data-index') == currentIndex) {
3104						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
3105					}
3106				});
3107
3108				if (thiis.closest('.uncode-slider').length) {
3109					var el = thiis.closest('.row-parent')[0];
3110					if ($(el).data('imgready')) {
3111						firstLoaded(el, event);
3112					} else {
3113						el.addEventListener("imgLoaded", function(el) {
3114							firstLoaded(el.target, event);
3115						}, false);
3116					}
3117					var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
3118					if (transHeight != null) {
3119						requestTimeout(function() {
3120							thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
3121						}, 100);
3122					}
3123				} else {
3124					var el = thiis;
3125					el.closest('.uncode-slider').addClass('slider-loaded');
3126				}
3127
3128				requestTimeout(function() {
3129					if (typeof UNCODE.bigText !== 'undefined') {
3130						UNCODE.bigText(thiis);
3131					}
3132					if (thiis.closest('.uncode-slider').length) {
3133						if (thiis.data('autoplay')) pauseOnHover(thiis);
3134					}
3135				}, 500);
3136
3137				if (thiis.closest('.unequal').length) {
3138					$owlInsideEqual.push(thiis.closest('.row-parent'));
3139				}
3140
3141				var containerClasses = '',
3142					containerStyle = '';
3143				if ( $('.owl-dots-classes', $owlContainer).length ) {
3144					containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
3145					containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
3146					$('.owl-dots-classes', $owlContainer).remove();
3147				}
3148
3149				if ( containerClasses !== '' ) {
3150					requestTimeout(function() {
3151						if ( containerClasses !== '' )
3152							$('.owl-dots', $owlContainer).attr('style', containerStyle);
3153						if ( containerStyle !== '' )
3154							$('.owl-dots', $owlContainer).addClass(containerClasses);
3155					}, 100);
3156				}
3157
3158				$.each($('.column_child.pos-bottom', thiis), function(index, val) {
3159					$(val).closest('.row-inner').css({
3160						'margin-top': '-1px'
3161					});
3162				});
3163
3164				if ($.fn.isotope) {
3165					if ( thiis.closest('.isotope-container').length ) {
3166						if (thiis.closest('.isotope-container').data('isotope')) {
3167							requestTimeout(function(){
3168								thiis.closest('.isotope-container').isotope('layout');
3169							}, 300);
3170						}
3171						$(window).on('load', function(){
3172							if (thiis.closest('.isotope-container').data('isotope')) {
3173								thiis.closest('.isotope-container').isotope('layout');
3174							}
3175						});
3176					}
3177				}
3178
3179				if (thiis.data('autoplay')) {
3180					$(window).on('menuOpen', function(){
3181						thiis.trigger('stop.owl.autoplay');
3182						thiis.data('stopped','true');
3183					}).on('menuClose', function(){
3184
3185					});
3186				}
3187				$(window).on('menuClose', function(){
3188					if (thiis.data('autoplay')) {
3189						thiis.trigger('play.owl.autoplay');
3190						thiis.data('stopped','false');
3191					}
3192				});
3193
3194				setIndexActive(event, true);
3195
3196				var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
3197						return !$(this).closest('.nested-carousel').length;
3198					}),
3199					$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);
3200
3201
3202				if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
3203					UNCODE.lightgallery( $galleries );
3204				}
3205
3206
3207			});
3208
3209			$elSelector.on('resized.owl.carousel', function(event) {
3210				var thiis = $(event.currentTarget);
3211				// if ($(this).closest('.nested-carousel').length) {
3212				// 	requestTimeout(function() {
3213				// 		window.dispatchEvent(UNCODE.boxEvent);
3214				// 	}, 200);
3215				// }
3216				if ( thiis.hasClass('owl-height-equal') )
3217					setItemsHeight(thiis);
3218
3219				setItemsRelHeight($elSelector);
3220
3221				setIndexActive(event);
3222
3223				if (SiteParameters.dynamic_srcset_active === '1') {
3224					UNCODE.refresh_dynamic_srcset_size(thiis);
3225				}
3226
3227				if ($.fn.isotope) {
3228					$(window).on('load', function(){
3229						if ($(event.currentTarget).closest('.isotope-container').data('isotope')) {
3230							$(event.currentTarget).closest('.isotope-container').isotope('layout');
3231						}
3232					});
3233				}
3234			});
3235
3236			/** detect resize window for fluid height layout */
3237			var setFluidResize;
3238			function manageFluidCarouseHeight() {
3239				clearRequestTimeout(setFluidResize);
3240				setFluidResize = requestTimeout(function(){
3241					setItemsRelHeight($elSelector);
3242				}, 100);
3243			}
3244			window.addEventListener('resize', manageFluidCarouseHeight);
3245
3246			/** Change */
3247			$elSelector.on('change.owl.carousel', function(event) {
3248				if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
3249			});
3250
3251			/** Changed */
3252			$elSelector.on('changed.owl.carousel', function(event) {
3253				var $row = $elSelector.parents('.row')[0];
3254				if ( typeof $row !== 'undefined' ) {
3255					$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
3256				}
3257				setIndexActive(event);
3258			});
3259
3260			var checkDrag = function(e) {
3261				$elSelector.addClass('owl-dragging');
3262			};
3263			$elSelector.on('drag.owl.carousel', function(event) {
3264				document.addEventListener("mousemove", checkDrag);
3265			});
3266
3267			$elSelector.on('dragged.owl.carousel', function(event) {
3268				$elSelector.removeClass('owl-dragging');
3269				document.removeEventListener("mousemove", checkDrag);
3270			});
3271
3272			$elSelector.on('translate.owl.carousel', function(event) {
3273				if (UNCODE.isMobile) {
3274					$(event.currentTarget).addClass('owl-translating');
3275				}
3276			});
3277
3278			/** Translated */
3279			$elSelector.on('translated.owl.carousel', function(event) {
3280
3281				var thiis = $(event.currentTarget),
3282					currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
3283					currentIndex = $(currentItem).attr('data-index'),
3284					stagePadding = thiis.data('stagepadding');
3285
3286				stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
3287
3288				if (!UNCODE.isMobile) {
3289					UNCODE.owlPlayVideo(thiis);
3290				}
3291
3292				requestTimeout(function(){
3293					var lastDelayElems = animate_elems($('.owl-item.index-active', thiis));
3294					var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event);
3295					if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) {
3296						if (lastDelayElems == undefined) lastDelayElems = 0;
3297						if (lastDelayThumb == undefined) lastDelayThumb = 0;
3298						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
3299						thiis.trigger('stop.owl.autoplay');
3300						requestTimeout(function() {
3301							if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay');
3302						}, maxDelay);
3303					}
3304				}, 200);
3305
3306				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
3307					if ($(val).closest('.uncode-slider').length) {
3308						$(val).removeClass('start_animation');
3309					}
3310				});
3311
3312				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
3313					if ($(val).closest('.uncode-slider').length) {
3314						$(val).removeClass('already-animated');
3315					}
3316				});
3317
3318				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
3319					if ($(val).closest('.uncode-slider').length) {
3320						$(val).removeAttr('data-animated');
3321					}
3322				});
3323
3324				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
3325					if ($(val).attr('data-index') != currentIndex) {
3326						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
3327						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
3328					}
3329					if ($(val).attr('data-index') != currentIndex) {
3330						$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
3331					}
3332					if ($(val).attr('data-index') == currentIndex) {
3333						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
3334					}
3335				});
3336
3337				if (UNCODE.isMobile) {
3338					thiis.removeClass('owl-translating');
3339				}
3340
3341				setIndexActive(event);
3342			});
3343
3344			if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
3345
3346			/** Init carousel */
3347			$elSelector.not('.showControls').owlCarousel({
3348				items: values['items'],
3349				animateIn: (values['fade'] == true) ? 'fadeIn' : null,
3350				animateOut: (values['fade'] == true) ? 'fadeOut' : null,
3351				nav: values['nav'],
3352				dots: values['dots'],
3353				loop: values['loop'],
3354				stagePadding: values['stagepadding'],
3355				margin: 0,
3356				video: true,
3357				autoWidth: false,
3358				autoplay: false,
3359				autoplayTimeout: values['timeout'],
3360				autoplaySpeed: values['navspeed'],
3361				autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true,
3362				autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ),
3363				rtl: $('body').hasClass('rtl') ? true : false,
3364				fluidSpeed: true,
3365				navSpeed: values['navspeed'],
3366				dotsSpeed: values['navspeed'] / values['items'],
3367				navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
3368				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>'],
3369				navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
3370				responsiveClass: true,
3371				responsiveBaseElement: '.box-container',
3372				responsive: {
3373					0: {
3374						items: values['sm'],
3375						nav: values['navmobile'],
3376						dots: values['dotsmobile'],
3377						dotsSpeed: values['navspeed'] / values['sm'],
3378					},
3379					480: {
3380						items: values['sm'],
3381						nav: values['navmobile'],
3382						dots: values['dotsmobile'],
3383						dotsSpeed: values['navspeed'] / values['sm'],
3384					},
3385					570: {
3386						items: values['md'],
3387						nav: values['navmobile'],
3388						dots: values['dotsmobile'],
3389						dotsSpeed: values['navspeed'] / values['md'],
3390					},
3391					960: {
3392						items: values['lg'],
3393						dotsSpeed: values['navspeed'] / values['lg'],
3394					}
3395				}
3396			});
3397
3398			var transDuration = parseFloat(values['navspeed']) * 0.3;
3399			var transDuration2 = parseFloat(values['navspeed']) * 0.8;
3400
3401			$('.owl-item .tmb', $elSelector).css({
3402				'-webkit-transition-delay': transDuration + 'ms',
3403				'-moz-transition-delay': transDuration + 'ms',
3404				'-o-transition-delay': transDuration + 'ms',
3405				'transition-delay': transDuration + 'ms',
3406				'-webkit-transition-duration': transDuration2 + 'ms',
3407				'-moz-transition-duration': transDuration2 + 'ms',
3408				'-o-transition-duration': transDuration2 + 'ms',
3409				'transition-duration': transDuration2 + 'ms',
3410			});
3411
3412			requestTimeout(function() {
3413				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
3414					UNCODE.setRowHeight($owlInsideEqual[i]);
3415				};
3416			}, 300);
3417
3418			$(window).on('load', function(){
3419				var $elCarousel = $elSelector.data('owl.carousel');
3420				if ( typeof $elCarousel !== 'undefined' ) {
3421					$elCarousel.trigger('refreshed');
3422					for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
3423						UNCODE.setRowHeight($owlInsideEqual[i]);
3424					};
3425				}
3426			});
3427
3428			$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
3429				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
3430					$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
3431					$('#' + carousel_id).find('.owl-item').each( function() {
3432						var $item = $(this),
3433							index = ( $item.index() + 1 );
3434						$item.attr('data-index', index);
3435					});
3436				}
3437			});
3438
3439			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3440				window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
3441					if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
3442						$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
3443						$('#' + carousel_id).find('.owl-item').each( function() {
3444							var $item = $(this),
3445								index = ( $item.index() + 1 );
3446							$item.attr('data-index', index);
3447						});
3448					}
3449				});
3450			}
3451
3452		});
3453
3454		function firstLoaded(el, event) {
3455			var el = $(el),
3456			uncode_slider = el.find('.uncode-slider');
3457			el.find('.owl-carousel').css('opacity', 1);
3458			uncode_slider.addClass('slider-loaded');
3459			if (typeof UNCODE.bigText !== 'undefined') {
3460				UNCODE.bigText(el.find('.owl-item.active'));
3461			}
3462			//if (!UNCODE.isMobile) {
3463				requestTimeout(function() {
3464					var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
3465					var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
3466					if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
3467						if (lastDelayElems == undefined) lastDelayElems = 0;
3468						if (lastDelayThumb == undefined) lastDelayThumb = 0;
3469						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
3470						$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
3471						requestTimeout(function() {
3472							$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
3473						}, maxDelay);
3474					}
3475				}, 500);
3476
3477			//}
3478		}
3479
3480		function navHover(el) {
3481			var $owlCont = el,
3482				$owlPrev = $owlCont.find('.owl-prev'),
3483				$owlNext = $owlCont.find('.owl-next'),
3484				$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
3485				$owlPagination = $owlCont.next(),
3486				owlPrevW = $owlPrev.outerWidth(),
3487				owlNextW = $owlNext.outerWidth(),
3488				owlDotsH = $owlDots.innerHeight(),
3489				owlTime = 400,
3490				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
3491			if ( $('body').hasClass('rtl') ) {
3492				$owlPrev.css("margin-right", -owlPrevW);
3493				$owlNext.css("margin-left", -owlNextW);
3494			} else {
3495				$owlPrev.css("margin-left", -owlPrevW);
3496				$owlNext.css("margin-right", -owlNextW);
3497			}
3498			if (!owlNested) $owlDots.css("bottom", -owlDotsH);
3499			$owlCont.mouseenter(function() {
3500				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
3501				$owlPrev.add($owlNext).css({
3502					marginLeft: 0,
3503					marginRight: 0
3504				});
3505				if (!owlNested) {
3506					$owlDots.css({
3507						opacity: 1,
3508						bottom: 0
3509					});
3510				}
3511			}).mouseleave(function() {
3512				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
3513				if ( $('body').hasClass('rtl') ) {
3514					$owlPrev.css("margin-right", -owlPrevW);
3515					$owlNext.css("margin-left", -owlNextW);
3516				} else {
3517					$owlPrev.css("margin-left", -owlPrevW);
3518					$owlNext.css("margin-right", -owlNextW);
3519				}
3520				if (!owlNested) {
3521					$owlDots.css({
3522						opacity: 1,
3523						bottom: -owlDotsH
3524					});
3525				}
3526			});
3527		};
3528
3529		function animate_elems($this) {
3530			var lastDelay;
3531			$.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) {
3532				var element = $(val),
3533					delayAttr = element.attr('data-delay'),
3534					$first_item = element.closest('.owl-item[data-index="1"]');
3535
3536				if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
3537					return false;
3538				}
3539
3540				if (delayAttr == undefined) delayAttr = 0;
3541				requestTimeout(function() {
3542					element.addClass('start_animation');
3543				}, delayAttr);
3544				lastDelay = delayAttr;
3545			});
3546			return lastDelay;
3547		}
3548
3549		function animate_thumb(items, event) {
3550			var lastDelay,
3551				itemIndex,
3552				thiis = $(event.currentTarget),
3553				tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'),
3554				numActives = $('.owl-item.active', thiis).length,
3555				stagePadding = thiis.data('stagepadding');
3556
3557			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
3558
3559			thiis.data('tempIndex', event.item.index);
3560				$.each(items, function(index, val) {
3561					var parent = $(val).closest('.owl-item');
3562					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3563						return;
3564					}
3565					if (!$(val).hasClass('start_animation')) {
3566						if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
3567							var thumbInView = new Waypoint.Inview({
3568							  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3569							  element: val,
3570							  enter: function(direction) {
3571								var element = $(this.element),
3572										delayAttr = parseInt(element.attr('data-delay')),
3573										itemIndex = element.closest('.owl-item').index() + 1,
3574										diffItem = Math.abs(itemIndex - tempIndex) - 1;
3575									if (itemIndex > tempIndex) {
3576										thiis.data('tempIndex', itemIndex);
3577									}
3578									if (isNaN(delayAttr)) delayAttr = 100;
3579									if (stagePadding) {
3580										var objTimeout = requestTimeout(function() {
3581											element.addClass('start_animation');
3582										}, index * delayAttr);
3583										lastDelay = index * delayAttr;
3584									} else {
3585										$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation');
3586										var objTimeout = requestTimeout(function() {
3587											element.addClass('start_animation');
3588										}, diffItem * delayAttr);
3589										lastDelay = diffItem * delayAttr;
3590									}
3591									parent.data('objTimeout', objTimeout);
3592									if (!UNCODE.isUnmodalOpen) {
3593										this.destroy();
3594									}
3595								}
3596							});
3597						}
3598					}
3599				});
3600				return lastDelay;
3601			}
3602
3603		function setItemsHeight(item) {
3604			$.each($('.owl-item', item), function(index, val) {
3605				var availableThumbHeight = $('.t-inside', $(val)).height(),
3606				innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
3607				difference = availableThumbHeight - innerThumbHeight;
3608				if ($('.tmb-content-under', val).length) {
3609					var visualPart = $('.t-entry-visual', val);
3610					if (visualPart.length) {
3611						difference -= $('.t-entry-visual', val).height();
3612					}
3613				}
3614				if (! $('.tmb-content-lateral', val).length)
3615					$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
3616			});
3617		}
3618
3619		function setItemsRelHeight(item) {
3620			$.each($('.owl-item', item), function(index, val) {
3621				var $rowContainer = $(item).parents('.row-parent').eq(0),
3622					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
3623					$colContainer = $(item).parents('.uncell').eq(0),
3624					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
3625					winHeight = UNCODE.wheight,
3626					multiplier_h = parseInt($(item).attr('data-vp-height')),
3627					data_viewport_h,
3628					consider_menu = $(item).data('vp-menu');
3629
3630				if ( consider_menu ) {
3631					winHeight = winHeight - UNCODE.menuHeight;
3632				}
3633
3634				data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
3635				$('.t-inside', val).css( 'height', data_viewport_h );
3636			});
3637		}
3638
3639		function pauseOnHover(slider) {
3640			$('.owl-dots, .owl-prev, .owl-next', slider).on({
3641				mouseenter: function () {
3642					$(slider).addClass('owl-mouseenter');
3643					$(slider).trigger('stop.owl.autoplay');
3644				},
3645				mouseleave: function () {
3646					$(slider).removeClass('owl-mouseenter');
3647					$(slider).trigger('play.owl.autoplay');
3648				}
3649			});
3650		}
3651	});
3652};
3653
3654UNCODE.owlPlayVideo = function(carousel) {
3655	var player, iframe;
3656	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
3657		var content = $(val).html();
3658		if (content == '') {
3659			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
3660			$(val).append(getCloned);
3661		}
3662		if ($(this).attr('data-provider') == 'vimeo') {
3663			iframe = $(this).find('iframe');
3664			player = new Vimeo.Player(iframe[0]);
3665			player.play();
3666		} else if ($(this).attr('data-provider') == 'youtube') {
3667			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
3668		} else {
3669			var player = $(this).find('video');
3670			if (player.length) {
3671				$(this).find('video')[0].volume = 0;
3672				$(this).find('video')[0].play();
3673				$(val).css('opacity', 1);
3674			}
3675		}
3676	});
3677};
3678
3679UNCODE.owlStopVideo = function(carousel) {
3680	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
3681		var player, iframe;
3682		if ($(this).attr('data-provider') == 'vimeo') {
3683			iframe = $(this).find('iframe');
3684			player = new Vimeo.Player(iframe[0]);
3685			player.pause();
3686		} else if ($(this).attr('data-provider') == 'youtube') {
3687			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
3688		} else {
3689			var player = $(this).find('video');
3690			if (player.length) {
3691				$(this).find('video')[0].volume = 0;
3692				$(this).find('video')[0].play();
3693			}
3694		}
3695	});
3696};
3697
3698UNCODE.animations = function() {
3699
3700	var runWaypoints_TO,
3701		runWaypoints_carousel_TO,
3702		runWaypoints_delay = 0,
3703	highlightComplexFunc = function($wrap, ev){
3704
3705		var $lines = $('.heading-line-wrap', $wrap),
3706			not_animate = false;
3707
3708		if ( $wrap.data('animate') === true ) {
3709			not_animate = true;
3710		}
3711
3712		var $rotatingTxt = $('.uncode-rotating-text-start', $wrap);
3713		if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) {
3714			return;
3715		}
3716
3717		$lines.each(function(_key, _value){
3718			var $line = $(_value),
3719				$inners = $('.split-word-inner', $line),
3720				$highlights = $('.heading-text-highlight-inner', $line);
3721
3722			var highlitInnerFunc = function(ev){
3723				var delay = 0;
3724				$highlights.each(function(h_key, high){
3725					var $highlight = $(high),
3726						$split = $highlight.closest('.split-word:not(.uncode-rotating-span)'),
3727						$nextSplit = $split.nextUntil(),
3728						$next = $('.heading-text-highlight-inner', $nextSplit),
3729						countCh = $split.text().length;
3730
3731					$highlight.css({
3732						'-webkit-transition-duration': (30 * countCh) + 'ms',
3733						'-moz-transition-duration': (30 * countCh) + 'ms',
3734						'-o-transition-duration': (30 * countCh) + 'ms',
3735						'transition-duration': (30 * countCh) + 'ms',
3736					});
3737
3738					delay += (30 * countCh);
3739
3740					$next.css({
3741						'-webkit-transition-delay': delay + 'ms',
3742						'-moz-transition-delay': delay + 'ms',
3743						'-o-transition-delay': delay + 'ms',
3744						'transition-delay': delay + 'ms',
3745					});
3746				});
3747				$highlights.removeAttr('data-animated');
3748				if ( _key+1 === $lines.length ) {
3749					$wrap.data('animate', true);
3750				}
3751			};
3752
3753			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
3754				if ( not_animate ) {
3755					$highlights.each(function(h_key, high){
3756						var $highlight = $(high);
3757						$highlight.css({
3758							'-webkit-transition-duration': '0ms',
3759							'-moz-transition-duration': '0ms',
3760							'-o-transition-duration': '0ms',
3761							'transition-duration': '0ms',
3762						});
3763					});
3764					$highlights.removeAttr('data-animated');
3765				} else {
3766					if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) {
3767						highlitInnerFunc();
3768					} else {
3769						$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc);
3770					}
3771				}
3772			}
3773		});
3774	};
3775
3776	$.each($('.header-content-inner'), function(index, val) {
3777		var element = $(val),
3778			transition = '';
3779		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
3780		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
3781		if (element.hasClass('left-t-right')) transition = 'left-t-right';
3782		if (element.hasClass('right-t-left')) transition = 'right-t-left';
3783		if (element.hasClass('zoom-in')) transition = 'zoom-in';
3784		if (element.hasClass('zoom-out')) transition = 'zoom-out';
3785		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
3786		if (transition != '') {
3787			$(val).removeClass(transition);
3788			var container = element,
3789				containerDelay = container.attr('data-delay'),
3790				containerSpeed = container.attr('data-speed'),
3791				items = $('.header-title > *, .post-info', container);
3792			$.each(items, function(index, val) {
3793				var element = $(val),
3794					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
3795					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
3796				if (!element.hasClass('animate_when_almost_visible')) {
3797					delayAttr = Number(delayAttr) + (400 * index);
3798					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
3799					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
3800				}
3801			});
3802			container.css('opacity', 1);
3803		}
3804	});
3805
3806	function animate_css_grids_on_load() {
3807		$('.cssgrid-system').each(function() {
3808			var grid = $(this);
3809			var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false;
3810			UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false);
3811		});
3812	}
3813
3814	window.waypoint_animation = function(ev) {
3815		$.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) {
3816			if ( $(val).hasClass('el-text-split') || ( ( $(val).closest('.unscroll-horizontal').length || $(val).closest('.index-scroll').length ) && !SiteParameters.is_frontend_editor ) ) {
3817				return true;
3818			}
3819			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3820				return;
3821			}
3822			var run = true,
3823				$carousel = $(val).closest('.owl-carousel');
3824			if ( $carousel.length ) {
3825				run = false;
3826			}
3827			if (run) {
3828				new Waypoint({
3829					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3830					element: val,
3831					handler: function() {
3832						var element = $(this.element),
3833							index = element.index(),
3834							delayAttr = element.attr('data-delay');
3835						if (delayAttr == undefined) delayAttr = 0;
3836						requestTimeout(function() {
3837							element.addClass('start_animation');
3838						}, delayAttr);
3839						if (!UNCODE.isUnmodalOpen) {
3840							this.destroy();
3841						}
3842					},
3843					offset: UNCODE.isFullPage ? '100%' : '90%'
3844				});
3845			}
3846		});
3847		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
3848			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3849				return;
3850			}
3851			var run = true,
3852				$carousel = $(val).closest('.owl-carousel');
3853			if ( $carousel.length ) {
3854				run = false;
3855			}
3856			if (run) {
3857				new Waypoint({
3858					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3859					element: val,
3860					handler: function() {
3861						var $element = $(this.element),
3862							$childs = $('.animate_when_parent_almost_visible', $element);
3863						$childs.each(function(key,el){
3864							var $child = $(el),
3865								delaySpeed = $child.attr('data-speed'),
3866								delayAttr = $child.attr('data-delay'),
3867								intervalAttr = $child.attr('data-interval');
3868							if (delayAttr == undefined) {
3869								delayAttr = 50*key;
3870							}
3871							requestTimeout(function() {
3872								$child.addClass('start_animation');
3873								if ( $child.hasClass('anim-line-checker') ) {
3874									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
3875										var $line = $child.closest('.heading-line-wrap');
3876									});
3877								}
3878								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
3879								highlightComplexFunc($wrapText, ev);
3880								if ( $child.hasClass('anim-tot-checker') ) {
3881									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
3882										if ( $child.hasClass('anim-tot-checker') ) {
3883											$wrapText.addClass('already-animated');
3884											$element.trigger('already-animated');
3885										}
3886									});
3887								}
3888							}, delayAttr );
3889						});
3890						$element.addClass('start_animation');
3891						if (!UNCODE.isUnmodalOpen) {
3892							this.destroy();
3893						}
3894					},
3895					offset: UNCODE.isFullPage ? '100%' : '90%'
3896				});
3897			}
3898		});
3899	}
3900	window.waypoint_carousel_animation = function(ev) {
3901		$.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) {
3902			if ( $(val).hasClass('el-text-split') ) {
3903				return true;
3904			}
3905			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3906				return;
3907			}
3908			var run = true,
3909				$carousel = $(val).closest('.owl-carousel'),
3910				$first_item = $(val).closest('.owl-item[data-index="1"]'),
3911				$all_first = $('.owl-item[data-index="1"]', $carousel);
3912			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
3913				run = false;
3914			}
3915			if (run) {
3916				new Waypoint({
3917					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3918					element: val,
3919					handler: function() {
3920						var element = $(this.element),
3921							index = element.index(),
3922							delayAttr = element.attr('data-delay');
3923						if (delayAttr == undefined) delayAttr = 0;
3924						requestTimeout(function() {
3925							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
3926								$all_first.attr('data-already-reached', 'true');
3927							}
3928							element.addClass('start_animation');
3929						}, delayAttr);
3930						if (!UNCODE.isUnmodalOpen) {
3931							this.destroy();
3932						}
3933					},
3934					offset: UNCODE.isFullPage ? '100%' : '90%'
3935				});
3936			}
3937		});
3938		$.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) {
3939			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3940				return;
3941			}
3942			var run = true,
3943				$carousel = $(val).closest('.owl-carousel'),
3944				$first_item = $(val).closest('.owl-item[data-index="1"]'),
3945				$all_first = $('.owl-item[data-index="1"]', $carousel);
3946			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
3947				run = false;
3948			}
3949			if (run) {
3950				new Waypoint({
3951					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3952					element: val,
3953					handler: function() {
3954						var $element = $(this.element),
3955							$childs = $('.animate_when_parent_almost_visible', $element);
3956						$childs.each(function(key,el){
3957							var $child = $(el),
3958								delaySpeed = $child.attr('data-speed'),
3959								delayAttr = $child.attr('data-delay'),
3960								intervalAttr = $child.attr('data-interval');
3961							if (delayAttr == undefined) {
3962								delayAttr = 50*key;
3963							}
3964							requestTimeout(function() {
3965								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
3966									$all_first.attr('data-already-reached', 'true');
3967								}
3968								$child.addClass('start_animation');
3969								if ( $child.hasClass('anim-line-checker') ) {
3970									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
3971										var $line = $child.closest('.heading-line-wrap');
3972									});
3973								}
3974								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
3975								highlightComplexFunc($wrapText, ev);
3976								if ( $child.hasClass('anim-tot-checker') ) {
3977									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
3978										if ( $child.hasClass('anim-tot-checker') ) {
3979											$wrapText.addClass('already-animated');
3980										}
3981									});
3982								}
3983							}, delayAttr );
3984						});
3985						$element.addClass('start_animation');
3986						if (!UNCODE.isUnmodalOpen) {
3987							this.destroy();
3988						}
3989					},
3990					offset: UNCODE.isFullPage ? '100%' : '90%'
3991				});
3992			}
3993		});
3994	}
3995
3996	var runWaypoints = function(ev){
3997		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
3998			runWaypoints_delay = 400;
3999		}
4000		clearRequestTimeout(runWaypoints_TO);
4001		runWaypoints_TO = requestTimeout(function() {
4002			window.waypoint_animation(ev);
4003		}, runWaypoints_delay);
4004
4005		clearRequestTimeout(runWaypoints_carousel_TO);
4006		runWaypoints_carousel_TO = requestTimeout(function() {
4007			window.waypoint_carousel_animation(ev);
4008		}, 400);
4009	};
4010	runWaypoints();
4011	animate_css_grids_on_load();
4012
4013	$( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) {
4014		runWaypoints(ev);
4015	});
4016	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4017		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
4018	}
4019};
4020
4021UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) {
4022	var $allItems = elements.length - startIndex,
4023		showed = 0,
4024		index = 0,
4025		use_index = false
4026		;
4027
4028	if (filtering) {
4029		if (sequential) {
4030			use_index = true;
4031		}
4032		sequential = false;
4033	}
4034
4035	$.each(elements, function(index, val) {
4036		var $this = $(val),
4037			elInner = $('> .t-inside', val);
4038
4039		if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4040			return;
4041		}
4042		if (val[0]) val = val[0];
4043
4044		if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
4045			new Waypoint({
4046				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4047				element: val,
4048				handler: function() {
4049					var element = $('> .t-inside', this.element),
4050						parent = $(this.element);
4051					var _index = use_index? index : 0;
4052
4053					var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index),
4054						delayAttr = parseInt(element.attr('data-delay'));
4055					if (isNaN(delayAttr)) delayAttr = 100;
4056					if (sequential || use_index) {
4057						delay -= showed;
4058					}
4059					var objTimeout = requestTimeout(function() {
4060						element.removeClass('zoom-reverse').addClass('start_animation');
4061						showed = index;
4062					}, delay * delayAttr);
4063					parent.data('objTimeout', objTimeout);
4064					if (!UNCODE.isUnmodalOpen) {
4065						this.destroy();
4066					}
4067				},
4068				offset: UNCODE.isFullPage ? '100%' : '90%'
4069			});
4070		}
4071
4072		index++;
4073	});
4074};
4075
4076UNCODE.tapHover = function() {
4077
4078	var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), //.length //html.touch a.btn
4079		elClass = "hover";
4080
4081	$(window).on('click', function() {
4082		$el.removeClass(elClass);
4083	});
4084
4085	$el.on("click", function(e) { // cambia click con touch start 'touchstart'
4086		e.stopPropagation();
4087		var link = $(this);
4088		if ( ! link.hasClass(elClass)) {
4089			e.preventDefault();
4090			link.addClass("hover");
4091			$el.not(this).removeClass(elClass);
4092			return false;
4093		}
4094	});
4095};
4096
4097UNCODE.onePage = function(isMobile) {
4098	var current = 0,
4099		last = 0,
4100		lastScrollTop = 0,
4101		forceScroll = false,
4102		lastScrolled = 0,
4103		isSectionscroller = ($('.main-onepage').length) ? true : false,
4104		isOnePage = false,
4105		getOffset = function () {
4106			var calculateOffset = (($('.menu-sticky .menu-container:not(.menu-hide)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide)').outerHeight() : 0);
4107			return calculateOffset;
4108		}
4109
4110	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
4111	// 	return false;
4112
4113	function init_onepage() {
4114		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
4115			$("<ul class='onepage-pagination'></ul>").prependTo("body");
4116		}
4117		last = $('.onepage-pagination li').last().find('a').data('index');
4118		$.each($('div[data-parent="true"]'), function(index, val) {
4119			$(this).attr('data-section', index);
4120			if (isMobile) return;
4121			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4122				return;
4123			}
4124			var sectionDown = new Waypoint({
4125				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4126				element: val,
4127				handler: function(direction) {
4128					if (direction == 'down') {
4129						changeMenuActive(this.element, index);
4130					}
4131				},
4132				offset: function() {
4133					return 5 + getOffset()
4134				}
4135			});
4136			var sectionUp = new Waypoint({
4137				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4138				element: val,
4139				handler: function(direction) {
4140					if (direction == 'up') {
4141						changeMenuActive(this.element, index);
4142					}
4143				},
4144				offset: function() {
4145					return -5 - getOffset()
4146				}
4147			});
4148
4149			if (isSectionscroller) {
4150				var label;
4151				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
4152				else label = '';
4153				var getName = $(this).attr('data-name');
4154				if (getName == undefined) getName = index;
4155				if (label != '') {
4156					isOnePage = true;
4157					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
4158					$('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>");
4159				}
4160			}
4161		});
4162
4163		if (isSectionscroller) {
4164			$.each($('ul.onepage-pagination li'), function(index, val) {
4165				var $this = $(val),
4166					$a = ('a', $this);
4167				$a.on('click', function(evt) {
4168					if ( $('.is-selected', $this).length ) {
4169						return false;
4170					}
4171					if ( $('body').hasClass('uncode-scroll-no-history') ) {
4172						evt.preventDefault();
4173					}
4174					Waypoint.refreshAll();
4175					var el = $('a', evt.currentTarget);
4176					current = lastScrolled = parseInt(el.attr('data-index'));
4177					lastScrolled += 1;
4178					scrollBody(current);
4179				});
4180			});
4181		}
4182
4183		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
4184		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
4185			goToSection = String(window.location.hash).replace(/^#/, "");
4186			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
4187		}
4188
4189		if (typeof goToSection === 'number' && !isNaN(goToSection)) {
4190			current = lastScrolled = goToSection;
4191			$(window).on('load', function(){
4192				if ( $('.owl-carousel').length ) {
4193					requestTimeout(function(){
4194						scrollBody(goToSection);
4195					}, 400);
4196				} else {
4197					scrollBody(goToSection);
4198				}
4199			});
4200		}
4201
4202	}
4203
4204	function changeMenuActive(section, index) {
4205		current = lastScrolled = parseInt($(section).attr('data-section'));
4206		if (isOnePage) {
4207			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
4208			if (newSection.length) {
4209				$('ul.onepage-pagination li a').removeClass('is-selected');
4210				newSection.addClass('is-selected');
4211			}
4212			var getName = $('[data-section="' + index + '"]').attr('data-name');
4213			if (getName != undefined && getName !== '') {
4214				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
4215					var get_href = $(val).attr('href');
4216					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
4217						$(val).closest('.menu-smart').find('.active').removeClass('active');
4218						$(val).parent().addClass('active');
4219					}
4220				});
4221			}
4222		}
4223	}
4224
4225	if (isOnePage) {
4226		$(window).on('scroll', function() {
4227			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
4228			if (bodyTop == 0) {
4229				$('ul.onepage-pagination li a').removeClass('is-selected');
4230				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
4231				var getName = $('[data-section=0]').attr('data-name');
4232				if (getName != undefined && getName !== '') {
4233					$.each($('.menu-container .menu-item > a'), function(i, val) {
4234						var get_href = $(val).attr('href');
4235						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
4236							$(val).closest('ul').find('.active').removeClass('active');
4237							$(val).parent().addClass('active');
4238						}
4239					});
4240				}
4241			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
4242				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
4243				if (lastSection.length) {
4244					$('ul.onepage-pagination li a').removeClass('is-selected');
4245					lastSection.addClass('is-selected');
4246				}
4247			}
4248		});
4249	}
4250
4251	var scrollBody = function(index) {
4252		$('ul.onepage-pagination li a').removeClass('is-selected');
4253		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
4254
4255		var getSection = $('[data-section=' + index + ']'),
4256			scrollTo;
4257
4258		if (getSection == undefined) return;
4259
4260		var body = $("html, body"),
4261			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
4262			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
4263			getOffset = UNCODE.get_scroll_offset(index);
4264		if ( typeof getSection.offset() === 'undefined' )
4265			return;
4266		scrollTo = getSection.offset().top;
4267
4268		// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
4269		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
4270			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
4271			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
4272				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
4273			}
4274
4275			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
4276				if ( index === 0 ) {
4277					scrollTo = 0;
4278				} else {
4279					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
4280				}
4281			} else {
4282				scrollTo -= getOffset;
4283			}
4284		}
4285
4286		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
4287		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
4288
4289		if (index != 0) {
4290			UNCODE.scrolling = true;
4291		}
4292
4293		if (scrollSpeed == 0) {
4294			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
4295			UNCODE.scrolling = false;
4296		} else {
4297			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
4298				$(this).stop();
4299			}).animate({
4300				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
4301			}, scrollSpeed, 'easeInOutCubic', function() {
4302				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
4303				UNCODE.scrolling = false;
4304				if  ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
4305				||
4306				$('.menu-hided').length ) {
4307					scrollTo = getSection.offset().top;
4308					getOffset = UNCODE.get_scroll_offset(index);
4309					scrollTo -= getOffset;
4310					body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
4311						$(this).stop();
4312					}).animate({
4313						scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
4314						}, scrollSpeed, 'easeInOutCubic', function() {
4315							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
4316							UNCODE.scrolling = false;
4317						}
4318					);
4319				}
4320			});
4321		}
4322
4323	};
4324
4325	init_onepage();
4326};
4327
4328UNCODE.stickyElements = function() {
4329	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
4330	if (!isMobile_wide) {
4331
4332		var $pageHeader = $('#page-header'),
4333			$headerRow = $('.vc_row', $pageHeader),
4334			startSticky = false;
4335
4336		if ( $headerRow.hasClass('sticky-element') ) {
4337			$headerRow.removeClass('sticky-element');
4338			$pageHeader.addClass('sticky-element');
4339			startSticky = true;
4340		}
4341
4342		var calculateOffset = function(el) {
4343			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
4344				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
4345				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0;
4346
4347			sideOffset += UNCODE.bodyBorder;
4348
4349			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
4350			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && !$('.menu-wrapper .menu-desktop-transparent').length) {
4351				if ($('.menu-shrink').length) {
4352					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
4353				} else {
4354					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
4355				}
4356			}
4357
4358			return sideOffset;
4359
4360		},
4361
4362		initStickyElement = function() {
4363			$.each($('.sticky-element'), function(index, element) {
4364				$(element).stick_in_parent({
4365					sticky_class: 'is_stucked',
4366					offset_top: calculateOffset(element),
4367					bottoming: true,
4368					inner_scrolling: SiteParameters.sticky_elements === 'on'
4369				});
4370			});
4371		};
4372
4373		requestTimeout(function() {
4374			if ($('.sticky-element').length) {
4375
4376				if ($(window).width() > UNCODE.mediaQuery) {
4377					initStickyElement();
4378
4379					if ( startSticky === true ) {
4380						$('#page-header').trigger('sticky_kit:recalc');
4381					}
4382				}
4383
4384				$(window).on('resize', function(event) {
4385					if ($(window).width() > UNCODE.mediaQuery) {
4386						initStickyElement();
4387					} else {
4388						$(".sticky-element").trigger("sticky_kit:detach");
4389					}
4390				});
4391			}
4392		}, 1000);
4393
4394		if ($('.sticky-element').length) {
4395			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
4396				requestTimeout(function() {
4397					$(document.body).trigger("sticky_kit:recalc");
4398				}, 100);
4399			});
4400		}
4401
4402		var $panels = $('.panel-collapse');
4403		if ( $panels.length ) {
4404			$panels.each(function(){
4405				var $panel = $(this);
4406				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
4407					$(document.body).trigger("sticky_kit:recalc");
4408				});
4409			});
4410		}
4411	}
4412};
4413
4414UNCODE.twentytwenty = function() {
4415
4416  if (!$('.twentytwenty-container').length) return;
4417
4418// DOM.event.move
4419//
4420// 2.0.0
4421//
4422// Stephen Band
4423//
4424// Triggers 'movestart', 'move' and 'moveend' events after
4425// mousemoves following a mousedown cross a distance threshold,
4426// similar to the native 'dragstart', 'drag' and 'dragend' events.
4427// Move events are throttled to animation frames. Move event objects
4428// have the properties:
4429//
4430// pageX:
4431// pageY:     Page coordinates of pointer.
4432// startX:
4433// startY:    Page coordinates of pointer at movestart.
4434// distX:
4435// distY:     Distance the pointer has moved since movestart.
4436// deltaX:
4437// deltaY:    Distance the finger has moved since last event.
4438// velocityX:
4439// velocityY: Average velocity over last few events.
4440
4441
4442(function(fn) {
4443	if (typeof define === 'function' && define.amd) {
4444        define([], fn);
4445    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
4446        module.exports = fn;
4447	} else {
4448		fn();
4449	}
4450})(function(){
4451	var assign = Object.assign || window.jQuery && jQuery.extend;
4452
4453	// Number of pixels a pressed pointer travels before movestart
4454	// event is fired.
4455	var threshold = 8;
4456
4457	// Shim for requestAnimationFrame, falling back to timer. See:
4458	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
4459	var requestFrame = (function(){
4460		return (
4461			window.requestAnimationFrame ||
4462			window.webkitRequestAnimationFrame ||
4463			window.mozRequestAnimationFrame ||
4464			window.oRequestAnimationFrame ||
4465			window.msRequestAnimationFrame ||
4466			function(fn, element){
4467				return window.setTimeout(function(){
4468					fn();
4469				}, 25);
4470			}
4471		);
4472	})();
4473
4474	// Shim for customEvent
4475	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
4476	(function () {
4477		if ( typeof window.CustomEvent === "function" ) return false;
4478		function CustomEvent ( event, params ) {
4479			params = params || { bubbles: false, cancelable: false, detail: undefined };
4480			var evt = document.createEvent( 'CustomEvent' );
4481			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
4482			return evt;
4483		}
4484
4485		CustomEvent.prototype = window.Event.prototype;
4486		window.CustomEvent = CustomEvent;
4487	})();
4488
4489	var ignoreTags = {
4490			textarea: true,
4491			input: true,
4492			select: true,
4493			button: true
4494		};
4495
4496	var mouseevents = {
4497		move:   'mousemove',
4498		cancel: 'mouseup dragstart',
4499		end:    'mouseup'
4500	};
4501
4502	var touchevents = {
4503		move:   'touchmove',
4504		cancel: 'touchend',
4505		end:    'touchend'
4506	};
4507
4508	var rspaces = /\s+/;
4509
4510
4511	// DOM Events
4512
4513	var eventOptions = { bubbles: true, cancelable: true };
4514
4515	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
4516
4517	function createEvent(type) {
4518		return new CustomEvent(type, eventOptions);
4519	}
4520
4521	function getEvents(node) {
4522		return node[eventsSymbol] || (node[eventsSymbol] = {});
4523	}
4524
4525	function on(node, types, fn, data, selector) {
4526		types = types.split(rspaces);
4527
4528		var events = getEvents(node);
4529		var i = types.length;
4530		var handlers, type;
4531
4532		function handler(e) { fn(e, data); }
4533
4534		while (i--) {
4535			type = types[i];
4536			handlers = events[type] || (events[type] = []);
4537			handlers.push([fn, handler]);
4538			node.addEventListener(type, handler);
4539		}
4540	}
4541
4542	function off(node, types, fn, selector) {
4543		types = types.split(rspaces);
4544
4545		var events = getEvents(node);
4546		var i = types.length;
4547		var type, handlers, k;
4548
4549		if (!events) { return; }
4550
4551		while (i--) {
4552			type = types[i];
4553			handlers = events[type];
4554			if (!handlers) { continue; }
4555			k = handlers.length;
4556			while (k--) {
4557				if (handlers[k][0] === fn) {
4558					node.removeEventListener(type, handlers[k][1]);
4559					handlers.splice(k, 1);
4560				}
4561			}
4562		}
4563	}
4564
4565	function trigger(node, type, properties) {
4566		// Don't cache events. It prevents you from triggering an event of a
4567		// given type from inside the handler of another event of that type.
4568		var event = createEvent(type);
4569		if (properties) { assign(event, properties); }
4570		node.dispatchEvent(event);
4571	}
4572
4573
4574	// Constructors
4575
4576	function Timer(fn){
4577		var callback = fn,
4578		    active = false,
4579		    running = false;
4580
4581		function trigger(time) {
4582			if (active){
4583				callback();
4584				requestFrame(trigger);
4585				running = true;
4586				active = false;
4587			}
4588			else {
4589				running = false;
4590			}
4591		}
4592
4593		this.kick = function(fn) {
4594			active = true;
4595			if (!running) { trigger(); }
4596		};
4597
4598		this.end = function(fn) {
4599			var cb = callback;
4600
4601			if (!fn) { return; }
4602
4603			// If the timer is not running, simply call the end callback.
4604			if (!running) {
4605				fn();
4606			}
4607			// If the timer is running, and has been kicked lately, then
4608			// queue up the current callback and the end callback, otherwise
4609			// just the end callback.
4610			else {
4611				callback = active ?
4612					function(){ cb(); fn(); } :
4613					fn ;
4614
4615				active = true;
4616			}
4617		};
4618	}
4619
4620
4621	// Functions
4622
4623	function noop() {}
4624
4625	function preventDefault(e) {
4626		e.preventDefault();
4627	}
4628
4629	function isIgnoreTag(e) {
4630		return !!ignoreTags[e.target.tagName.toLowerCase()];
4631	}
4632
4633	function isPrimaryButton(e) {
4634		// Ignore mousedowns on any button other than the left (or primary)
4635		// mouse button, or when a modifier key is pressed.
4636		return (e.which === 1 && !e.ctrlKey && !e.altKey);
4637	}
4638
4639	function identifiedTouch(touchList, id) {
4640		var i, l;
4641
4642		if (touchList.identifiedTouch) {
4643			return touchList.identifiedTouch(id);
4644		}
4645
4646		// touchList.identifiedTouch() does not exist in
4647		// webkit yet… we must do the search ourselves...
4648
4649		i = -1;
4650		l = touchList.length;
4651
4652		while (++i < l) {
4653			if (touchList[i].identifier === id) {
4654				return touchList[i];
4655			}
4656		}
4657	}
4658
4659	function changedTouch(e, data) {
4660		var touch = identifiedTouch(e.changedTouches, data.identifier);
4661
4662		// This isn't the touch you're looking for.
4663		if (!touch) { return; }
4664
4665		// Chrome Android (at least) includes touches that have not
4666		// changed in e.changedTouches. That's a bit annoying. Check
4667		// that this touch has changed.
4668		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
4669
4670		return touch;
4671	}
4672
4673
4674	// Handlers that decide when the first movestart is triggered
4675
4676	function mousedown(e){
4677		// Ignore non-primary buttons
4678		if (!isPrimaryButton(e)) { return; }
4679
4680		// Ignore form and interactive elements
4681		if (isIgnoreTag(e)) { return; }
4682
4683		on(document, mouseevents.move, mousemove, e);
4684		on(document, mouseevents.cancel, mouseend, e);
4685	}
4686
4687	function mousemove(e, data){
4688		checkThreshold(e, data, e, removeMouse);
4689	}
4690
4691	function mouseend(e, data) {
4692		removeMouse();
4693	}
4694
4695	function removeMouse() {
4696		off(document, mouseevents.move, mousemove);
4697		off(document, mouseevents.cancel, mouseend);
4698	}
4699
4700	function touchstart(e) {
4701		// Don't get in the way of interaction with form elements
4702		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
4703
4704		var touch = e.changedTouches[0];
4705
4706		// iOS live updates the touch objects whereas Android gives us copies.
4707		// That means we can't trust the touchstart object to stay the same,
4708		// so we must copy the data. This object acts as a template for
4709		// movestart, move and moveend event objects.
4710		var data = {
4711			target:     touch.target,
4712			pageX:      touch.pageX,
4713			pageY:      touch.pageY,
4714			identifier: touch.identifier,
4715
4716			// The only way to make handlers individually unbindable is by
4717			// making them unique.
4718			touchmove:  function(e, data) { touchmove(e, data); },
4719			touchend:   function(e, data) { touchend(e, data); }
4720		};
4721
4722		on(document, touchevents.move, data.touchmove, data);
4723		on(document, touchevents.cancel, data.touchend, data);
4724	}
4725
4726	function touchmove(e, data) {
4727		var touch = changedTouch(e, data);
4728		if (!touch) { return; }
4729		checkThreshold(e, data, touch, removeTouch);
4730	}
4731
4732	function touchend(e, data) {
4733		var touch = identifiedTouch(e.changedTouches, data.identifier);
4734		if (!touch) { return; }
4735		removeTouch(data);
4736	}
4737
4738	function removeTouch(data) {
4739		off(document, touchevents.move, data.touchmove);
4740		off(document, touchevents.cancel, data.touchend);
4741	}
4742
4743	function checkThreshold(e, data, touch, fn) {
4744		var distX = touch.pageX - data.pageX;
4745		var distY = touch.pageY - data.pageY;
4746
4747		// Do nothing if the threshold has not been crossed.
4748		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
4749
4750		triggerStart(e, data, touch, distX, distY, fn);
4751	}
4752
4753	function triggerStart(e, data, touch, distX, distY, fn) {
4754		var touches = e.targetTouches;
4755		var time = e.timeStamp - data.timeStamp;
4756
4757		// Create a movestart object with some special properties that
4758		// are passed only to the movestart handlers.
4759		var template = {
4760			altKey:     e.altKey,
4761			ctrlKey:    e.ctrlKey,
4762			shiftKey:   e.shiftKey,
4763			startX:     data.pageX,
4764			startY:     data.pageY,
4765			distX:      distX,
4766			distY:      distY,
4767			deltaX:     distX,
4768			deltaY:     distY,
4769			pageX:      touch.pageX,
4770			pageY:      touch.pageY,
4771			velocityX:  distX / time,
4772			velocityY:  distY / time,
4773			identifier: data.identifier,
4774			targetTouches: touches,
4775			finger: touches ? touches.length : 1,
4776			enableMove: function() {
4777				this.moveEnabled = true;
4778				this.enableMove = noop;
4779				e.preventDefault();
4780			}
4781		};
4782
4783		// Trigger the movestart event.
4784		trigger(data.target, 'movestart', template);
4785
4786		// Unbind handlers that tracked the touch or mouse up till now.
4787		fn(data);
4788	}
4789
4790
4791	// Handlers that control what happens following a movestart
4792
4793	function activeMousemove(e, data) {
4794		var timer  = data.timer;
4795
4796		data.touch = e;
4797		data.timeStamp = e.timeStamp;
4798		timer.kick();
4799	}
4800
4801	function activeMouseend(e, data) {
4802		var target = data.target;
4803		var event  = data.event;
4804		var timer  = data.timer;
4805
4806		removeActiveMouse();
4807
4808		endEvent(target, event, timer, function() {
4809			// Unbind the click suppressor, waiting until after mouseup
4810			// has been handled.
4811			setTimeout(function(){
4812				off(target, 'click', preventDefault);
4813			}, 0);
4814		});
4815	}
4816
4817	function removeActiveMouse() {
4818		off(document, mouseevents.move, activeMousemove);
4819		off(document, mouseevents.end, activeMouseend);
4820	}
4821
4822	function activeTouchmove(e, data) {
4823		var event = data.event;
4824		var timer = data.timer;
4825		var touch = changedTouch(e, event);
4826
4827		if (!touch) { return; }
4828
4829		// Stop the interface from gesturing
4830		e.preventDefault();
4831
4832		event.targetTouches = e.targetTouches;
4833		data.touch = touch;
4834		data.timeStamp = e.timeStamp;
4835
4836		timer.kick();
4837	}
4838
4839	function activeTouchend(e, data) {
4840		var target = data.target;
4841		var event  = data.event;
4842		var timer  = data.timer;
4843		var touch  = identifiedTouch(e.changedTouches, event.identifier);
4844
4845		// This isn't the touch you're looking for.
4846		if (!touch) { return; }
4847
4848		removeActiveTouch(data);
4849		endEvent(target, event, timer);
4850	}
4851
4852	function removeActiveTouch(data) {
4853		off(document, touchevents.move, data.activeTouchmove);
4854		off(document, touchevents.end, data.activeTouchend);
4855	}
4856
4857
4858	// Logic for triggering move and moveend events
4859
4860	function updateEvent(event, touch, timeStamp) {
4861		var time = timeStamp - event.timeStamp;
4862
4863		event.distX =  touch.pageX - event.startX;
4864		event.distY =  touch.pageY - event.startY;
4865		event.deltaX = touch.pageX - event.pageX;
4866		event.deltaY = touch.pageY - event.pageY;
4867
4868		// Average the velocity of the last few events using a decay
4869		// curve to even out spurious jumps in values.
4870		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
4871		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
4872		event.pageX =  touch.pageX;
4873		event.pageY =  touch.pageY;
4874	}
4875
4876	function endEvent(target, event, timer, fn) {
4877		timer.end(function(){
4878			trigger(target, 'moveend', event);
4879			return fn && fn();
4880		});
4881	}
4882
4883
4884	// Set up the DOM
4885
4886	function movestart(e) {
4887		if (e.defaultPrevented) { return; }
4888		if (!e.moveEnabled) { return; }
4889
4890		var event = {
4891			startX:        e.startX,
4892			startY:        e.startY,
4893			pageX:         e.pageX,
4894			pageY:         e.pageY,
4895			distX:         e.distX,
4896			distY:         e.distY,
4897			deltaX:        e.deltaX,
4898			deltaY:        e.deltaY,
4899			velocityX:     e.velocityX,
4900			velocityY:     e.velocityY,
4901			identifier:    e.identifier,
4902			targetTouches: e.targetTouches,
4903			finger:        e.finger
4904		};
4905
4906		var data = {
4907			target:    e.target,
4908			event:     event,
4909			timer:     new Timer(update),
4910			touch:     undefined,
4911			timeStamp: e.timeStamp
4912		};
4913
4914		function update(time) {
4915			updateEvent(event, data.touch, data.timeStamp);
4916			trigger(data.target, 'move', event);
4917		}
4918
4919		if (e.identifier === undefined) {
4920			// We're dealing with a mouse event.
4921			// Stop clicks from propagating during a move
4922			on(e.target, 'click', preventDefault);
4923			on(document, mouseevents.move, activeMousemove, data);
4924			on(document, mouseevents.end, activeMouseend, data);
4925		}
4926		else {
4927			// In order to unbind correct handlers they have to be unique
4928			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
4929			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
4930
4931			// We're dealing with a touch.
4932			on(document, touchevents.move, data.activeTouchmove, data);
4933			on(document, touchevents.end, data.activeTouchend, data);
4934		}
4935	}
4936
4937	on(document, 'mousedown', mousedown);
4938	on(document, 'touchstart', touchstart);
4939	on(document, 'movestart', movestart);
4940
4941
4942	// jQuery special events
4943	//
4944	// jQuery event objects are copies of DOM event objects. They need
4945	// a little help copying the move properties across.
4946
4947	if (!window.jQuery) { return; }
4948
4949	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
4950
4951	function enableMove1(e) { e.enableMove(); }
4952	function enableMove2(e) { e.enableMove(); }
4953	function enableMove3(e) { e.enableMove(); }
4954
4955	function add(handleObj) {
4956		var handler = handleObj.handler;
4957
4958		handleObj.handler = function(e) {
4959			// Copy move properties across from originalEvent
4960			var i = properties.length;
4961			var property;
4962
4963			while(i--) {
4964				property = properties[i];
4965				e[property] = e.originalEvent[property];
4966			}
4967
4968			handler.apply(this, arguments);
4969		};
4970	}
4971
4972	jQuery.event.special.movestart = {
4973		setup: function() {
4974			// Movestart must be enabled to allow other move events
4975			on(this, 'movestart', enableMove1);
4976
4977			// Do listen to DOM events
4978			return false;
4979		},
4980
4981		teardown: function() {
4982			off(this, 'movestart', enableMove1);
4983			return false;
4984		},
4985
4986		add: add
4987	};
4988
4989	jQuery.event.special.move = {
4990		setup: function() {
4991			on(this, 'movestart', enableMove2);
4992			return false;
4993		},
4994
4995		teardown: function() {
4996			off(this, 'movestart', enableMove2);
4997			return false;
4998		},
4999
5000		add: add
5001	};
5002
5003	jQuery.event.special.moveend = {
5004		setup: function() {
5005			on(this, 'movestart', enableMove3);
5006			return false;
5007		},
5008
5009		teardown: function() {
5010			off(this, 'movestart', enableMove3);
5011			return false;
5012		},
5013
5014		add: add
5015	};
5016});
5017
5018  $.fn.twentytwenty = function(options) {
5019    var options = $.extend({
5020      default_offset_pct: 0.5,
5021      orientation: 'horizontal',
5022      before_label: 'Before',
5023      after_label: 'After',
5024      no_overlay: false,
5025      move_slider_on_hover: false,
5026      move_with_handle_only: true,
5027      click_to_move: false
5028    }, options);
5029
5030    return this.each(function() {
5031
5032      var sliderPct = options.default_offset_pct;
5033      var container = $(this);
5034      var sliderOrientation = options.orientation;
5035      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
5036      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
5037
5038
5039      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
5040      if(!options.no_overlay) {
5041        container.append("<div class='twentytwenty-overlay'></div>");
5042        var overlay = container.find(".twentytwenty-overlay");
5043        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
5044        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
5045      }
5046      var beforeImg = container.find("img:first");
5047      var afterImg = container.find("img:last");
5048      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
5049      var slider = container.find(".twentytwenty-handle");
5050      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
5051      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
5052      container.addClass("twentytwenty-container");
5053      beforeImg.addClass("twentytwenty-before");
5054      afterImg.addClass("twentytwenty-after");
5055
5056      var calcOffset = function(dimensionPct) {
5057        var w = beforeImg.width();
5058        var h = beforeImg.height();
5059        return {
5060          w: w+"px",
5061          h: h+"px",
5062          cw: (dimensionPct*w)+"px",
5063          ch: (dimensionPct*h)+"px"
5064        };
5065      };
5066
5067      var adjustContainer = function(offset) {
5068      	if (sliderOrientation === 'vertical') {
5069          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
5070          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
5071      	}
5072      	else {
5073          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
5074          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
5075    	}
5076        container.css("height", offset.h);
5077      };
5078
5079      var adjustSlider = function(pct) {
5080        var offset = calcOffset(pct);
5081        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
5082        adjustContainer(offset);
5083      };
5084
5085      // Return the number specified or the min/max number if it outside the range given.
5086      var minMaxNumber = function(num, min, max) {
5087        return Math.max(min, Math.min(max, num));
5088      };
5089
5090      // Calculate the slider percentage based on the position.
5091      var getSliderPercentage = function(positionX, positionY) {
5092        var sliderPercentage = (sliderOrientation === 'vertical') ?
5093          (positionY-offsetY)/imgHeight :
5094          (positionX-offsetX)/imgWidth;
5095
5096        return minMaxNumber(sliderPercentage, 0, 1);
5097      };
5098
5099
5100      $(window).on("resize.twentytwenty", function(e) {
5101        adjustSlider(sliderPct);
5102      });
5103
5104      var offsetX = 0;
5105      var offsetY = 0;
5106      var imgWidth = 0;
5107      var imgHeight = 0;
5108      var onMoveStart = function(e) {
5109        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
5110          e.preventDefault();
5111        }
5112        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
5113          e.preventDefault();
5114        }
5115        container.addClass("active");
5116        offsetX = container.offset().left;
5117        offsetY = container.offset().top;
5118        imgWidth = beforeImg.width();
5119        imgHeight = beforeImg.height();
5120      };
5121      var onMove = function(e) {
5122        if (container.hasClass("active")) {
5123          sliderPct = getSliderPercentage(e.pageX, e.pageY);
5124          adjustSlider(sliderPct);
5125        }
5126      };
5127      var onMoveEnd = function() {
5128          container.removeClass("active");
5129      };
5130
5131      var moveTarget = options.move_with_handle_only ? slider : container;
5132      moveTarget.on("movestart",onMoveStart);
5133      moveTarget.on("move",onMove);
5134      moveTarget.on("moveend",onMoveEnd);
5135
5136      if (options.move_slider_on_hover) {
5137        container.on("mouseenter", onMoveStart);
5138        container.on("mousemove", onMove);
5139        container.on("mouseleave", onMoveEnd);
5140      }
5141
5142      slider.on("touchmove", function(e) {
5143        e.preventDefault();
5144      });
5145
5146      container.find("img").on("mousedown", function(event) {
5147        event.preventDefault();
5148      });
5149
5150      if (options.click_to_move) {
5151        container.on('click', function(e) {
5152          offsetX = container.offset().left;
5153          offsetY = container.offset().top;
5154          imgWidth = beforeImg.width();
5155          imgHeight = beforeImg.height();
5156
5157          sliderPct = getSliderPercentage(e.pageX, e.pageY);
5158          adjustSlider(sliderPct);
5159        });
5160      }
5161
5162      $(window).trigger("resize.twentytwenty");
5163    });
5164  };
5165
5166
5167  $(window).on("load", function(e) {
5168  	$('.twentytwenty-container').each(function(){
5169  		var $container = $(this);
5170  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
5171  			$container.twentytwenty();
5172  		}
5173  		$('img', $container).on('async-done', function(){
5174	  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
5175	  			$container.twentytwenty();
5176	  		}
5177	    });
5178  	});
5179  });
5180}
5181
5182UNCODE.justifiedGallery = function() {
5183
5184	var breakPointMe = function( val ) {
5185		val = parseInt( val );
5186		if ( isNaN(val) ) {
5187			return false;
5188		}
5189		if ( val >= 1500 ) {
5190			return 1;
5191		} else if ( val < 1500 && val >= 960 ) {
5192			return 2;
5193		} else if ( val < 960 && val >= 570 ) {
5194			return 3;
5195		} else if ( val < 570 ) {
5196			return 4;
5197		}
5198	}
5199
5200	var gutterByBreakpoint = function( bp, gutter ) {
5201		var ret;
5202		switch(gutter) {
5203		    case 'no-gutter':
5204		    	ret = 0;
5205		        break;
5206		    case 'px-gutter':
5207		    	ret = 1;
5208		        break;
5209		    case 'half-gutter':
5210		    	ret = 18;
5211		        break;
5212		    case 'double-gutter':
5213				switch(bp) {
5214				    case 3:
5215				    case 4:
5216				    	ret = 36;
5217				        break;
5218				    default:
5219				    	ret = 72;
5220				        break;
5221				}
5222		        break;
5223		    case 'triple-gutter':
5224				switch(bp) {
5225				    case 3:
5226				    case 4:
5227				    	ret = 36;
5228				        break;
5229				    default:
5230				    	ret = 108;
5231				        break;
5232				}
5233		        break;
5234		    case 'quad-gutter':
5235				switch(bp) {
5236				    case 2:
5237				    	ret = 108;
5238				        break;
5239				    case 3:
5240				    	ret = 72;
5241				        break;
5242				    case 4:
5243				    	ret = 36;
5244				        break;
5245				    default:
5246				    	ret = 144;
5247				        break;
5248				}
5249		        break;
5250		    default:
5251		    	ret = 36;//single-gutter
5252		}
5253		return ret;
5254	}
5255
5256	if ($('.justified-layout').length > 0) {
5257		var justifiedContainersArray = [],
5258			typeGridArray = [],
5259			layoutGridArray = [],
5260			transitionDuration = [],
5261			$filterItems = [],
5262			$filters = $('.justified-system .isotope-filters'),
5263			$itemSelector = '.tmb',
5264			$items,
5265			itemMargin,
5266			correctionFactor = 0,
5267			firstLoad = true,
5268			isOriginLeft = $('body').hasClass('rtl') ? false : true,
5269			prevW = breakPointMe(UNCODE.wwidth);
5270		$('[class*="justified-container"]').each(function() {
5271			var isoData = $(this).data();
5272			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
5273			if (isoData.type == 'metro') typeGridArray.push(true);
5274			else typeGridArray.push(false);
5275			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
5276			else layoutGridArray.push('justified');
5277			justifiedContainersArray.push($(this));
5278		});
5279		var init_justifiedGallery = function() {
5280			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
5281				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
5282					justifiedId = justifiedSystem.attr('id'),
5283					$layoutMode = layoutGridArray[i],
5284					gutter = $(justifiedContainersArray[i]).data('gutter'),
5285					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
5286					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
5287					lastRow = $(justifiedContainersArray[i]).data('last-row'),
5288					margins;
5289
5290				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
5291				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
5292				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
5293
5294				margins = gutterByBreakpoint(prevW, gutter);
5295
5296				$(justifiedContainersArray[i]).justifiedGallery({
5297					rowHeight: rowHeight,
5298					maxRowHeight: maxRowHeight,
5299					margins: margins,
5300					cssAnimation: true,
5301					lastRow: lastRow,
5302					waitThumbnailsLoad: false
5303				}).one('jg.complete', function(){ onLayout($(this), 0); } );
5304
5305				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
5306					$(justifiedContainersArray[i]).infinitescroll({
5307							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
5308							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
5309							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
5310							animate: false,
5311							behavior: 'local',
5312							debug: false,
5313							loading: {
5314								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
5315								speed: 0,
5316								finished: undefined,
5317								msg: $('#' + justifiedId + ' .loadmore-button'),
5318							},
5319							errorCallback: function() {
5320								var justified_system = $(this).closest('.justified-system');
5321								$('.loading-button', justified_system).hide();
5322								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
5323							}
5324						},
5325						// append the new items to galleryJustified on the infinitescroll callback function.
5326						function(newElements, opts) {
5327							var $galleryJustified = $(this),
5328								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
5329								filters = new Array(),
5330								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
5331								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
5332								$numPages = $('a', $infinite_button).data('pages'),
5333								delay = 300;
5334							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
5335							$infinite_button.show();
5336							$loading_button.hide();
5337							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
5338							$('> li', $galleryJustified).remove();
5339							$.each($(newElements), function(index, val) {
5340								$(val).addClass('tmb-iso');
5341								if ($(val).is("li")) {
5342									filters.push($(val)[0]);
5343								}
5344							});
5345							newElements = newElements.filter(function(x) {
5346								return filters.indexOf(x) < 0
5347							});
5348							$.each($(filters), function(index, val) {
5349								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
5350							});
5351							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
5352							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
5353								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
5354								if (typeof getLightbox === 'object') {
5355									getLightbox.refresh();
5356								} else {
5357									UNCODE.lightbox();
5358								}
5359							}
5360							if ( typeof twttr !== 'undefined' )
5361								twttr.widgets.load(justifiedContainersArray[i]);
5362
5363							requestTimeout(function() {
5364								$galleryJustified.trigger('more-items-loaded');
5365							}, 1000);
5366						});
5367					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
5368						var $infinite_justified = $(justifiedContainersArray[i]),
5369							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
5370						$infinite_justified.infinitescroll('pause');
5371						$infinite_button.on('click', function(event) {
5372							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
5373								$.each(UNCODE.lightboxArray, function(index, val) {
5374									UNCODE.lightboxArray[index].destroy();
5375								});
5376							}
5377							event.preventDefault();
5378							var $justified_system = $(event.target).closest('.justified-system'),
5379							$infinite_justified = $justified_system.find('.justified-container'),
5380							justifiedId = $justified_system.attr('id');
5381							$(event.currentTarget).html(SiteParameters.loading);
5382							$infinite_justified.infinitescroll('resume');
5383							$infinite_justified.infinitescroll('retrieve');
5384							$infinite_justified.infinitescroll('pause');
5385							$infinite_justified.trigger('more-items-loaded');
5386						});
5387					}
5388				}
5389			}
5390		},
5391		onLayout = function(justifiedObj, startIndex) {
5392			justifiedObj.css('opacity', 1);
5393			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
5394			$('.tmb', justifiedObj).addClass('justified-object-loaded');
5395
5396			requestTimeout(function() {
5397				// window.dispatchEvent(UNCODE.boxEvent);
5398				UNCODE.adaptive();
5399				if (SiteParameters.dynamic_srcset_active === '1') {
5400					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
5401				}
5402				if (typeof MediaElement === "function") {
5403					$(justifiedObj).find('audio,video').each(function() {
5404						$(this).mediaelementplayer({
5405								pauseOtherPlayers: false,
5406						});
5407					});
5408				}
5409				if ($(justifiedObj).find('.nested-carousel').length) {
5410					if (typeof UNCODE.carousel !== 'undefined') {
5411						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
5412					}
5413					requestTimeout(function() {
5414						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
5415						justifiedObj.addClass('justified-gallery-finished')
5416						Waypoint.refreshAll();
5417					}, 200);
5418				} else {
5419					requestTimeout(function() {
5420						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
5421						justifiedObj.addClass('justified-gallery-finished')
5422						Waypoint.refreshAll();
5423					}, 300);
5424				}
5425			}, 100);
5426
5427		},
5428		boxAnimation = function(items, startIndex, sequential, container) {
5429			var $allItems = items.length - startIndex,
5430				showed = 0,
5431				index = 0;
5432			if (container.closest('.owl-item').length == 1) return false;
5433			$.each(items, function(index, val) {
5434				var elInner = $('> .t-inside', val);
5435				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5436					return;
5437				}
5438				if (val[0]) val = val[0];
5439				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
5440					new Waypoint({
5441						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5442						element: val,
5443						handler: function() {
5444							var element = $('> .t-inside', this.element),
5445								parent = $(this.element),
5446								currentIndex = parent.index();
5447							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
5448								delayAttr = parseInt(element.attr('data-delay'));
5449							if (isNaN(delayAttr)) delayAttr = 100;
5450							delay -= showed;
5451							var objTimeout = requestTimeout(function() {
5452								element.removeClass('zoom-reverse').addClass('start_animation');
5453								showed = parent.index();
5454							}, delay * delayAttr);
5455							parent.data('objTimeout', objTimeout);
5456							if (!UNCODE.isUnmodalOpen) {
5457								this.destroy();
5458							}
5459						},
5460						offset: '100%'
5461					})
5462				} else {
5463					elInner.removeClass('animate_when_almost_visible');
5464					$(val).addClass('no-waypoint-animation');
5465					/*if (elInner.hasClass('force-anim')) {
5466						elInner.addClass('start_animation');
5467					} else {
5468						elInner.css('opacity', 1);
5469					}*/
5470				}
5471				index++;
5472			});
5473		};
5474		$filters.on('click', 'a[data-filter]', function(evt) {
5475			var $filter = $(this),
5476				filterContainer = $filter.closest('.isotope-filters'),
5477				filterValue = $filter.attr('data-filter'),
5478				container = $filter.closest('.justified-system').find($('.justified-layout')),
5479				lastRow = container.data('last-row'),
5480				transitionDuration = 0,
5481				delay = 300,
5482				filterItems = [];
5483
5484			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
5485
5486			var filter_items = function(){
5487				if (filterValue !== undefined) {
5488					$.each($('> .tmb > .t-inside', container), function(index, val) {
5489						var parent = $(val).parent(),
5490							objTimeout = parent.data('objTimeout');
5491						if (objTimeout) {
5492							$(val).removeClass('zoom-reverse');
5493							clearRequestTimeout(objTimeout);
5494						}
5495						if (transitionDuration == 0) {
5496							if ($(val).hasClass('animate_when_almost_visible')) {
5497								$(val).addClass('zoom-reverse').removeClass('start_animation');
5498							} else {
5499								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
5500							}
5501						}
5502					});
5503
5504					requestTimeout(function() {
5505						var $block,
5506							selector,
5507							lightboxElements,
5508							$boxes;
5509
5510						if ( filterValue !== '' && filterValue !== '*' ) {
5511							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
5512							selector = '.' + filterValue;
5513							$.each($(selector, container), function(index, block) {
5514								lightboxElements = $('[data-lbox^=ilightbox]', block);
5515								if (lightboxElements.length) {
5516									lightboxElements.removeClass('lb-disabled');
5517									container.data('lbox', $(lightboxElements[0]).data('lbox'));
5518								}
5519								filterItems.push(block);
5520							});
5521							container.justifiedGallery({
5522								filter: selector,
5523								lastRow: 'nojustify'
5524							});
5525						} else {
5526							container.justifiedGallery({
5527								filter: false,
5528								lastRow: lastRow
5529							});
5530							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
5531							filterItems = $('> .tmb', container);
5532						}
5533						container.trigger('more-items-loaded');
5534
5535						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
5536						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
5537							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
5538							if (typeof getLightbox === 'object') {
5539								getLightbox.refresh();
5540							} else {
5541								UNCODE.lightbox();
5542							}
5543						}
5544
5545						if (transitionDuration == 0) {
5546							requestTimeout(function() {
5547								boxAnimation(filterItems, 0, false, container);
5548							}, 100);
5549						}
5550						requestTimeout(function() {
5551							Waypoint.refreshAll();
5552							container.trigger('more-items-loaded');
5553						}, 2000);
5554
5555					}, delay);
5556				} else {
5557					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
5558						$.each(UNCODE.lightboxArray, function(index, val) {
5559							UNCODE.lightboxArray[index].destroy();
5560						});
5561					}
5562					$.each($('> .tmb > .t-inside', container), function(index, val) {
5563						var parent = $(val).parent(),
5564							objTimeout = parent.data('objTimeout');
5565						if (objTimeout) {
5566							$(val).removeClass('zoom-reverse').removeClass('start_animation')
5567							clearRequestTimeout(objTimeout);
5568						}
5569						if (transitionDuration == 0) {
5570							if ($(val).hasClass('animate_when_almost_visible')) {
5571								$(val).addClass('zoom-reverse').removeClass('start_animation');
5572							} else {
5573								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
5574							}
5575						}
5576					});
5577					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
5578						UNCODE.lightbox();
5579					}
5580					container.parent().addClass('justified-loading');
5581					container.trigger('more-items-loaded');
5582				}
5583			};
5584
5585			if (!$filter.hasClass('active')) {
5586				/** Scroll top with filtering */
5587				if (filterContainer.hasClass('filter-scroll')) {
5588                    var calc_scroll = container.closest('.row-parent').offset().top;
5589                    calc_scroll -= UNCODE.get_scroll_offset();
5590
5591					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5592						delta = bodyTop - calc_scroll,
5593						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
5594						filterTolerance = false,
5595						filter_timeout;
5596					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
5597
5598					if ( !UNCODE.isFullPage ) {
5599						if (scrollSpeed == 0) {
5600							$('html, body').scrollTop(calc_scroll);
5601							UNCODE.scrolling = false;
5602							filter_items();
5603						} else {
5604
5605							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
5606								filter_items();
5607								filterTolerance = true;
5608							}
5609
5610							$('html, body').animate({
5611								scrollTop: calc_scroll
5612							},{
5613								easing: 'easeInOutQuad',
5614								duration: scrollSpeed,
5615								complete: function(){
5616									UNCODE.scrolling = false;
5617									if ( !filterTolerance ) {
5618										filter_timeout = setTimeout(function(){
5619											clearTimeout(filter_timeout);
5620											filter_items();
5621										}, 200);
5622									}
5623								}
5624							});
5625						}
5626					}
5627				} else {
5628					filter_items();
5629				}
5630			}
5631			evt.preventDefault();
5632		});
5633
5634		$filters.each(function(i, buttonGroup) {
5635			var $buttonGroup = $(buttonGroup);
5636			$buttonGroup.on('click', 'a', function() {
5637				$buttonGroup.find('.active').removeClass('active');
5638				$(this).addClass('active');
5639			});
5640
5641			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
5642				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
5643				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
5644			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
5645				e.preventDefault();
5646				$cats_filters.slideToggle(400, 'easeInOutCirc');
5647			});
5648		});
5649		window.addEventListener('boxResized', function(e) {
5650			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
5651				prevW = breakPointMe(UNCODE.wwidth);
5652				$.each($('.justified-layout'), function(index, val) {
5653					var gutter = $(this).data('gutter'),
5654						margins = gutterByBreakpoint( prevW, gutter);
5655					$(this).justifiedGallery({
5656						margins: margins
5657					});
5658					$(this).find('.mejs-video,.mejs-audio').each(function() {
5659						$(this).trigger('resize');
5660					});
5661				});
5662			}
5663		}, false);
5664
5665		init_justifiedGallery();
5666	};
5667};
5668
5669UNCODE.cssGrid = function() {
5670	if ($('.cssgrid-layout').length > 0) {
5671		var cssGridContainersArray = [];
5672		var transitionDuration = [];
5673		var $filters = $('.cssgrid-system .cssgrid-filters');
5674
5675		$('[class*="cssgrid-container"]').each(function() {
5676			cssGridContainersArray.push($(this));
5677			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
5678		});
5679
5680		var init_cssGridAjax = function() {
5681			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
5682				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
5683					cssGridId = cssGridSystem.attr('id');
5684
5685				cssGridSystem.data('transitionDuration', transitionDuration[i]);
5686
5687				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
5688					$(cssGridContainersArray[i]).infinitescroll({
5689						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
5690						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
5691						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat', // selector for all items you'll retrieve
5692						animate: false,
5693						behavior: 'local',
5694						debug: false,
5695						loading: {
5696							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
5697							speed: 0,
5698							finished: undefined,
5699							msg: $('#' + cssGridId + ' .loadmore-button'),
5700						},
5701						errorCallback: function() {
5702							var cssgrid_system = $(this).closest('.cssgrid-system');
5703							$('.loading-button', cssgrid_system).hide();
5704							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
5705						}
5706					},
5707					// append the new items to cssGrid on the infinitescroll callback function.
5708					function(newElements, opts) {
5709						var $cssGrid = $(this),
5710							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
5711							cssGridId = cssGridSystemCont.attr('id'),
5712							filters = new Array(),
5713							$loading_button = $cssGrid.closest('.cssgrid-system').find('.loading-button'),
5714							$infinite_button = $cssGrid.closest('.cssgrid-system').find('.loadmore-button'),
5715							$numPages = $('a', $infinite_button).data('pages'),
5716							delay = 300;
5717						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
5718						$infinite_button.show();
5719						$loading_button.hide();
5720						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
5721						$('> li', $cssGrid).remove();
5722						$.each($(newElements), function(index, val) {
5723							$(val).addClass('tmb-grid');
5724							if ($(val).is("li")) {
5725								filters.push($(val)[0]);
5726							}
5727						});
5728						newElements = newElements.filter(function(x) {
5729							return filters.indexOf(x) < 0
5730						});
5731						$.each($(filters), function(index, val) {
5732							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
5733						});
5734
5735						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
5736						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
5737						if (filterValue !== undefined && filterValue != '*') {
5738							$(newElements).hide();
5739							var els_to_show = $();
5740							$(newElements).each(function() {
5741								var el = $(this);
5742								if (el.hasClass(filterValue)) {
5743									els_to_show = els_to_show.add(el);
5744									el.show();
5745								}
5746							});
5747							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
5748						} else {
5749							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
5750						}
5751
5752						UNCODE.adaptive();
5753						if (SiteParameters.dynamic_srcset_active === '1') {
5754							UNCODE.refresh_dynamic_srcset_size($cssGrid);
5755						}
5756						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
5757							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
5758							if (typeof getLightbox === 'object') {
5759								getLightbox.refresh();
5760							} else {
5761								UNCODE.lightbox();
5762							}
5763						}
5764						if ( typeof twttr !== 'undefined' ) {
5765							twttr.widgets.load(cssGridContainersArray[i]);
5766						}
5767
5768						UNCODE.carousel($(newElements));
5769						requestTimeout(function() {
5770							$cssGrid.trigger('more-items-loaded');
5771						}, 1000);
5772
5773					});
5774					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
5775						var $cssgrid_el = $(cssGridContainersArray[i]),
5776							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
5777						$cssgrid_el.infinitescroll('pause');
5778						$infinite_button.on('click', function(event) {
5779							event.preventDefault();
5780							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
5781							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
5782							cssGridId = $cssgrid_system.attr('id');
5783							$(event.currentTarget).html(SiteParameters.loading);
5784							$cssgrid_el.infinitescroll('resume');
5785							$cssgrid_el.infinitescroll('retrieve');
5786							$cssgrid_el.infinitescroll('pause');
5787						});
5788					}
5789				}
5790			}
5791		};
5792
5793		init_cssGridAjax();
5794
5795		if ($('.cssgrid-pagination').length > 0) {
5796			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
5797				evt.preventDefault();
5798
5799                var container = $(this).closest('.cssgrid-system'),
5800                	calc_scroll = container.closest('.row-parent').offset().top;
5801
5802                calc_scroll -= UNCODE.get_scroll_offset();
5803
5804				var menu_container = $('.menu-sticky');
5805				var menu = menu_container.find('.menu-container');
5806
5807				if (menu_container.length > 0 && menu.length > 0) {
5808					calc_scroll = calc_scroll - menu.outerHeight();
5809				}
5810
5811				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5812					delta = bodyTop - calc_scroll,
5813					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
5814				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
5815
5816				if ( !UNCODE.isFullPage ) {
5817					if (scrollSpeed == 0) {
5818						$('html, body').scrollTop(calc_scroll);
5819					} else {
5820						$('html, body').animate({
5821							scrollTop: calc_scroll
5822						},{
5823							easing: 'easeInOutQuad',
5824							duration: scrollSpeed,
5825							complete: function(){
5826								UNCODE.scrolling = false;
5827							}
5828						});
5829					}
5830				}
5831
5832				loadCssGrid($(this), true);
5833				evt.preventDefault();
5834			});
5835		}
5836
5837		$filters.on('click', 'a.grid-nav-link', function(evt) {
5838			if ($(this).hasClass('no-grid-filter')) {
5839				return;
5840			}
5841			var $filter = $(this),
5842				filterContainer = $filter.closest('.cssgrid-filters'),
5843				filterValue = $filter.attr('data-filter'),
5844				containerSystem = $filter.closest('.cssgrid-system'),
5845				container = containerSystem.find($('.cssgrid-layout')),
5846				transitionDuration = containerSystem.data('transitionDuration'),
5847				delay = 300,
5848				filterItems = [],
5849				all_thumbs = container.find('.tmb-grid');
5850
5851			var filter_items = function(){
5852				if (filterValue !== undefined) {
5853					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
5854						var parent = $(val).parent(),
5855							objTimeout = parent.data('objTimeout');
5856						if (objTimeout) {
5857							$(val).removeClass('zoom-reverse').removeClass('start_animation')
5858							clearRequestTimeout(objTimeout);
5859						}
5860						if (transitionDuration == 0) {
5861							if ($(val).hasClass('animate_when_almost_visible')) {
5862								$(val).addClass('zoom-reverse').removeClass('start_animation');
5863							} else {
5864								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
5865							}
5866						}
5867					});
5868					requestTimeout(function(){
5869						if ( filterValue == '*' ) {
5870							all_thumbs.show();
5871							all_thumbs.each(function(index, val) {
5872								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
5873								filterItems.push($(this));
5874							});
5875						} else {
5876							all_thumbs.each(function() {
5877								var _tmb = $(this);
5878								if (_tmb.hasClass(filterValue)) {
5879									_tmb.show();
5880									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
5881									filterItems.push(_tmb);
5882								} else {
5883									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
5884									_tmb.hide();
5885								}
5886							});
5887						}
5888
5889						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
5890
5891						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
5892						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
5893						var lightboxElements = $('[data-lbox^=ilightbox]', container);
5894						if (lightboxElements.length) {
5895							container.data('lbox', $(lightboxElements[0]).data('lbox'));
5896							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
5897								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
5898								if (typeof getLightbox === 'object') {
5899									getLightbox.refresh();
5900								} else {
5901									UNCODE.lightbox();
5902								}
5903							}
5904						}
5905						container.trigger('more-items-loaded');
5906					}, delay);
5907				} else {
5908					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
5909						var parent = $(val).parent(),
5910							objTimeout = parent.data('objTimeout');
5911						if (objTimeout) {
5912							$(val).removeClass('zoom-reverse').removeClass('start_animation')
5913							clearRequestTimeout(objTimeout);
5914						}
5915						if (transitionDuration == 0) {
5916							if ($(val).hasClass('animate_when_almost_visible')) {
5917								$(val).addClass('zoom-reverse').removeClass('start_animation');
5918							} else {
5919								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
5920							}
5921						}
5922					});
5923					loadCssGrid($filter);
5924				}
5925			};
5926
5927			if (!$filter.hasClass('active')) {
5928				/** Scroll top with filtering */
5929				if (filterContainer.hasClass('filter-scroll')) {
5930                    var calc_scroll = container.closest('.row-parent').offset().top;
5931                    calc_scroll -= UNCODE.get_scroll_offset();
5932
5933					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5934						delta = bodyTop - calc_scroll,
5935						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
5936						filterTolerance = false,
5937						filter_timeout;
5938					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
5939
5940					if ( !UNCODE.isFullPage ) {
5941						if (scrollSpeed == 0) {
5942							$('html, body').scrollTop(calc_scroll);
5943							UNCODE.scrolling = false;
5944							filter_items();
5945						} else {
5946
5947							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
5948								filter_items();
5949								filterTolerance = true;
5950							}
5951
5952							$('html, body').animate({
5953								scrollTop: calc_scroll
5954							},{
5955								easing: 'easeInOutQuad',
5956								duration: scrollSpeed,
5957								complete: function(){
5958									UNCODE.scrolling = false;
5959									if ( !filterTolerance ) {
5960										filter_timeout = setTimeout(function(){
5961											clearTimeout(filter_timeout);
5962											filter_items();
5963										}, 200);
5964									}
5965								}
5966							});
5967						}
5968					}
5969				} else {
5970					filter_items();
5971				}
5972			}
5973			evt.preventDefault();
5974		});
5975
5976		$(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) {
5977			var params = UNCODE.getURLParams(window.location);
5978			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
5979
5980			UNCODE.lastURL = window.location.href;
5981
5982			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
5983				return;
5984			}
5985
5986			if (params.id === undefined) {
5987				$.each($('.cssgrid-system'), function(index, val) {
5988					loadCssGrid($(val));
5989				});
5990			} else {
5991				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
5992					loadCssGrid($('#' + params.id));
5993				}
5994			}
5995		});
5996
5997		var loadCssGrid = function($href, $paginating) {
5998			var is_paginating = false;
5999
6000			if (undefined !== $paginating && $paginating) {
6001				var is_paginating = $paginating;
6002			}
6003
6004			var href = ($href.is("a") ? $href.attr('href') : location),
6005				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
6006				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
6007				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
6008				cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')),
6009				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
6010				cssgridId = cssgridSystem.attr('id');
6011			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
6012				UNCODE.lastURL = href;
6013				history.pushState({
6014					myCSSgrid: true
6015				}, document.title, href);
6016			}
6017			cssgridWrapper.addClass('cssgrid-loading');
6018			if (is_paginating) {
6019				cssgridWrapper.addClass('grid-filtering');
6020			}
6021			$.ajax({
6022				url: href
6023			}).done(function(data) {
6024				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
6025					$resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0],
6026					$resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0];
6027				requestTimeout(function() {
6028					cssgridContainer.html($resultItems);
6029					cssgridWrapper.removeClass('cssgrid-loading');
6030					cssgridWrapper.removeClass('grid-filtering');
6031					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
6032					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false);
6033					UNCODE.adaptive();
6034					if (SiteParameters.dynamic_srcset_active === '1') {
6035						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
6036					}
6037					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6038						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
6039						if (typeof getLightbox === 'object') {
6040							getLightbox.refresh();
6041						} else {
6042							UNCODE.lightbox();
6043						}
6044					}
6045					cssgridContainer.trigger('more-items-loaded');
6046				}, 300);
6047
6048				$('.pagination', cssgridFooter).remove();
6049				cssgridFooter.append($resultPagination);
6050
6051				if (cssgridResultCount.length > 0) {
6052					$('.woocommerce-result-count', cssgridResultCount).remove();
6053					cssgridResultCount.append($resultCount);
6054				}
6055			});
6056		};
6057
6058		$filters.each(function(i, buttonGroup) {
6059			var $buttonGroup = $(buttonGroup);
6060			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
6061				$buttonGroup.find('.active').removeClass('active');
6062				$(this).addClass('active');
6063
6064			});
6065
6066			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
6067				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
6068				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
6069			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
6070				e.preventDefault();
6071				$cats_filters.slideToggle(400, 'easeInOutCirc');
6072			});
6073
6074		});
6075	};
6076};
6077
6078UNCODE.preventDoubleTransition = function() {
6079	$('.sticky-element .animate_when_almost_visible').each(function(){
6080		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
6081			$el.addClass('do_not_reanimate');
6082		});
6083	});
6084};
6085
6086UNCODE.checkScrollForTabs = function(){
6087	var goToSection = window.location.hash.replace('#', ''),
6088		$index;
6089
6090	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
6091	goToSection = encodeURIComponent(goToSection);
6092	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
6093
6094	$index.attr('data-parent', 'parent-' + goToSection);
6095
6096	if (window.location.hash != undefined && window.location.hash != '') {
6097		requestTimeout(function() {
6098			scrollBody('parent-' + goToSection);
6099		}, 500);
6100	}
6101
6102	$('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
6103		var hash = (e.currentTarget).hash,
6104			index = (e.currentTarget).closest('.uncode-tabs');
6105		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
6106			$('a[href="' + hash + '"][data-tab-history]').click();
6107			scrollBody(index);
6108		}
6109	});
6110
6111	var scrollBody = function(index) {
6112
6113		var getSection = $('a[href="' + index + '"][data-tab-history]'),
6114			scrollTo,
6115			safeGap = 27;
6116
6117		if ( ! getSection.length ) {
6118			getSection = $('div[data-parent="' + index + '"]');
6119
6120			if ( getSection.attr('data-target') == 'row' ) {
6121				getSection = getSection.closest('.vc_row');
6122				safeGap = 0;
6123			}
6124		}
6125
6126		if (typeof getSection === 'undefined' || ! getSection.length ) {
6127			return;
6128		}
6129
6130		var body = $("html, body"),
6131		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6132		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
6133		getOffset = UNCODE.get_scroll_offset();
6134		if ( typeof getSection.offset() === 'undefined' )
6135			return;
6136		scrollTo = getSection.offset().top - safeGap;
6137		scrollTo -= getOffset;
6138
6139		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
6140		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6141
6142		if (index != 0) {
6143			UNCODE.scrolling = true;
6144		}
6145
6146		if (scrollSpeed == 0) {
6147			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
6148			UNCODE.scrolling = false;
6149		} else {
6150			body.animate({
6151				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
6152			}, scrollSpeed, 'easeInOutQuad', function() {
6153				requestTimeout(function() {
6154					UNCODE.scrolling = false;
6155					if (getOffset != UNCODE.get_scroll_offset()) {
6156						scrollBody(index);
6157					}
6158				}, 100);
6159			});
6160		}
6161
6162	};
6163};
6164
6165UNCODE.printScreen = function() {
6166	var inlineMediaStyle = null,
6167		setResize;
6168
6169    function changeMediaStyle() {
6170		clearRequestTimeout(setResize);
6171		setResize = requestTimeout(function(){
6172	        var $head = document.getElementsByTagName('head')[0],
6173	        	$newStyle = document.createElement('style'),
6174	        	winW = window.innerWidth,
6175	        	printH = window.innerHeight;
6176
6177	        $newStyle.setAttribute('type', 'text/css');
6178	        $newStyle.setAttribute('media', 'print');
6179	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
6180
6181	        if (inlineMediaStyle != null) {
6182	            $head.replaceChild($newStyle, inlineMediaStyle)
6183	        } else {
6184	            $head.appendChild($newStyle);
6185	        }
6186	        inlineMediaStyle = $newStyle;
6187	    }, 1000);
6188    }
6189
6190    changeMediaStyle();
6191    window.addEventListener('resize', changeMediaStyle);
6192};
6193
6194UNCODE.fullPage = function() {
6195	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
6196		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
6197		return false;
6198	} else {
6199		requestTimeout(function() {
6200			window.scrollTo(0, 0);
6201		}, 10);
6202	}
6203
6204	var $masthead = $('#masthead'),
6205		$logo = $('#logo-container-mobile'),
6206		$logolink = $('[data-minheight]', $logo),
6207		logoMinScale = $logolink.data('minheight'),
6208		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
6209		$mainWrapper = $('.main-wrapper')[0],
6210		$container = $('.main-container .post-content'),
6211		$mobileMenuWrapper = $('.menu-wrapper'),
6212		mobMenuPos,
6213		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
6214		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
6215		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
6216		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
6217		headerWithOpacity = $('.header-scroll-opacity', $header).length,
6218		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
6219		menuHeight = $masthead.hasClass('menu-transparent') || menuHidden ? 0 : UNCODE.menuHeight,
6220		footerAdd = ( $('body').hasClass('hmenu') && $('body').hasClass('uncode-fp-menu-shrink') && !$masthead.hasClass('menu-transparent') ) ? -18 : 0,
6221		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
6222		$scrollTop = $('.scroll-top'),
6223		scrollBar = true,
6224		effect,
6225		animationEndTimeOut,
6226		fp_anim_time = 900,
6227		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
6228		is_scrolling = false,
6229		dataNames = [],
6230		is_first = true,
6231		no_history = $('body').hasClass('uncode-scroll-no-history'),
6232		theres_footer = true;
6233
6234	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
6235		$('> div', $footer).each(function(index, el){
6236			if ( $(el).outerHeight() < 2 )
6237				theres_footer = false;
6238			else
6239				theres_footer = true;
6240		});
6241	}
6242
6243	if ( !$footer.length )
6244		theres_footer = false;
6245
6246	if ( !UNCODE.isFullPageSnap ) {
6247		/*if ( theres_footer )
6248			$footer.css({ marginTop: ( menuHeight + footerAdd + UNCODE.bodyBorder ) * -1 })*/
6249
6250		if ( $('body').hasClass('uncode-fullpage-zoom') )
6251			effect = 'scaleDown';
6252		else if ( $('body').hasClass('uncode-fullpage-parallax') )
6253			effect = 'moveparallax';
6254		else
6255			effect = 'movecurtain';
6256	}
6257
6258	if ( $('body').hasClass('uncode-fullpage-trid') )
6259		fp_anim_time = fp_anim_time*2;
6260
6261	if ( $header.length ) {
6262		if ( headerName !== '' )
6263			$header.attr('data-name', headerName);
6264		if ( headerLabel !== '' )
6265			$header.attr('data-label', headerLabel);
6266		$container.prepend($header);
6267	}
6268	if ( theres_footer ) {
6269		$container.append($footer);
6270		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
6271		$('aside.widget ul', $footer).addClass('no-list');
6272	}
6273
6274	var $all = $rows.add($header);
6275
6276	if ( theres_footer )
6277		$all = $all.add($footer);
6278
6279	$all.each(function(index, row) {
6280		if( index === 0 )
6281			$(row).addClass('uncode-scroll-active');
6282	});
6283
6284	if ( !UNCODE.isMobile && !$('body').hasClass('uncode-scroll-no-dots') )
6285		$("<ul class='onepage-pagination'></ul>").prependTo("body");
6286
6287	$all.each(function(index, val) {
6288		var getName = $(val).data('name'),
6289			label;
6290
6291		if (typeof getName == 'undefined' || getName == 'undefined')
6292			getName = SiteParameters.slide_name + '-' + index;
6293
6294		//if ( dataNames.includes(getName) ) {
6295		if ( dataNames.indexOf(getName) > 0 ) {
6296			getName += '_' + index;
6297			$(val).data('name', getName);
6298		}
6299
6300		dataNames.push(getName);
6301
6302		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
6303
6304		if (typeof $(val).attr('data-label') !== 'undefined')
6305			label = $(val).attr('data-label');
6306		else label = '';
6307
6308		if ( $(val).is($footer) )
6309			return;
6310
6311		if (label != '' ) {
6312			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
6313			$('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>");
6314		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
6315			$('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>");
6316		}
6317	});
6318
6319	var checkVisible = function( el, off ) {
6320		if (typeof jQuery === "function" && el instanceof jQuery) {
6321			el = el[0];
6322		}
6323
6324		off = typeof off=='undefined' ? 50 : off;
6325
6326		var rect = el.getBoundingClientRect();
6327
6328		return (
6329			(
6330				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
6331				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
6332				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
6333			)
6334		);
6335	};
6336
6337	var animationEndAction = function( index, nextIndex ) {
6338		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
6339			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
6340			player, iframe;
6341
6342		if ( !$nextSlide.is($footer) ) {
6343			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
6344		}
6345
6346		if ( !UNCODE.isFullPageSnap ) {
6347			activateKBurns( nextIndex );
6348		}
6349
6350		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
6351			if ($(this).attr('data-provider') == 'vimeo') {
6352				iframe = $(this).find('iframe');
6353				player = new Vimeo.Player(iframe[0]);
6354				player.pause();
6355			} else if ($(this).attr('data-provider') == 'youtube') {
6356				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
6357			} else {
6358				if ($(this).is('video')) {
6359					$(this)[0].volume = 0;
6360					$(this)[0].pause();
6361				}
6362			}
6363		});
6364
6365		if ( ! UNCODE.isMobile && headerWithOpacity ) {
6366			if ( $nextSlide.is($header) )
6367				$header.removeClass('header-scrolled');
6368		}
6369
6370		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
6371		$otherEl.each(function(){
6372			var $otherThis = $(this),
6373				$bgwrapperOther = $('.background-inner', $otherThis);
6374			if ( !checkVisible($otherThis) )
6375				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
6376
6377		});
6378
6379		if ( !checkVisible($currentSlide) ) {
6380			$currentSlide.removeClass('uncode-scroll-visible');
6381			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
6382			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
6383				currentScroll.scrollTo(0, 0, 0);
6384		}
6385
6386		clearRequestTimeout(animationEndTimeOut);
6387		animationEndTimeOut = requestTimeout(function(){
6388			Waypoint.refreshAll();
6389			$( document.body ).trigger('uncode_waypoints');
6390			var eventFP = new CustomEvent('fp-slide-changed');
6391			window.dispatchEvent(eventFP);
6392			is_scrolling = false;
6393
6394			if ( is_first ) {
6395				$('ul.onepage-pagination a').removeClass('is-selected');
6396				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
6397				is_first = false;
6398			}
6399
6400		}, 500);
6401	};
6402
6403	var postLeaveActions = function( nextIndex ){
6404		if ( menuHidden && ! UNCODE.isMobile )
6405			return false;
6406
6407		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
6408			$cols = $('.uncol', $el),
6409			anchor = $el.data('anchor');
6410
6411		if ( ! UNCODE.isFullPageSnap ) {
6412			$.each($cols, function(index, val){
6413				if ( $(val).hasClass('style-light') ){
6414					$masthead.removeClass('style-dark-override').addClass('style-light-override');
6415					return false;
6416				} else if ( $(val).hasClass('style-dark') ) {
6417					$masthead.removeClass('style-light-override').addClass('style-dark-override');
6418					return false;
6419				}
6420			});
6421		}
6422
6423		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
6424			$('.menu-item' ).removeClass('active');
6425			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
6426		}
6427
6428		if ( !UNCODE.isFullPageSnap ) {
6429			activateBackWash( nextIndex );
6430		}
6431	};
6432
6433	var activateBackWash = function( nextIndex ){
6434		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
6435			$bgwrapper;
6436
6437		if ( $el.length ) {
6438			if ( $el.hasClass('with-zoomout') ) {
6439				$bgwrapper = $('.background-inner:nth-child(1)', $el);
6440			} else if ( $('.with-zoomout', $el).length ) {
6441				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
6442			} else {
6443				return false;
6444			}
6445		} else {
6446			return false;
6447		}
6448
6449		$bgwrapper.addClass('uncode-zoomout');
6450
6451	};
6452
6453	var activateKBurns = function( nextIndex ){
6454		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
6455			$bgwrapper;
6456
6457		if ( $el.length ) {
6458			if ( $el.hasClass('with-kburns') ) {
6459				$bgwrapper = $('.background-inner:nth-child(1)', $el);
6460			} else if ( $('.with-kburns', $el).length ) {
6461				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
6462			} else {
6463				return false;
6464			}
6465		} else {
6466			return false;
6467		}
6468
6469		$bgwrapper.addClass('uncode-kburns');
6470
6471	};
6472
6473	var activateParallax = function( nextIndex, direction ){
6474
6475		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
6476			$cell = $('.fp-tableCell', $el),
6477			animationEnd = 'webkitAnimationEnd animationend',
6478			cellAnim;
6479
6480		switch( direction ) {
6481			case 'up':
6482				cellAnim = 'moveFromTopInner';
6483				break;
6484			default:
6485				cellAnim = 'moveFromBottomInner';
6486		}
6487
6488		$cell.css({
6489			'animation-name': cellAnim,
6490			'animation-duration': fp_anim_time + 'ms',
6491			'animation-delay': '',
6492			'animation-timing-function': fp_easing,
6493			'animation-fill-mode': 'both',
6494		}).off(animationEnd)
6495		.on(animationEnd, function(event) {
6496			if ( event.originalEvent.animationName === cellAnim ) {
6497				$cell
6498					.css({
6499						'animation-name': '',
6500						'animation-duration': '',
6501						'animation-delay': '',
6502						'animation-timing-function': '',
6503						'animation-fill-mode': '',
6504					});
6505			}
6506		});
6507	};
6508
6509	var scrollHashes = function(){
6510		var hash = window.location.hash.replace('#', '').split('/'),
6511			hashInd;
6512		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
6513			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
6514				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
6515				$.fn.fullpage.moveTo(hashInd+1);
6516			}
6517		} else if( hash[0] === '' ) {
6518			$.fn.fullpage.moveTo(1);
6519		}
6520	};
6521
6522	var hideMenu = function( index, nextIndex ){
6523		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
6524			return false;
6525
6526		var hMenu = UNCODE.menuHeight,
6527			transTime = hMenu * 2;
6528
6529		if ( index === 1 && nextIndex > 1 ) {
6530			hMenu = hMenu * -1;
6531		} else if  ( index !== 1 && nextIndex === 1 ) {
6532			hMenu = 0;
6533		} else {
6534			return false;
6535		}
6536
6537		$masthead.css({
6538			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
6539			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
6540			'-webkit-transition': 'transform 0.5s ease-in-out',
6541			'transition': 'transform 0.5s ease-in-out'
6542		});
6543	};
6544
6545	var shrinkMenu = function( index, nextIndex ){
6546		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
6547			return false;
6548
6549		if ( index === 1 && nextIndex > 1 ) {
6550			$logo.addClass('shrinked');
6551			$('div', $logo).each(function(index, val){
6552				$(val).css({
6553					'height': logoMinScale,
6554					'line-height': logoMinScale
6555				});
6556				if ($(val).hasClass('text-logo')) {
6557					$(val).css({
6558						'font-size': logoMinScale + 'px'
6559					});
6560				}
6561			});
6562			requestTimeout(function() {
6563				UNCODE.menuMobileHeight = $masthead.outerHeight();
6564			}, 300);
6565		} else if ( index !== 1 && nextIndex === 1 ) {
6566			$logo.removeClass('shrinked');
6567			$('div', $logo).each(function(index, val){
6568				$(val).css({
6569					'height': logoMaxScale,
6570					'line-height': logoMaxScale
6571				});
6572				if ($(val).hasClass('text-logo')) {
6573					$(val).css({
6574						'font-size': logoMaxScale + 'px'
6575					});
6576				}
6577			});
6578			requestTimeout(function() {
6579				UNCODE.menuMobileHeight = $masthead.outerHeight();
6580			}, 300);
6581		} else {
6582			return false;
6583		}
6584
6585	};
6586
6587	var anchorLink = function(){
6588
6589		$container.add('.menu-item').find('a[href*="#"]').click(function(e) {
6590			var $this = $(e.currentTarget),
6591				hash = e.currentTarget.href.split('#'),
6592				current = window.location.href.split('#'),
6593				ind,
6594				currentMenuOpened = UNCODE.menuOpened,
6595				go = false;
6596
6597			var hash_url = hash[0].replace(/\/?$/, '/'),
6598				current_url = current[0].replace(/\/?$/, '/');
6599
6600			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
6601				hash = '#'+hash[1];
6602				e.preventDefault();
6603				go = true;
6604			}
6605
6606			if ( go ) {
6607
6608				if ( $(hash).length ) {
6609					ind = $(hash).closest('.fp-section').index();
6610				} else {
6611					hash = hash.slice(1);
6612					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
6613				}
6614
6615				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
6616					ind = $this.closest('.fp-section').index();
6617
6618				UNCODE.menuOpened = false;
6619
6620				$.fn.fullpage.moveTo(ind+1);
6621
6622				UNCODE.menuOpened = currentMenuOpened;
6623				if (UNCODE.menuOpened) {
6624					if (UNCODE.wwidth < UNCODE.mediaQuery) {
6625						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
6626					} else {
6627						$('.mmb-container-overlay .overlay-close').trigger('click');
6628						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
6629					}
6630				}
6631
6632			}
6633
6634		});
6635
6636		$('.header-scrolldown').on('click', function(event) {
6637			event.preventDefault();
6638			var scrollDown = $(this),
6639				ind = scrollDown.closest('.fp-section').index();
6640
6641			$.fn.fullpage.moveTo(ind+2);
6642		});
6643
6644		var anchor = $('.fp-section.active').data('anchor');
6645
6646		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
6647			$('.menu-item').removeClass('active');
6648			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
6649		}
6650
6651	};
6652
6653	var slideLeave = function( index, nextIndex, direction ) {
6654		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
6655			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
6656			animationEnd = 'webkitAnimationEnd animationend',
6657			transitionEnd = 'webkitTransitionEnd transitionend',
6658			animOut = effect != 'scaleDown' ? effect + direction : effect,
6659			animIn,
6660			animInDelay = effect == 'scaleDown' ? 0 : 0,
6661			isFooter = false,
6662			isFooterNext = false,
6663			isHeader = false,
6664			isHeaderNext = false,
6665			containerOff = $container.offset().top,
6666			footerH = $footer.outerHeight(),
6667			timeout,
6668			dataHash = $nextSlide.attr('data-anchor'),
6669			player, iframe,
6670			footerCoeff;
6671		switch( direction ) {
6672			case 'up':
6673				animIn = 'moveFromTop';
6674				break;
6675			default:
6676				animIn = 'moveFromBottom';
6677		}
6678
6679		if ( $('body').hasClass('uncode-fullpage-trid') ) {
6680			animOut = animIn + 'trid';
6681			animIn = animOut + 'In';
6682		} else if ( UNCODE.isFullPageSnap ) {
6683			animIn = animOut = 'none';
6684		}
6685
6686		hideMenu(index, nextIndex);
6687		shrinkMenu(index, nextIndex);
6688
6689		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
6690			if ($(this).attr('data-provider') == 'vimeo') {
6691				iframe = $(this).find('iframe');
6692				player = new Vimeo.Player(iframe[0]);
6693				player.pause();
6694			} else if ($(this).attr('data-provider') == 'youtube') {
6695				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
6696			} else {
6697				if ($(this).is('video')) {
6698					$(this)[0].volume = 0;
6699					$(this)[0].pause();
6700				}
6701			}
6702		});
6703
6704		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
6705			if ($(this).attr('data-provider') == 'vimeo') {
6706				iframe = $(this).find('iframe');
6707				iframe.on('load', function(){
6708					player = new Vimeo.Player(iframe);
6709					player.setVolume(0);
6710					player.play();
6711				});
6712				player = new Vimeo.Player(iframe);
6713				player.setVolume(0);
6714				player.play();
6715			} else if ($(this).attr('data-provider') == 'youtube') {
6716				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
6717			} else {
6718				if ($(this).is('video')) {
6719					$(this)[0].volume = 0;
6720					$(this)[0].play();
6721				}
6722			}
6723		});
6724
6725		if ( $currentSlide.is($footer) )
6726			isFooter = true;
6727
6728		if ( $nextSlide.is($footer) )
6729			isFooterNext = true;
6730
6731		// if ( typeof dataHash && dataHash && !no_history && dataHash != SiteParameters.slide_footer )
6732		// 	window.location.hash = '#' + dataHash;
6733
6734		if ( ! UNCODE.isMobile && headerWithOpacity ) {
6735			if ( $currentSlide.is($header) )
6736				$header.addClass('header-scrolled');
6737		}
6738
6739		footerCoeff = footerH;
6740
6741		if ( UNCODE.isFullPageSnap ) {
6742			postLeaveActions( nextIndex );
6743			activateBackWash( nextIndex );
6744			activateKBurns( nextIndex );
6745			requestTimeout(function(){
6746				animationEndAction( index, nextIndex );
6747			}, fp_anim_time+150);
6748		} else {
6749			if ( isFooterNext ) {
6750
6751				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
6752				$iscrollWrapper.addClass('no-scrolloverflow');
6753
6754				$nextSlide
6755				.add($currentSlide)
6756				.addClass('uncode-scroll-front')
6757				.addClass('uncode-scroll-active')
6758				.addClass('uncode-scroll-visible');
6759				$container.css({
6760					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
6761					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
6762					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
6763					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
6764				}).off(transitionEnd)
6765				.one(transitionEnd, function(){
6766					animationEndAction( index, nextIndex );
6767				});
6768
6769			} else if ( isFooter ) {
6770
6771				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
6772				.add($currentSlide)
6773				.addClass('uncode-scroll-front')
6774				.addClass('uncode-scroll-active')
6775				.addClass('uncode-scroll-visible');
6776				$container.css({
6777					'-webkit-transform': 'translate3d(0, 0, 0)',
6778					'transform': 'translate3d(0, 0, 0)',
6779					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
6780					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
6781				})
6782				.one(transitionEnd, function(){
6783					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
6784						clearRequestTimeout(timeout);
6785						timeout = requestTimeout(function(){
6786							$.fn.fullpage.moveTo(nextIndex);
6787							slideLeave( index-1, nextIndex, 'up' );
6788							$container.off(transitionEnd);
6789						}, 50);
6790					}
6791					animationEndAction( index, nextIndex );
6792				});
6793
6794			} else {
6795
6796				postLeaveActions( nextIndex );
6797
6798				if ( !$('body').hasClass('uncode-fullpage-trid') )
6799					activateParallax( nextIndex, direction );
6800
6801				var $outBg = $('.background-wrapper', $currentSlide);
6802
6803				$nextSlide
6804				.addClass('uncode-scroll-front')
6805				.addClass('uncode-scroll-active')
6806				.addClass('uncode-scroll-visible')
6807				.addClass('uncode-scroll-animating-in')
6808				.css({
6809					'z-index':4,
6810					'animation-name': animIn,
6811					'animation-duration': fp_anim_time + 'ms',
6812					'animation-delay': '',
6813					'animation-timing-function': fp_easing,
6814					'animation-fill-mode': 'both',
6815					'transition': 'initial',
6816				}).off(animationEnd)
6817				.on(animationEnd, function(event) {
6818					if ( event.originalEvent.animationName === animIn ) {
6819						$(this)
6820							.addClass('uncode-scroll-already')
6821							.removeClass('uncode-scroll-front')
6822							.removeClass('uncode-scroll-animating-in')
6823							.css({
6824								'animation-name': '',
6825								'animation-duration': '',
6826								'animation-delay': '',
6827								'animation-timing-function': '',
6828								'animation-fill-mode': '',
6829								'transition': 'initial',
6830							});
6831
6832						$currentSlide
6833							.removeClass('uncode-scroll-active')
6834							.add($outBg)
6835							.css({
6836								'animation-name': '',
6837								'animation-duration': '',
6838								'animation-delay': '',
6839								'animation-timing-function': '',
6840								'animation-fill-mode': '',
6841								'transition': 'initial',
6842							});
6843
6844						animationEndAction( index, nextIndex );
6845
6846					}
6847
6848					if ( nextIndex > 1 )
6849						$('body').addClass('window-scrolled');
6850					else
6851						$('body').removeClass('window-scrolled');
6852				});
6853
6854				$currentSlide
6855					.addClass('uncode-scroll-animating-out')
6856					.removeClass('uncode-scroll-front')
6857					.css({
6858						'z-index':'1',
6859						'animation-name': animOut,
6860						'animation-duration': fp_anim_time + 'ms',
6861						'animation-delay': '',
6862						'animation-timing-function': fp_easing,
6863						'animation-fill-mode': 'both',
6864						'transition': 'initial',
6865						'will-change': 'auto'
6866					}).off(animationEnd)
6867					.on(animationEnd, function(event) {
6868						if ( event.originalEvent.animationName === animOut ) {
6869							$currentSlide.removeClass('uncode-scroll-animating-out');
6870						}
6871					});
6872
6873				if ( $('body').hasClass('uncode-fp-opacity') ) {
6874					$currentSlide.find('> div').css({
6875						'animation-name': 'opacityout',
6876						'animation-duration': fp_anim_time + 'ms',
6877						'animation-delay': '',
6878						'animation-timing-function': fp_easing,
6879						'animation-fill-mode': 'both',
6880						'transition': 'initial',
6881					}).off(animationEnd)
6882					.on(animationEnd, function(event) {
6883						if ( event.originalEvent.animationName === 'opacityout' ) {
6884							$(event.currentTarget).css({
6885								'animation-name': '',
6886								'animation-duration': '',
6887								'animation-delay': '',
6888								'animation-timing-function': '',
6889								'animation-fill-mode': '',
6890								'transition': '',
6891							});
6892						}
6893					});
6894				}
6895			}
6896		}
6897
6898		$('.scroll-top').on('click', function(e){
6899			$.fn.fullpage.moveTo(1);
6900			return false;
6901		});
6902
6903	};
6904
6905	var init_fullPage = function(mode){
6906
6907		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
6908		// 	scrollBar = false;
6909		// }
6910
6911		var checkFPeffects;
6912
6913		$container.fullpage({
6914			sectionSelector: '.uncode-scroll-lock',
6915			scrollOverflow: true,
6916			scrollOverflowOptions: {
6917				click: false,
6918				preventDefaultException: { tagName:/.*/ }
6919			},
6920			navigation: false,
6921			scrollBar: scrollBar,
6922			scrollingSpeed: fp_anim_time,
6923			verticalCentered: true,
6924			anchors: no_history ? false : dataNames,
6925			recordHistory: !no_history,
6926			afterRender: function(){
6927				$('body').removeClass('fp-waiting');
6928				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
6929					var $invisible = $(this).addClass('hidden-scroll');//,
6930				});
6931				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
6932					var $visible = $(this).addClass('uncode-scroll-visible'),
6933						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
6934					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
6935				});
6936
6937				$('ul.onepage-pagination a').on('click', function(e){
6938					e.preventDefault();
6939					var $a = $(this),
6940						toIndex = $a.data('index');
6941
6942					$.fn.fullpage.moveTo(toIndex+1);
6943				});
6944
6945				requestTimeout(function(){
6946					scrollHashes();
6947				}, 1000);
6948
6949				$(window).on('hashchange', function(e){
6950					requestTimeout(function(){
6951						scrollHashes();
6952					}, 500);
6953				});
6954
6955				anchorLink();
6956
6957				if ( $('body').hasClass('uncode-fp-opacity') ) {
6958					$all.each(function(index, row) {
6959						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
6960							classBg;
6961
6962						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
6963							classBg = testmatch[0];
6964							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
6965						}
6966					});
6967				}
6968
6969				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
6970					$(window).on('menuOpen gdprOpen', function(){
6971						$.fn.fullpage.setAutoScrolling(false);
6972					}).on('menuClose gdprClose', function(){
6973						$.fn.fullpage.setAutoScrolling(true);
6974					});
6975				}
6976
6977				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
6978					requestTimeout(function(){
6979						$.fn.fullpage.setAutoScrolling(false);
6980					}, 1000);
6981				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
6982					$.fn.fullpage.setAutoScrolling(true);
6983				});
6984
6985				if ( !UNCODE.isFullPageSnap ) {
6986					clearRequestTimeout(checkFPeffects);
6987					checkFPeffects = requestTimeout(function(){
6988						activateBackWash( 1 );
6989						activateKBurns( 1 );
6990					}, 100);
6991				}
6992
6993			},
6994			onLeave: function( index, nextIndex, direction ){
6995
6996				if ( UNCODE.menuOpened || is_scrolling )
6997					return false;
6998
6999				is_scrolling = true;
7000
7001				var event = new CustomEvent('fp-slide-leave');
7002				window.dispatchEvent(event);
7003
7004				slideLeave( index, nextIndex, direction );
7005
7006				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
7007					if ( direction === 'up' ) {
7008						$.fn.fullpage.moveTo(nextIndex-1);
7009					} else {
7010						$.fn.fullpage.moveTo(nextIndex+1);
7011					}
7012					return false;
7013				}
7014
7015				$('ul.onepage-pagination a').removeClass('is-selected');
7016				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
7017
7018			}
7019		});
7020	};
7021
7022	init_fullPage();
7023	$(window).on('load', function(){
7024		requestTimeout(function(){
7025			$.fn.fullpage.reBuild();
7026		}, 3000);
7027	});
7028
7029	var addScrollingClass,
7030		removeScrollingClass;
7031
7032	window.addEventListener("fp-slide-scroll", function(){
7033		addScrollingClass = requestTimeout( function(){
7034			$('body').addClass('fp-slide-scrolling');
7035		}, 10 );
7036
7037		clearRequestTimeout(removeScrollingClass);
7038		removeScrollingClass = requestTimeout( function(){
7039			$('body').removeClass('fp-slide-scrolling');
7040		}, 150 );
7041
7042		Waypoint.refreshAll();
7043	}, false);
7044
7045	var setFPheight = function(){
7046		var $body = document.body,
7047			$footer = document.getElementById('colophon'),
7048			$maincontainer = document.querySelector('.main-wrapper'),
7049			$boxcontainer = document.querySelector('.box-container'),
7050			rect = $maincontainer.getBoundingClientRect(),
7051			rect2 = $boxcontainer.getBoundingClientRect();
7052		$body.style.height = UNCODE.wheight + 'px';
7053		if ( theres_footer )
7054			$footer.style.top = (rect.height || rect2.height) + 'px';
7055	};
7056
7057	setFPheight();
7058
7059	window.addEventListener('resize', setFPheight, false);
7060	window.addEventListener('orientationchange', setFPheight, false);
7061
7062};
7063
7064UNCODE.particles = function() {
7065	$(".vc-particles-background").each(function() {
7066		var $particle = $(this);
7067		var $parent = $particle.closest('[data-parent]');
7068
7069		$parent.prepend($particle);
7070		// $(window).trigger('resize');
7071	})
7072};
7073
7074
7075UNCODE.filters = function() {
7076	var $systems = $('.isotope-system, .cssgrid-system');
7077
7078	$systems.each(function(index, val){
7079		var $system = $(this),
7080			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system),
7081			$widgets = $('.widgetized-cb-wrapper', $system),
7082			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $system),
7083			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system),
7084			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system),
7085			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system);
7086
7087		if ($system.hasClass('isotope-processed')) {
7088			return;
7089		}
7090
7091		$cats_trigger.on('click', function(e) {
7092			if ( ! $('html').hasClass('screen-sm') ) {
7093				// $widgets.add($sorting_dd).slideUp(400);
7094				e.preventDefault();
7095				$widgets.slideUp(400, 'easeInOutCirc');
7096			}
7097		});
7098
7099		$('.filters-toggle-trigger', $system).on('click', function(e) {
7100			e.preventDefault();
7101			var $filters = $('.isotope-filters .menu-horizontal', $system);
7102			$filters.slideToggle(400, 'easeInOutCirc');
7103			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
7104		});
7105
7106		$widget_trgr.on('click', function(e) {
7107			e.preventDefault();
7108			$widgets.slideToggle(400, 'easeInOutCirc');
7109			if (!$('html').hasClass('screen-sm')) {
7110				$cats_filters.slideUp(400, 'easeInOutCirc');
7111			}
7112			window.dispatchEvent(new CustomEvent('boxResized'));
7113		});
7114
7115		$sorting_trgr.on('click', function(e) {
7116			e.preventDefault();
7117			if (!$('html').hasClass('screen-sm')) {
7118				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
7119			}
7120		});
7121
7122		$system.addClass('isotope-processed');
7123	});
7124
7125};
7126
7127UNCODE.widgets = function() {
7128	var widget_collapses = $('.widget-collapse');
7129
7130	widget_collapses.each(function(){
7131		var widget_collapse = $(this),
7132			widget_title = widget_collapse.find('.widget-title'),
7133			widget = widget_title.closest('.widget'),
7134			content = widget.children().not('.widget-title'),
7135			setCTA;
7136
7137		if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
7138			widget_title.toggleClass('open');
7139		}
7140
7141		widget_title.each(function() {
7142			var _this = $(this);
7143			var content = _this.closest('.widget').find('.widget-collapse-content');
7144
7145			$(window).on('load resize', function(){
7146				clearRequestTimeout(setCTA);
7147				setCTA = requestTimeout( function() {
7148					if ( content.is(':visible') ) {
7149						_this.addClass( 'open' );
7150					} else {
7151						_this.removeClass( 'open' );
7152					}
7153				}, 10 );
7154			})
7155
7156			_this.on( 'click', function(){
7157
7158				// Get content of :after element (+ icon) to check the visibility
7159				var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
7160
7161				if (icon_content === 'none' || !icon_content) {
7162					return false;
7163				}
7164
7165				_this.toggleClass('open');
7166				var isOpen = _this.hasClass('open'),
7167					hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27;
7168				content.animate({
7169					height: 'toggle',
7170					padding: 'toggle',
7171					opacity: 'toggle',
7172					top: isOpen ? 0 : hasBorder
7173				}, {
7174					duration: 400,
7175					easing: "easeInOutCirc",
7176				});
7177
7178				return false;
7179
7180			});
7181		});
7182	});
7183
7184	var $widgets_without_title = $('.collapse-init').removeClass('collapse-init');
7185};
7186
7187UNCODE.unmodal = function() {
7188	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
7189		$('.unmodal-overlay').fadeIn();
7190		$('.unmodal-overlay').addClass('loading');
7191		$('body').addClass('uncode-unmodal-overlay-visible');
7192		$(window).trigger('unmodal-open');
7193	});
7194
7195	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
7196		$('.unmodal-overlay').fadeOut();
7197		$('.unmodal').fadeOut();
7198		$('body').removeClass('uncode-unmodal-overlay-visible');
7199		$('body').removeClass('uncode-unmodal-open');
7200		$('html').removeClass('uncode-unmodal-body-disable-scroll');
7201		$(document).trigger('unmodal-close');
7202		UNCODE.isUnmodalOpen = false;
7203	});
7204
7205	$(document).on('uncode-unmodal-show-content', function() {
7206		$('.unmodal-overlay').removeClass('loading');
7207		$('.unmodal').show();
7208		$('.unmodal').addClass('show-unmodal-with-animation');
7209		$('.unmodal-content')[0].scrollTop = 0;
7210		$('body').addClass('uncode-unmodal-open');
7211		UNCODE.isUnmodalOpen = true;
7212
7213		if ($('body').hasClass('qw-body-scroll-disabled')) {
7214			$('html').addClass('uncode-unmodal-body-disable-scroll');
7215		}
7216
7217		if ($('.unmodal').hasClass('auto-height')) {
7218			set_modal_height();
7219		}
7220	});
7221
7222	var set_modal_height = function() {
7223		var modal = $('.unmodal');
7224		var window_height = $(window).outerHeight();
7225		var modal_height = modal.outerHeight();
7226
7227		modal.css('height', 'auto');
7228
7229		if (modal_height > window_height) {
7230			modal.outerHeight(window_height);
7231		}
7232	}
7233
7234	if ($('.unmodal').hasClass('auto-height')) {
7235		var setCTA;
7236
7237		$(window).on('resize', function() {
7238			clearRequestTimeout(setCTA);
7239			setCTA = requestTimeout(function() {
7240				set_modal_height();
7241			}, 100);
7242		});
7243	}
7244};
7245
7246UNCODE.bgChanger = function() {
7247	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
7248		$bg_first = $('.vc_row[data-bg-remove]'),
7249		bg_remove = $bg_first.attr('data-bg-remove'),
7250		$first = $bg_changers.first(),
7251		$last = $bg_changers.last(),
7252		$bg_wrapper = $('#changer-back-color'),
7253		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
7254		setCTA, localH = UNCODE.wheight,
7255		isScrolling;
7256
7257	$bg_first.removeClass(bg_remove);
7258
7259	var bgChange = function($col, bgColor, skin, tmbskin){
7260		$bg_wrapper.attr( 'class', bgColor );
7261		var menuskin;
7262		if ( typeof skin !== 'undefined' ) {
7263			menuskin = skin.replace('style', 'menu')
7264		}
7265
7266		if ( $col.length ) {
7267			$('.uncol[data-skin-change]').each(function(){
7268				var $isoFooter = $('.isotope-footer', this);
7269				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
7270				if ( menuskin !== '' ) {
7271					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
7272				}
7273			});
7274
7275			$('.tmb[data-skin-change]').each(function(){
7276				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
7277			});
7278		}
7279	};
7280
7281	var $masthead = $('#masthead'),
7282		transDesktop,
7283		transMobile,
7284		changeSkin,
7285
7286	checkTransparencyAndChange = function( skin ){
7287		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
7288		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
7289		changeSkin = $masthead.hasClass('menu-change-skin');
7290
7291		if ( ! transDesktop && ! transMobile ) {
7292			return false;
7293		}
7294
7295		if ( ! changeSkin ) {
7296			return false;
7297		}
7298
7299		if ( skin === 'style-light' ){
7300			$masthead.removeClass('style-dark-override').addClass('style-light-override');
7301			return false;
7302		} else if ( skin === 'style-dark' ) {
7303			$masthead.removeClass('style-light-override').addClass('style-dark-override');
7304			return false;
7305		}
7306	};
7307
7308	var bg_waypoints = function(){
7309		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
7310
7311			$.each($bg_changers, function(index, row) {
7312
7313				var $row = $(row),
7314					$col = $('.uncol[data-skin-change]', $row).eq(0),
7315					skin,
7316					$tmbs,
7317					tmbskin,
7318					bgColor = $row.attr('data-bg-color');
7319
7320				if ( ! $row.is(':visible') ) {
7321					return false;
7322				}
7323
7324				if ( $col.length ) {
7325					skin = $col.attr('data-skin-change');
7326					$tmbs = $('.tmb[data-skin-change]', $row);
7327					tmbskin = skin.replace('style', 'tmb');
7328				}
7329
7330				if ( ! $row.hasClass('unscroll-horizontal') ) {
7331					$row.waypoint(function( dir ) {
7332						if ( dir === 'down' ) {
7333							bgChange($col, bgColor, skin, tmbskin);
7334							checkTransparencyAndChange(skin);
7335						} else {
7336							return;
7337						}
7338					}, {
7339						offset: '50%'
7340		  			});
7341
7342					$row.waypoint(function( dir ) {
7343						if ( dir === 'up' ) {
7344							bgChange($col, bgColor, skin, tmbskin);
7345							checkTransparencyAndChange(skin);
7346						} else {
7347							return;
7348						}
7349					}, {
7350						offset: function() {
7351							var clH = this.element.clientHeight,
7352								wH = window.innerHeight,
7353								ret = clH > 200 ? -100 : clH * -0.5;
7354							return ( wH / 2 ) - clH;
7355						}
7356					});
7357				}
7358
7359			});
7360
7361			$('body').addClass('bg-changer-init');
7362
7363		}
7364	};
7365
7366	var body = document.body,
7367	edges = false;
7368
7369	var throttle = function(fn, wait) {
7370		var time = Date.now();
7371		return function() {
7372			if ((time + wait - Date.now()) < 0) {
7373				fn();
7374				time = Date.now();
7375			}
7376		}
7377	}
7378
7379	var $wrapper = document.querySelector(".main-wrapper"),
7380		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
7381
7382	var $title = document.querySelector('#rotating');
7383	if ( $title !== null ) {
7384		$title.style.whiteSpace = 'nowrap';
7385		$title.style.transition = 'transform 200ms linear';
7386	}
7387
7388	window.addEventListener( 'scroll', throttle( function() {
7389		window.clearRequestTimeout( isScrolling );
7390
7391		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
7392
7393			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
7394				body = document.body,
7395				html = document.documentElement,
7396				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
7397				$row = false,
7398				firstOff,
7399				lastOff;
7400
7401			if ( scrolled < 100 && $first.length ) {
7402				firstOff = $first.offset().top;
7403				if ( firstOff < 100 ) {
7404					var $row = $first;
7405				}
7406			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
7407				lastOff = $last.offset().top + $last.outerHeight();
7408				if ( lastOff > ( docH - 100 ) ) {
7409					var $row = $last;
7410				}
7411			}
7412
7413			if ( $row.length ) {
7414				var $col = $('.uncol[data-skin-change]', $row).eq(0),
7415					skin,
7416					$tmbs,
7417					tmbskin,
7418					bgColor = $row.attr('data-bg-color');
7419
7420				if ( $col.length ) {
7421					skin = $col.attr('data-skin-change');
7422					$tmbs = $('.tmb[data-skin-change]', $row);
7423					tmbskin = skin.replace('style', 'tmb');
7424				}
7425
7426				bgChange($col, bgColor, skin, tmbskin);
7427				checkTransparencyAndChange(skin);
7428				edges = true;
7429			}
7430
7431		}, 150);
7432
7433		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
7434			bg_waypoints();
7435			Waypoint.refreshAll();
7436			edges = false;
7437		}
7438
7439	}, 100), false);
7440
7441	$(window).on('resize', function() {
7442		clearRequestTimeout(setCTA);
7443		setCTA = requestTimeout(function() {
7444			if ( localH != UNCODE.wheight ) {
7445				localH = UNCODE.wheight;
7446				bg_waypoints();
7447				Waypoint.refreshAll();
7448			}
7449		}, 100);
7450	});
7451
7452	bg_waypoints();
7453
7454};
7455
7456UNCODE.skewIt = function() {
7457
7458	if ( $('body').hasClass('compose-mode') ) {
7459		return;
7460	}
7461
7462	var justscrolled = false;
7463
7464	var loadSkewIt = function(){
7465
7466		var $pageHeader = $('#page-header'),
7467			$page_body = $('.page-body'),
7468			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
7469
7470		if ( $header_skew.length ) {
7471			$pageHeader.addClass('uncode-skew').css({
7472				position: 'relative',
7473				zIndex: 1
7474			});
7475			$header_skew.removeClass('uncode-skew');
7476			$page_body.css({
7477				position: 'relative',
7478				zIndex: 0
7479			});
7480		}
7481
7482		var $skew = $('.uncode-skew'),
7483			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
7484			horizontal = $horizontal.length,
7485			stopSkewing,
7486			lastOffset = 0,
7487			lastDate = Date.now();
7488
7489		if ( ! $skew.length ) {
7490			return;
7491		}
7492
7493		var dropSkew = function(){
7494			if ( UNCODE.wwidth < UNCODE.mediaQuery )
7495				return;
7496
7497			$skew.each(function(){
7498				var $this = $(this),
7499					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
7500
7501				if ( $drop.length ) {
7502					$this.css({
7503						'transform': 'skew(0)'
7504					});
7505					var bound = $this[0].getBoundingClientRect();
7506					$drop.css({
7507						left: bound.x * -1,
7508						top: bound.y * -1,
7509					});
7510				}
7511			});
7512		};
7513		dropSkew();
7514
7515		$(window).on('resize', dropSkew);
7516
7517		window.addEventListener( 'scroll', function() {
7518
7519			if ( justscrolled !== true ) {
7520				justscrolled = true;
7521				return;
7522			}
7523
7524			window.clearRequestTimeout( stopSkewing );
7525
7526			var now = Date.now(),
7527				delayInMs = now - lastDate,
7528				offset = window.pageYOffset || window.document.documentElement.scrollTop,
7529				newOffset = offset - lastOffset,
7530				speed = Math.pow((newOffset / delayInMs), 3) * -1,
7531				body = document.body,
7532				html = document.documentElement,
7533				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
7534				wait = 50,
7535				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
7536
7537			if ((lastDate + wait - now) < 0) {
7538
7539				lastDate = now;
7540				lastOffset = offset;
7541
7542				if ( speed > 6 ) {
7543					speed = 6;
7544				} else if ( speed < -6 ) {
7545					speed = -6;
7546				}
7547
7548				if ( speed > 2 && offset < UNCODE.wheight ) {
7549					speed = 2;
7550				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
7551					speed = -2;
7552				}
7553
7554				var speedY = speed,
7555					speedX = speed * 1.25;
7556
7557				if ( horizontal ) {
7558					speedY = 0;
7559					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
7560						speedX = 0;
7561						return;
7562					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
7563						speedX = 0;
7564						return;
7565					}
7566				} else {
7567					speedX = 0;
7568				}
7569
7570				if ( ! $skew.closest('.enter-st').length ) {
7571					speedX = 0;
7572				}
7573
7574				gsap.killTweensOf($skew);
7575				gsap.to( $skew, {
7576					duration: 0.2,
7577					skewY: (speedY * maxSpeed) + "deg",
7578					skewX: (speedX * maxSpeed) + "deg",
7579					ease: Power0.easeNone,
7580					transformOrigin: 'center',
7581				});
7582
7583			}
7584
7585			stopSkewing = requestTimeout(function() {
7586				gsap.killTweensOf($skew);
7587				gsap.to( $skew, {
7588					duration: 0.5,
7589					skewY: "0deg",
7590					skewX: "0deg",
7591					transformOrigin: 'center',
7592					ease: Expo.easeOut,
7593				});
7594
7595				$skew.each(function(){
7596					var $this = $(this),
7597						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
7598
7599					if ( $drop.length ) {
7600						var bound = $this[0].getBoundingClientRect()
7601						$drop.css({
7602							left: bound.x * -1,
7603							top: bound.y * -1,
7604						});
7605					}
7606				});
7607
7608			}, 200);
7609
7610		}, false);
7611
7612	};
7613
7614	$(window).on('load', loadSkewIt);
7615
7616};
7617
7618UNCODE.rotateIt = function() {
7619
7620	if ( $('body').hasClass('compose-mode') ) {
7621		return;
7622	}
7623
7624	var loadRotateIt = function(){
7625
7626		var $toRotate = $('.uncode-rotate');
7627
7628		$toRotate.each(function(){
7629			var $rotate = $(this),
7630				deg = 0,
7631				dir = true,
7632				coeff = 1,
7633				lastOffset = 0,
7634				lastDate = Date.now();
7635
7636			var checkScroll = function($rotate){
7637				// if ( ! $rotate.length ) {
7638				// 	return;
7639				// }
7640
7641				var now = Date.now(),
7642					delayInMs = now - lastDate,
7643					offset = window.pageYOffset || window.document.documentElement.scrollTop,
7644					newOffset = offset - lastOffset,
7645					speed = (newOffset / delayInMs) * 5,
7646					body = document.body,
7647					html = document.documentElement,
7648					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
7649
7650				lastDate = now;
7651				lastOffset = offset;
7652
7653				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
7654					deg = 0;
7655				}
7656
7657				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
7658					deg = parseFloat(deg) + parseFloat(speed);
7659				}
7660
7661				if ( $rotate.hasClass('uncode-rotate-hover') ) {
7662					$rotate.hover(function(){
7663						coeff = 1.75;
7664					}, function(){
7665						coeff = 1;
7666					});
7667				}
7668
7669				// if ( speed > 0 ) {
7670				// 	dir = true
7671				// } else if ( speed < 0 ) {
7672				// 	dir = false
7673				// }
7674
7675				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
7676					deg = deg+coeff;
7677					// if ( dir ) {
7678					// 	deg = deg+coeff;
7679					// } else {
7680					// 	deg = deg-coeff;
7681					// }
7682				}
7683
7684				$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
7685
7686				requestAnimationFrame(function() {
7687					checkScroll($rotate);
7688				});
7689
7690			};
7691
7692			checkScroll($rotate);
7693
7694		});
7695
7696	};
7697
7698	$(window).on('load', loadRotateIt);
7699
7700};
7701
7702var marqueeAttempts = 0,
7703	marqueeTO;
7704
7705UNCODE.textMarquee = function( $titles ) {
7706
7707	if ( typeof $titles == 'undefined' ) {
7708		$titles = $('.un-text-marquee');
7709	}
7710
7711	if ( ! $titles.length ) {
7712		return;
7713	}
7714
7715	$titles.each(function(){
7716		var $title = $(this),
7717			$span = $('> span', $title),
7718			txt,
7719			first = true,
7720			newW = UNCODE.wwidth;
7721
7722		$('.marquee-clone-wrap', $title).remove();
7723
7724		txt = $title.text();
7725
7726		if ( ! $('.marquee-original-core', $span).length ) {
7727			$span = $('> span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
7728		}
7729
7730		var checkResize,
7731			spanW,
7732			$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
7733			$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
7734			clearSpeed,
7735			speed = 10;
7736
7737		$span.prepend($prepended);
7738		$span.append($appended);
7739
7740		var continuousTextMarquee = function(){
7741			var bound = $title.css({
7742					'transform': 'none',
7743					'opacity': 0
7744				}).offset();
7745
7746			var xStrt = first || $title.hasClass('un-marquee-infinite') ? 0 : UNCODE.wwidth - bound.left,
7747				xEnd = $title.hasClass('un-marquee-infinite') ? spanW : ( spanW + bound.left ),
7748				xSpeed = $title.hasClass('un-marquee-infinite') ? ( spanW + bound.left ) : ( xStrt + ( UNCODE.wwidth + bound.left ) ),
7749				direction = $title.hasClass('un-marquee-opposite') ? 1 : -1;
7750
7751			var marqueeTL = new TimelineMax({paused:true, reversed:true});
7752
7753			var inViewElement = $title.closest('.sticky-trigger').length || $title.closest('.pin-spacer').length ? $title.closest('.vc_row')[0] : $title[0];
7754
7755			var inview = new Waypoint.Inview({
7756				element: inViewElement,
7757				enter: function(direction) {
7758					marqueeTL.play();
7759				},
7760				exited: function(direction) {
7761					marqueeTL.pause();
7762				}
7763			});
7764
7765			//gsap.killTweensOf($title);
7766			marqueeTL.fromTo( $title, {
7767				opacity: 1,
7768				x: xStrt
7769			},
7770			{
7771				duration: xSpeed / UNCODE.wwidth * speed,
7772				x: xEnd * direction,
7773				onComplete: function(){
7774					first = false;
7775					continuousTextMarquee();
7776				},
7777				ease: Linear.easeNone
7778			});
7779		};
7780
7781		var runTextMarquee = function(){
7782			var time = Date.now();
7783
7784			var textMarqueeScroll = function(){
7785				var $row = $title.closest('.vc_row'),
7786					$bound = $title.closest('.pin-spacer').length ? $row : $title,
7787					bound = $bound[0].getBoundingClientRect(),
7788					wait = 100,
7789					direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1;
7790
7791				if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 &&
7792					bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 &&
7793					marqueeAttempts < 2 ) {
7794
7795					clearRequestTimeout(marqueeTO);
7796
7797					marqueeTO = requestTimeout(function(){
7798						marqueeAttempts++;
7799						UNCODE.textMarquee();
7800					}, 100);
7801				}
7802
7803				//if ((time + wait - Date.now()) < 0) {
7804					//if ( bound.top > ( bound.height * -4 ) && ( bound.top - bound.height ) < UNCODE.wheight * 2 ) {
7805						// $title[0].style.transform = 'translateX(' + ( UNCODE.wheight * 0.5 - bound.top ) * 0.75 + 'px)';
7806						gsap.killTweensOf($title);
7807						gsap.to( $title, {
7808							duration: 0.24,
7809							x: ( UNCODE.wheight * 0.35 - bound.top ) * 0.5 * direction,
7810							//ease: Expo.easeOut,
7811						});
7812					//}
7813					//time = Date.now();
7814				//}
7815			};
7816
7817			textMarqueeScroll();
7818			$(window).on( 'load scroll', function() {
7819				textMarqueeScroll();
7820			});
7821
7822		};
7823
7824		var cloneSpan = function($_title, cntnt){
7825
7826			if ( $_title.hasClass('un-marquee-infinite') ) {
7827				$('> span.marquee-clone-wrap', $_title).text('');
7828			}
7829
7830			gsap.to( $_title, {
7831				duration: 0,
7832				x: 0
7833			});
7834			spanW = $span.outerWidth();
7835
7836			if ( !spanW ) {
7837				return;
7838			}
7839
7840			var part = Math.ceil( UNCODE.wwidth / spanW ) * 2;
7841
7842			if ( $_title.hasClass('un-marquee-infinite') ) {
7843
7844				for ( var i = 0; i < part; i++ ) {
7845					$prepended[0].textContent += cntnt + "\u00A0";
7846					$appended[0].textContent += cntnt + "\u00A0";
7847				}
7848			}
7849
7850			if ( $('body').hasClass('compose-mode') ) {
7851				return;
7852			}
7853
7854			if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
7855				continuousTextMarquee();
7856			}
7857
7858			if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
7859				runTextMarquee();
7860			}
7861
7862		};
7863
7864		var marqueResize = function(){
7865			clearRequestTimeout(checkResize);
7866			checkResize = requestTimeout(function(){
7867				if ( newW !== UNCODE.wwidth ) {
7868					gsap.killTweensOf($title);
7869					UNCODE.textMarquee();
7870					newW = UNCODE.wwidth;
7871				}
7872			}, 1000);
7873		};
7874
7875		$(window).off('resize', marqueResize)
7876		.on( 'resize', marqueResize);
7877
7878		cloneSpan($title, txt);
7879
7880		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
7881			window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
7882				// imageHover();
7883				var $_titles = $('.un-text-marquee',e.view.$el);
7884				UNCODE.textMarquee($_titles);
7885			});
7886		}
7887	});
7888
7889};
7890
7891UNCODE.parallax = function() {
7892	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
7893		if ($('.parallax-el').length > 0) {
7894			var parallax_elements = new Rellax('.parallax-el');
7895			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
7896			window.addEventListener('boxResized', function(e) {
7897				parallax_elements.refresh();
7898			}, false);
7899			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
7900				requestTimeout(function() {
7901					parallax_elements.refresh();
7902				}, 100);
7903			});
7904
7905		}
7906	}
7907};
7908
7909UNCODE.magicCursor = function(){
7910	var $customCursor = $('#uncode-custom-cursor'),
7911		$customPilot = $('#uncode-custom-cursor-pilot'),
7912		$postLists = $('.uncode-post-titles'),
7913		currentCursor = 'auto',
7914		setTime,
7915		isScrolling,
7916		mouseEvent;
7917
7918	function delayChangeCursor(cursorType, delayt_time){
7919		clearRequestTimeout(setTime);
7920		setTime = requestTimeout(function() {
7921			$customCursor.attr('data-cursor', cursorType);
7922			if ( $customPilot.length ) {
7923				$customPilot.attr('data-cursor', cursorType);
7924			}
7925			currentCursor = cursorType;
7926		}, delayt_time);
7927	}
7928
7929	function changeCursor($wrap){
7930		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
7931		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href]',
7932			$href = $wrap.find(href),
7933			cursorType,
7934			setTime, set_delay;
7935
7936		$href.hover(function(e) {
7937			var $this = $(this),
7938				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
7939				is_frontend_editor = $this.closest('.vc_controls').length,
7940				hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length,
7941				$parent_cursor = $this.closest('[class*="custom-cursor"]');
7942			if ( is_frontend_editor ) {
7943				cursorType = 'auto';
7944			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
7945				cursorType = data_cursor;
7946			} else if ( $parent_cursor.length ) {
7947				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
7948					cursorType = 'icon-light';
7949				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
7950					cursorType = 'icon-diff';
7951				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
7952					cursorType = 'icon-accent';
7953				} else {
7954					cursorType = 'icon-dark';
7955				}
7956			} else {
7957				cursorType = 'pointer';
7958			}
7959			delayChangeCursor(cursorType, 0);
7960		}, function(){
7961			delayChangeCursor('auto', 150);
7962		});
7963
7964		$(window).on('disable-hover', function(event) {
7965			document.addEventListener("mousemove", function(e) {
7966				mouseEvent = e;
7967			});
7968			delayChangeCursor('auto', 0);
7969		});
7970
7971		$(window).on('enable-hover', function(event) {
7972			if ( typeof mouseEvent !== 'undefined' ) {
7973				var x = mouseEvent.clientX,
7974					y = mouseEvent.clientY;
7975
7976				var elements = document.elementsFromPoint(x, y),
7977					$element = $(elements[0]);
7978
7979				$element.closest(href).trigger('mouseenter');
7980			}
7981		});
7982
7983	}
7984
7985	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
7986		changeCursor();
7987	});
7988
7989	$(document).ajaxComplete(function( event, xhr, settings ) {
7990		changeCursor();
7991	});
7992
7993	$('.isotope-container').on('isotope-layout-complete', function() {
7994		var $this = $(this);
7995		changeCursor($this);
7996	});
7997
7998};
7999
8000UNCODE.magneticCursor = function(){
8001	function magneticCursor($wrap){
8002		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
8003		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'));
8004
8005		$magnetics.on('mousemove', function(e){
8006			var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this),
8007				bound = e.currentTarget.getBoundingClientRect(),
8008				coeff = 30,
8009				hor = (bound.width / 2) - (e.clientX - bound.left),
8010				ver = (bound.height / 2) - (e.clientY - bound.top),
8011				toX = hor / bound.width * coeff,
8012				toY = ver / bound.height * coeff,
8013				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
8014				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
8015				toScale = Math.max(scaleX, scaleY);
8016
8017			gsap.killTweensOf($el);
8018			gsap.to( $el, {
8019				duration: 0.75,
8020				x: toX,
8021				y: toY,
8022				scale: toScale,
8023				ease: Power1.easeOut,
8024				transformPerspective: 900,
8025				transformOrigin: 'center',
8026				force3D: true
8027			});
8028		}).on('mouseout', function(e){
8029			var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this);
8030			gsap.killTweensOf($el);
8031			gsap.to( $el, {
8032				duration: 0.6,
8033				y: 0,
8034				x: 0,
8035				scale: 1,
8036				ease: Power1.easeOut,
8037				transformPerspective: 900,
8038				transformOrigin: 'center',
8039				force3D: true
8040			});
8041		});
8042	};
8043
8044	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
8045		magneticCursor();
8046	});
8047
8048	$(document).ajaxComplete(function( event, xhr, settings ) {
8049		magneticCursor();
8050	});
8051
8052	$('.isotope-container').on('isotope-layout-complete', function() {
8053		var $this = $(this);
8054		magneticCursor($this);
8055	});
8056
8057};
8058
8059UNCODE.dropImage = function() {
8060
8061	/****************************
8062	 * Image hover *
8063	****************************/
8064	function imageHover(){
8065		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
8066			return;
8067		}
8068
8069		var $postLists = $('.uncode-post-titles');
8070		$postLists.each(function(){
8071			var $list = $(this),
8072				timing = parseFloat( $list.attr('data-timing') ),
8073				default_image = $list.hasClass('uncode-post-titles-default-image'),
8074				default_title = $list.hasClass('uncode-post-titles-default-title'),
8075				$tmbs = $('.tmb', $list),
8076				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
8077				clientX,
8078				clientY,
8079				$row_parent = $list.closest('.vc_row'),
8080				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
8081				$col_parent = $list.closest('.uncell'),
8082				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
8083				setCTA;
8084
8085			timing *= 0.001;
8086
8087			var drop_bgs = function(){
8088				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
8089					var $drop = $(this),
8090						srcset = $drop.attr('data-bgset'),
8091						setArr = srcset.split(","),
8092						setArrOrder = [],
8093						biggest = 0,
8094						checkBg = false;
8095
8096					if ( SiteParameters.uncode_adaptive == true ) {
8097						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
8098							$drop.css({
8099								'background-image' : 'url(' + setArr[0] + ')'
8100							});
8101						}
8102					} else {
8103						for ( var i = 0; i < setArr.length; i++ ) {
8104							var setLoop = setArr[i].trim().split(" ");
8105							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
8106								var parseSet = parseFloat(setLoop[1]);
8107								if ( biggest < parseSet ) {
8108									biggest = parseSet;
8109								}
8110								setArrOrder[parseSet] = setLoop[0];
8111								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
8112									checkBg = true;
8113									$drop.css({
8114										'background-image' : 'url(' + setLoop[0] + ')'
8115									});
8116								}
8117							}
8118						}
8119
8120						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
8121							$drop.css({
8122								'background-image' : 'url(' + setArrOrder[biggest] + ')'
8123							});
8124						}
8125					}
8126
8127				});
8128			};
8129
8130			drop_bgs();
8131
8132			var dropMovesSize = function(){
8133				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
8134					return;
8135				}
8136				$drop_moves.each(function(){
8137					var $drop_move = $(this),
8138						dataW = $drop_move.attr('data-w'),
8139						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
8140					if ( typeof dataW !== 'undefined' && dataW !== null ) {
8141						dataW = screenInfo.width / 12 * parseFloat( dataW );
8142					}
8143					$drop_moves.css({
8144						width: dataW
8145					});
8146
8147					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
8148						$anim_parent.on('animationend', function(){
8149							var bound = $anim_parent[0].getBoundingClientRect();
8150							$drop_move.css({
8151								left: bound.x * -1,
8152								top: bound.y * -1,
8153							});
8154						});
8155					}
8156				});
8157
8158
8159			};
8160
8161			dropMovesSize();
8162
8163			$(window).on( 'resize', function(){
8164				clearRequestTimeout(setCTA);
8165				setCTA = requestTimeout( function() {
8166					drop_bgs();
8167					dropMovesSize();
8168				}, 100 );
8169			});
8170
8171			if ( $drop_row_parents.length ) {
8172				$row_parent.addClass( 'drop-added' );
8173			}
8174
8175			$drop_row_parents.each(function(index, val){
8176				var $drop = $(val);
8177				$row_parent.prepend($drop);
8178				manageVideos($drop, false);
8179				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
8180					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
8181				}
8182				if ( default_image && index == 0 ) {
8183					manageVideos($drop, true);
8184					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
8185						image_ph = new Image();
8186					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
8187						image_ph.onload = function() {
8188							$drop.addClass('active');
8189							if ( default_title ) {
8190								$list.addClass('drop-hover');
8191								$tmbs.first().addClass('drop-active');
8192							}
8193						};
8194						image_ph.src = bg_img;
8195					}
8196				}
8197			});
8198
8199			if ( $drop_col_parents.length ) {
8200				$col_parent.addClass( 'drop-added' );
8201			}
8202
8203			$drop_col_parents.each(function(index, val){
8204				var $drop = $(this);
8205				$col_parent.prepend($drop);
8206				manageVideos($drop, false);
8207				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
8208					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
8209				}
8210				if ( default_image && index == 0 ) {
8211					manageVideos($drop, true);
8212					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
8213						image_ph = new Image();
8214					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
8215						image_ph.onload = function() {
8216							$drop.addClass('active');
8217							if ( default_title ) {
8218								$list.addClass('drop-hover');
8219								$tmbs.first().addClass('drop-active');
8220							}
8221						};
8222						image_ph.src = bg_img;
8223					}
8224				}
8225			});
8226
8227			function manageVideos( $el, start ) {
8228				var videoElem = $('video', $el),
8229					$iframe = $('iframe', $el),
8230					iframeID = $iframe.attr('id');
8231				if ( videoElem.length ) {
8232					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
8233						if ( start ) {
8234							videoElem[0].setCurrentTime(0);
8235							videoElem[0].play();
8236						} else {
8237							videoElem[0].pause();
8238							videoElem[0].setCurrentTime(0);
8239						}
8240					} else {
8241						if ( start ) {
8242							videoElem[0].currentTime = 0;
8243							videoElem[0].play();
8244						} else {
8245							videoElem[0].pause();
8246							videoElem[0].currentTime = 0;
8247						}
8248					}
8249				}
8250
8251				$el.data('active', start);
8252
8253				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
8254					var iframeIDv = iframeID.replace('okplayer-', ''),
8255						optionsV = $(window).data('okoptions-' + iframeIDv),
8256						vimeo = $iframe[0],
8257						playerV = new Vimeo.Player(vimeo),
8258						timeV = 0;
8259
8260					if (optionsV.time != null) {
8261						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
8262						for ( var i = 0; i < timeArr.length; i++ ) {
8263							if ( timeArr[i] === 'h' ) {
8264								timeV += parseFloat(timeArr[i-1]) * 3600;
8265							} else if ( timeArr[i] === 'm' ) {
8266								timeV += parseFloat(timeArr[i-1]) * 60;
8267							} else if ( timeArr[i] === 's' ) {
8268								timeV += parseFloat(timeArr[i-1]);
8269							}
8270						}
8271					}
8272					playerV.setCurrentTime(timeV);
8273					if ( start ) {
8274						playerV.setVolume(0);
8275						playerV.play();
8276					} else {
8277						playerV.pause();
8278					}
8279				} else if ( $el.attr('data-provider') === 'youtube' ) {
8280					if ( start ) {
8281						$el.trigger('uncode-resume');
8282					} else {
8283						$el.trigger('uncode-pause');
8284					}
8285				}
8286
8287			}
8288
8289			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
8290
8291				document.addEventListener("mousemove", function(e) {
8292					$drop_moves.each(function(){
8293						var $drop_move = $(this),
8294							duration = 0.4;
8295
8296						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
8297							duration = 0.8;
8298						}
8299
8300						clientX = e.clientX;
8301						clientY = e.clientY;
8302
8303						gsap.to( $drop_move, {
8304							duration: duration,
8305							x: clientX,
8306							y: clientY,
8307							ease: Power1.easeOut,
8308						});
8309					});
8310				});
8311
8312			} else {
8313
8314				$(window).on("touchend scroll", function(e) {
8315					$list.removeClass('drop-hover');
8316					$drop_moves.removeClass('active');
8317					$tmbs.removeClass('drop-active');
8318				});
8319
8320				$drop_moves.each(function(){
8321					var $drop_move = $(this),
8322						$tmb = $drop_move.closest('.tmb'),
8323						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
8324
8325					if ( $anim_parent.hasClass('uncode-skew') ) {
8326						$anim_parent.css({
8327							'transform': 'skew(0)'
8328						});
8329					}
8330
8331					$tmb.on('touchend', function(e){
8332						e.stopPropagation();
8333
8334						$drop_moves.removeClass('active');
8335						$tmbs.removeClass('drop-active');
8336
8337						$list.addClass('drop-hover');
8338						$tmb.addClass('drop-active');
8339						$drop_move.addClass('active');
8340						manageVideos($drop_move, true);
8341						clientX = e.changedTouches[0].clientX;
8342						clientY = e.changedTouches[0].clientY;
8343
8344						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
8345							var bound = $anim_parent[0].getBoundingClientRect();
8346							clientX = clientX - bound.x;
8347							clientY = clientY - bound.y;
8348						}
8349
8350						$drop_move.css({
8351							left: clientX,
8352							top: clientY
8353						});
8354					});
8355				});
8356
8357			}
8358
8359			$tmbs.each(function(e){
8360				var $tmb = $(this),
8361					// $trgr = $('a', $tmb),
8362					$trgr = $tmb,
8363					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
8364					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
8364(.t-inside), .parallax-el'),
8365					$video = $('video', $tmb),
8366					$iframe = $('iframe', $tmb),
8367					$entryTxt = $('.t-entry-text', $tmb),
8368					stopBounding;
8369
8370				$entryTxt.add($drop_move).css({
8371					'transition-duration': timing + 's'
8372				});
8373
8374				if ( $video.length ) {
8375					var vidH = $video[0].videoHeight,
8376						vidW = $video[0].videoWidth;
8377					$video.css({
8378						'height': vidH,
8379						'width': vidW
8380					});
8381				}
8382
8383				if ( $iframe.length ) {
8384					var vidH = $drop_move.attr('data-height'),
8385						vidW = $drop_move.attr('data-width');
8386					$iframe.css({
8387						'height': vidH,
8388						'width': vidW
8389					});
8390				}
8391
8392				$iframe.each(function(){
8393					var $video = $(this),
8394						vidH = $video[0].videoHeight,
8395						vidW = $video[0].videoWidth;
8396					$video.css({
8397						'height': vidH,
8398						'width': vidW
8399					});
8400				});
8401
8402				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
8403					$trgr.on('mouseenter',function(e){
8404						$list.addClass('drop-hover');
8405						$tmbs.removeClass('drop-active');
8406						$tmb.addClass('drop-active');
8407						$drop_move.addClass('active');
8408						manageVideos($drop_move, true);
8409
8410						var clientX = e.clientX,
8411							clientY = e.clientY;
8412						$drop_move.css({
8413							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
8414						});
8415
8416					})
8417					.on('mouseleave', function(e){
8418						$list.removeClass('drop-hover');
8419						$drop_move.css({
8420							'transition-duration': ( timing*1.25 ) + 's'
8421						});
8422						$drop_move.removeClass('active');
8423						$tmb.removeClass('drop-active');
8424						$drop_move.on('transitionend', function(e){
8425							$drop_move.off('transitionend');
8426							$drop_move.css({
8427								'transition-duration': timing + 's'
8428							});
8429							manageVideos($drop_move,false);
8430						});
8431					});
8432
8433					document.addEventListener('visibilitychange', function(){
8434						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
8435							$drop_move.css({
8436								'transition-duration': '0s'
8437							});
8438							$drop_move.removeClass('active');
8439							manageVideos($drop_move, false);
8440						}
8441					});
8442
8443					document.addEventListener('scroll', function(){
8444						window.clearRequestTimeout( stopBounding );
8445
8446						if ( $drop_move.hasClass('active') ) {
8447							$list.removeClass('drop-hover');
8448							$tmbs.removeClass('drop-active');
8449							$drop_move.removeClass('active');
8450							$drop_move.on('transitionend', function(e){
8451								$drop_move.off('transitionend');
8452								$drop_move.css({
8453									'transition-duration': timing + 's'
8454								});
8455								manageVideos($drop_move,false);
8456							});
8457						}
8458
8459						stopBounding = requestTimeout(function() {
8460							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
8461								var bound = $anim_parent[0].getBoundingClientRect();
8462								$drop_move.css({
8463									left: bound.x * -1,
8464									top: bound.y * -1,
8465								});
8466							}
8467						}, 200);
8468
8469					});
8470				}
8471
8472				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
8473					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
8474
8475				$drop.css({
8476					'transition-duration': timing + 's'
8477				});
8478
8479				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
8480					$trgr.on('mouseenter',function(e){
8481						$row_parent.add($col_parent).addClass('drop-list-loaded');
8482						$list.addClass('drop-hover');
8483
8484						if ( !$tmb.hasClass('drop-active') ) {
8485							$tmbs.removeClass('drop-active');
8486							$tmb.addClass('drop-active');
8487							if ( default_image && !$drop.hasClass('active') ) {
8488								var $prev = $('[data-drop].active', $row_parent);
8489								$prev.css({
8490									'transition-duration': (timing*1.5) + 's'
8491								});
8492								$prev.removeClass('active');
8493								$prev.on('transitionend', function(e){
8494									$prev.off('transitionend');
8495									manageVideos($prev,false);
8496								});
8497							}
8498							$drop.css({
8499								'transition-duration': timing + 's'
8500							});
8501							$drop.off('transitionend');
8502							$drop.addClass('active');
8503							manageVideos($drop, true);
8504						}
8505					})
8506					.on('mouseleave', function(e){
8507						if ( ( default_image && !default_title ) || !default_image ) {
8508							$list.removeClass('drop-hover');
8509							$tmb.removeClass('drop-active');
8510						}
8511						if ( ! default_image ) {
8512							$drop.css({
8513								'transition-duration': (timing*1.5) + 's'
8514							});
8515							$drop.removeClass('active');
8516
8517							$drop.on('transitionend', function(e){
8518								$drop.off('transitionend');
8519								manageVideos($drop,false);
8520							});
8521						}
8522					});
8523
8524					document.addEventListener('visibilitychange', function(){
8525						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
8526							$drop.css({
8527								'transition-duration': '0s'
8528							});
8529							$drop.removeClass('active');
8530							manageVideos($drop, false);
8531						}
8532					});
8533				}
8534			});
8535
8536		});
8537	};
8538
8539	$(window).on('load', function(event) {
8540		imageHover();
8541	});
8542
8543	var drop_wp_animation = function() {
8544		var $postLists = $('.uncode-post-titles');
8545		$postLists.each(function(){
8546			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
8547				new Waypoint({
8548					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
8549					element: val,
8550					handler: function() {
8551						var element = $(this.element),
8552							parent = element.closest('.tmb'),
8553							currentIndex = parent.index(),
8554							delay = currentIndex,
8555							delayAttr = parseInt(element.attr('data-delay'));
8556						if (isNaN(delayAttr)) delayAttr = 100;
8557						var objTimeout = requestTimeout(function() {
8558							element.addClass('start_animation');
8559
8560							var nextTimeout = requestTimeout(function() {
8561								$('.drop-image-separator', parent).addClass('start_animation');
8562							}, 50);
8563
8564						}, delay * delayAttr);
8565						if (!UNCODE.isUnmodalOpen) {
8566							this.destroy();
8567						}
8568					},
8569					offset: UNCODE.isFullPage ? '100%' : '90%'
8570				})
8571			});
8572		});
8573	}
8574
8575	var runWaypoints_TO,
8576		runWaypoints_delay = 0;
8577
8578	var runWaypoints = function(){
8579		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
8580			runWaypoints_delay = 400;
8581		}
8582		clearRequestTimeout(runWaypoints_TO);
8583		runWaypoints_TO = requestTimeout(function() {
8584			drop_wp_animation();
8585		}, runWaypoints_delay);
8586	};
8587	runWaypoints();
8588	$( document.body ).on( 'uncode_waypoints', runWaypoints );
8589	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
8590		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
8591			// imageHover();
8592			runWaypoints();
8593		});
8594	}
8595};
8596
8597UNCODE.postTable = function() {
8598
8599	var clickRow = function(){
8600		var $postLists = $('.uncode-post-table');
8601
8602		$postLists.each(function(){
8603			var $postList = $(this),
8604				$tmbClicks = $('.tmb.tmb-click-row', $postList);
8605
8606			$tmbClicks.each(function(){
8607				var $tmb = $(this),
8608					$click = $('.table-click-row', $tmb);
8609				$('*:not(.table-click-row)', $tmb).on('click', function(e){
8610					e.preventDefault();
8611					e.stopPropagation();
8612					$click[0].click();
8613					return false;
8614				});
8615			});
8616
8617		})
8618	};
8619
8620	clickRow();
8621
8622	var hoverRow = function(){
8623		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
8624
8625		$postLists.on('mouseenter', function(){
8626			$(this).addClass('post-table-hover');
8627		});
8628		$postLists.on('mouseleave', function(){
8629			$(this).removeClass('post-table-hover');
8630		});
8631	}
8632
8633	hoverRow();
8634
8635	var drop_wp_animation = function() {
8636		var $postLists = $('.uncode-post-table');
8637		$postLists.each(function(){
8638			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
8639				new Waypoint({
8640					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
8641					element: val,
8642					handler: function() {
8643						var element = $(this.element),
8644							parent = element.closest('.tmb'),
8645							currentIndex = parent.index(),
8646							delay = currentIndex,
8647							delayAttr = parseInt(element.attr('data-delay'));
8648						if (isNaN(delayAttr)) delayAttr = 100;
8649						var objTimeout = requestTimeout(function() {
8650							element.addClass('start_animation');
8651						}, delay * delayAttr);
8652						if (!UNCODE.isUnmodalOpen) {
8653							this.destroy();
8654						}
8655					},
8656					offset: UNCODE.isFullPage ? '100%' : '90%'
8657				})
8658			});
8659		});
8660	}
8661
8662	var runWaypoints_TO,
8663		runWaypoints_delay = 0;
8664
8665	var runWaypoints = function(){
8666		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
8667			runWaypoints_delay = 400;
8668		}
8669		clearRequestTimeout(runWaypoints_TO);
8670		runWaypoints_TO = requestTimeout(function() {
8671			drop_wp_animation();
8672		}, runWaypoints_delay);
8673	};
8674	runWaypoints();
8675	$( document.body ).on( 'uncode_waypoints', runWaypoints );
8676	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
8677		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
8678			runWaypoints();
8679			// clickRow();
8680		});
8681	}
8682};
8683
8684UNCODE.rotatingTxt = function($ctxt) {
8685
8686	if ( $('body').hasClass('compose-mode') ) {
8687		return;
8688	}
8689
8690	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
8691	var setCTA;
8692
8693	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
8694		var $heading = $(this),
8695			// debug = 0,
8696			cycle = 0,
8697			$trgt,
8698			$toMove,
8699			$highl,
8700			$col = $heading.closest('.uncont'),
8701			txt,
8702			arrTxt,
8703			textFadeIn, textFadeOut,
8704			removeWraps;
8705
8706		var defineObjs = function() {
8707			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
8708				var $rtx = $(this),
8709					fx = $rtx.attr('data-fx'),
8710					wait = $rtx.attr('data-wait'),
8711					$prev = $(this).prev().addClass('prev-rotating-start'),
8712					splitToMove = [],
8713					splitArray = [],
8714					lineArray = [],
8715					lineIndex = 0,
8716					lineStart = true,
8717					lineEnd = false,
8718					startSplit = false,
8719					$line_wrap = $rtx.closest('.heading-line-wrap'),
8720					same_line = true,
8721					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
8722					indexRtx = $splits.index($rtx);
8723
8724				fx = typeof fx === 'undefined' ? '' : fx;
8725				wait = typeof wait === 'undefined' ? '' : wait;
8726
8727				$splits.each(function(key, val){
8728					var $split = $(this),
8729						$new_line_wrap = $split.closest('.heading-line-wrap');
8730
8731					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
8732						splitArray.push( $split );
8733					}
8734
8735					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
8736						startSplit = false;
8737					}
8738
8739					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
8740						splitArray.push( $split );
8741
8742						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
8743							same_line = true;
8744						} else {
8745							same_line = false;
8746						}
8747					}
8748
8749					if ( key == indexRtx ) {
8750						if ( /\S/.test($split.text()) ) {
8751							startSplit = true;
8752							$line_wrap = $split.closest('.heading-line-wrap');
8753							splitArray.push( $split );
8754						} else {
8755							indexRtx++;
8756						}
8757					}
8758
8759					$line_wrap = $new_line_wrap;
8760				});
8761
8762				$toMove = $($.map(splitToMove, function(el){return el.get();}));
8763				$trgt = $($.map(splitArray, function(el){return el.get();}));
8764
8765				if ( same_line ) {
8766					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
8767					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
8768				}
8769
8770				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
8771					$prev.addClass('empty-span-hidden');
8772				}
8773
8774				$highl = $('.heading-text-highlight-inner', $trgt);
8775
8776				$rtx.attr('data-animated', 'true');
8777				if ( cycle == 0 ) {
8778					$( document.body ).trigger('defer-highlights');
8779					cycle++;
8780					defineObjs();
8781					return;
8782				}
8783				cycle++;
8784
8785				txt = $rtx.attr('data-text');
8786				arrTxt = txt.split("|");
8787
8788				textFadeOut($trgt);
8789
8790			});
8791		};
8792
8793		removeWraps = function(){
8794
8795			// if ( debug == 1 ) return;
8796			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
8797			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
8798
8799
8800				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
8801					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
8802
8803				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
8804
8805				$splitFlow.each(function(){
8806					$(this).append($temp_highl);
8807				});
8808
8809				var $line_wrap = $wraps[wrap_k];
8810				var $parent_wrap = $line_wrap.parentNode;
8811				if ( $parent_wrap !== null ) {
8812					while ( $line_wrap.firstChild ) {
8813						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
8814					}
8815					$parent_wrap.removeChild($line_wrap);
8816				}
8817			}
8818			// debug++;
8819			defineObjs();
8820		};
8821
8822		var loop = 0;
8823		textFadeIn = function($trgt){
8824			var word = arrTxt[loop].split(" "),
8825				worsSpan = '',
8826				$wrap = $trgt.closest('.uncode-rotating-wrap'),
8827				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
8828				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
8829
8830			for (var w = 0; w < word.length; w++) {
8831				var highl;
8832				if ( $highl.length ) {
8833					highl = $highl[0].outerHTML;
8834				} else {
8835					highl = '';
8836				}
8837
8838				if ( w > 0 ) {
8839					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
8840				}
8841				var charachters = word[w].split('');
8842				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
8843				for (var c = 0; c < charachters.length; c++) {
8844					worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
8845				}
8846				worsSpan += '</span>' + highl + '</span></span>';
8847			}
8848
8849			if ( $wrap.length && $wrap_inner.length ) {
8850				var words_w = $wrap_inner.outerWidth();
8851				$wrap.css({
8852					width: words_w
8853				});
8854
8855				$highl = $('.heading-text-highlight-inner', $wrap);
8856				$highl.prependTo($wrap);
8857
8858				$wrap_inner.css({
8859					opacity: 0
8860				});
8861
8862				$wrap_inner.html(worsSpan);
8863				$('.heading-text-highlight-inner', $wrap_inner).remove();
8864				words_w = $wrap_inner.innerWidth();
8865
8866				var duration = 0.45;
8867
8868				$heading.removeClass('auto-width');
8869				if ( words_w > $col.width() ) {
8870					$heading.addClass('auto-width');
8871					words_w = 'auto';
8872					duration = 0;
8873				}
8874
8875				$wrap.css({
8876					'width': words_w,
8877					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
8878				});
8879
8880				var $word_inner = $('.split-word-inner', $wrap_inner),
8881					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
8882
8883				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
8884
8885				if ( !$target_fx.length ) {
8886					return;
8887				}
8888
8889				gsap.killTweensOf($target_fx);
8890
8891				if ( fx !== 'zoom' ) {
8892					gsap.fromTo( $target_fx, {
8893						y: fx === 'opacity' ? '0%' : '-10%'
8894					},{
8895						delay: duration,
8896						duration: 0.25,
8897						y: '0%',
8898						ease: Circ.easeOut,
8899					});
8900
8901					if ( !$wrap_inner.length ) {
8902						return;
8903					}
8904
8905					gsap.fromTo( $wrap_inner, {
8906						opacity: 0,
8907					},{
8908						delay: duration,
8909						duration: 0.25,
8910						opacity: 1,
8911						ease: Circ.easeOut,
8912						onComplete: function(){
8913							$('> .heading-text-highlight-inner', $wrap).remove();
8914							$wrap_inner.html(worsSpan);
8915							removeWraps();
8916						}
8917					})
8918
8919				} else {
8920					gsap.fromTo( $target_fx, {
8921						transformOrigin: '50%',
8922						opacity: 0,
8923						scale: 0.875,
8924					},{
8925						opacity: 1,
8926						delay: duration,
8927						duration: 0.25,
8928						scale: 1,
8929						ease: Circ.easeOut,
8930						onComplete: function(){
8931							$('> .heading-text-highlight-inner', $wrap).remove();
8932							$wrap_inner.html(worsSpan);
8933							removeWraps();
8934						}
8935					});
8936				}
8937
8938			} else {
8939
8940				if ( !$wrap_inner.length ) {
8941					return;
8942				}
8943
8944				gsap.to( $wrap_inner, {
8945					duration: 0.4,
8946					opacity: 0,
8947					ease: Power1.easeOut,
8948					onComplete: function(){
8949						$wrap_inner.html(worsSpan);
8950						words_w = $wrap_inner.innerWidth();
8951
8952						gsap.to( $wrap_inner, {
8953							duration: 0.2,
8954							opacity: 1,
8955							ease: Power1.easeOut,
8956							onComplete: function(){
8957								$('> .heading-text-highlight-inner', $wrap).remove();
8958								$wrap_inner.html(worsSpan);
8959								removeWraps();
8960							}
8961						})
8962					}
8963				});
8964			}
8965
8966			if ( loop < arrTxt.length-1 ) {
8967				loop++;
8968			} else {
8969				loop = 0;
8970			}
8971
8972		};
8973
8974		textFadeOut = function($trgt){
8975			var $word_inner = $('.split-word-inner', $trgt),
8976				$wrap = $trgt.closest('.uncode-rotating-wrap'),
8977				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
8978				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
8979				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
8980
8981			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
8982
8983			var gsap_param = {
8984					delay: wait,
8985					duration: 0.25,
8986					y: fx === '' ? '10%' : '0%',
8987					opacity: 0,
8988					ease: Circ.easeOut,
8989					onStart: function(){
8990						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
8991							$highl = $('.heading-text-highlight-inner', $wrap);
8992							$highl.prependTo($wrap);
8993						}
8994					},
8995					onComplete: textFadeIn,
8996					onCompleteParams: [$trgt]
8997				};
8998
8999			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
9000
9001			if ( fx === '' ) {
9002				gsap_param.y = '10%';
9003			} else if ( fx === 'zoom' ) {
9004				gsap_param.scale = '1.045';
9005			}
9006
9007			if ( !$target_fx.length ) {
9008				return;
9009			}
9010
9011			if ( $heading.data('waypoint') !== true ) {
9012				var textInView = new Waypoint.Inview({
9013					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
9014					element: $heading[0],
9015					enter: function(direction) {
9016						$heading.data('waypoint',true);
9017						gsap.fromTo( $target_fx, {
9018							transformOrigin: '50%'
9019						}, gsap_param );
9020					}
9021				});
9022			} else {
9023				gsap.fromTo( $target_fx, {
9024					transformOrigin: '50%'
9025				}, gsap_param );
9026			}
9027		};
9028
9029		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9030			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
9031				var $el = model.view.$el,
9032					shortcode = model.attributes.shortcode;
9033
9034				UNCODE.rotatingTxt($el);
9035			});
9036		} else {
9037			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
9038				$heading.on('already-animated', function(){
9039					removeWraps();
9040					window.addEventListener('removeOldLines', function(){
9041						clearRequestTimeout(setCTA);
9042						setCTA = requestTimeout( removeWraps, 150 );
9043					});
9044				});
9045			} else {
9046				$(window).on('load', function(){
9047					removeWraps();
9048					window.addEventListener('removeOldLines', function(){
9049						clearRequestTimeout(setCTA);
9050						setCTA = requestTimeout( removeWraps, 150 );
9051					});
9052				});
9053			}
9054		}
9055	});
9056
9057};
9058
9059UNCODE.verticalText = function() {
9060	$(window).on('menuCanvasOpen', function(){
9061		$('.vertical-text--fixed').fadeOut(500);
9062		$('.horizontal-text--fixed').fadeOut(500);
9063	}).on('menuCanvasClose', function(){
9064		$('.vertical-text--fixed').fadeIn(500);
9065		$('.horizontal-text--fixed').fadeIn(500);
9066	});
9067
9068	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
9069	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
9070	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
9071	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
9072
9073	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
9074		window.addEventListener('scroll', function(e) {
9075			var totalPageHeight = document.body.scrollHeight;
9076			var scrollPoint = window.scrollY + window.innerHeight;
9077
9078			if (window.scrollY > 0) {
9079				showOnTopVerticalTexts.fadeOut();
9080				showOnTopHorizontalTexts.fadeOut();
9081			} else {
9082				showOnTopVerticalTexts.fadeIn();
9083				showOnTopHorizontalTexts.fadeIn();
9084			}
9085
9086			if (scrollPoint >= totalPageHeight) {
9087				hideOnBottomVerticalTexts.fadeOut();
9088				hideOnBottomHorizontalTexts.fadeOut();
9089			} else {
9090				hideOnBottomVerticalTexts.fadeIn();
9091				hideOnBottomHorizontalTexts.fadeIn();
9092			}
9093		}, false);
9094	}
9095};
9096
9097UNCODE.stickyScroll = function( $el ) {
9098	if ( typeof $el === 'undefined' || $el === null ) {
9099		$el = $('body');
9100	}
9101	var checkVisible = function( el, dir ) {
9102		if (typeof jQuery === "function" && el instanceof jQuery) {
9103			el = el[0];
9104		}
9105
9106		var off = 50;
9107		dir = typeof dir=='undefined' ? 'right' : dir;
9108		var rect = el.getBoundingClientRect();
9109
9110		return (
9111			(
9112				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
9113				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
9114				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
9115			) &&
9116			(
9117				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
9118				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
9119				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
9120				( rect.right <= window.innerWidth && rect.left >= 0 )
9121			)
9122		);
9123	};
9124
9125	var setItemsRelHeight = function(reset) {
9126		var $_el = $el;
9127		if ( $el.is('.index-scroll') ) {
9128			var $_el = $el.closest('.uncont');
9129		}
9130		$('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
9131			$.each($('.tmb', item), function(index, val) {
9132				if ( reset === true ) {
9133					$(val).css( 'visibility', 'hidden' );
9134				} else {
9135					$(val).css( 'visibility', 'visible' );
9136				}
9137			});
9138		});
9139		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
9140			$.each($('.tmb', item), function(index, val) {
9141				if ( reset === true ) {
9142					$(val).css( 'visibility', 'hidden' );
9143					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
9144				} else {
9145					var $rowParent = $(item).closest('.row-parent'),
9146						rowRatio = $rowParent.attr('data-height-ratio'),
9147						$rowInner = $(item).closest('.row-child'),
9148						rowRatioInner = $rowInner.attr('data-height'),
9149						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
9150						$colContainer = $(item).closest('.uncell'),
9151						$uncont = $(item).closest('.uncont'),
9152						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
9153						safe_heigth = $(item).data('safe-height'),
9154						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
9155						offSet = $(item).offset().top - $uncont.offset().top,
9156						multiplier_h,
9157						data_viewport_h,
9158						body_border = $('.body-borders .top-border').outerHeight() * 2,
9159						remove_menu = $(item).data('vp-menu');
9160
9161					if ( rowRatio === 'full' || rowRatio === '' ) {
9162						rowRatio = 1;
9163					} else {
9164						rowRatio = rowRatio / 100;
9165					}
9166
9167					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
9168						rowRatio = rowRatio;
9169					} else {
9170						rowRatio = rowRatio * rowRatioInner / 100;
9171					}
9172
9173					winHeight = winHeight * rowRatio;
9174
9175					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
9176						multiplier_h = parseInt($(item).attr('data-vp-height'));
9177					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
9178						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
9179					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
9180						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
9181					}
9182
9183					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
9184						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
9185						if ( remove_menu === true ) {
9186							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
9187						}
9188						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
9189					} else {
9190						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
9191					}
9192
9193				}
9194			});
9195		});
9196		$('.index-scroll', $_el).each(function(i, item){
9197			var $uncoltable = $(item).closest('.uncoltable'),
9198				$rowParent = $(item).closest('.row-parent'),
9199				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
9200				body_border = $('.body-borders .top-border').outerHeight() * 2,
9201				$index_row = $('.index-row', item),
9202				safe_heigth = $index_row.data('safe-height'),
9203				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
9204			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
9205				var data_viewport_h = winHeight - ( paddingRow + body_border );
9206				$uncoltable.css({
9207					'min-height': data_viewport_h
9208				});
9209			} else {
9210				$uncoltable.css({
9211					'min-height': 'auto'
9212				});
9213			}
9214		});
9215
9216	}
9217	setItemsRelHeight();
9218
9219	var $index_scrolls = $('.index-scroll', $el);
9220
9221	$index_scrolls.each(function(key, value){
9222		var $index = $(this),
9223			$parent_row = $index.closest('.vc_row[data-parent]'),
9224			$index_row = $('.index-row', $index),
9225			dir = $index_row.attr('data-direction');
9226		dir = typeof dir === 'undefined' ? 'right' : dir;
9227
9228		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
9229	});
9230
9231	var $horScrolls = $('.unscroll-horizontal', $el);
9232
9233	if ( $horScrolls.length ) {
9234
9235		$('body').addClass('scrolling-trigger');
9236
9237		$horScrolls.each(function(key, value){
9238			var $section = $(this),
9239				$index_scroll = $('.index-scroll', $section),
9240				$index_row = $('.index-row', $index_scroll),
9241				dir = $section.attr('data-direction'),
9242				wrap = $index_row.attr('data-wrap'),
9243				$pinWrap,
9244				$pinTrigger;
9245
9246			dir = typeof dir === 'undefined' ? 'right' : dir;
9247			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
9248			$pinWrap = $('<div class="pin-wrap" />');
9249			if ( SiteParameters.is_frontend_editor ) {
9250				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
9251				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
9252			} else {
9253				if ( wrap === 'column' ) {
9254					$index_scroll.wrapInner( $pinWrap );
9255				} else {
9256					$('> .row', $section).wrap( $pinWrap );
9257				}
9258				$section.wrapInner( $pinTrigger );
9259			}
9260
9261		});
9262
9263		var $pinWraps = $('.pin-wrap', $el);
9264
9265		var horScrollSizes = function(){
9266
9267			$pinWraps.each(function(key, val){
9268				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
9269					$pinTrigger = $pinWrap.closest('.pin-trigger'),
9270					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
9271					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
9272					$boxContainer = $('.box-container'),
9273					box_m = $boxContainer.css('margin-left'),
9274					st_active = true;
9275
9276				var setHorW,
9277				horWidth = function(){
9278					$index_scroll.each(function(){
9279						var $this = $(this),
9280							$index_row = $('.index-row', $this),
9281							$rowContainer = $index_row.closest('.vc_row'),
9282							$rowInner = $index_row.closest('.wpb_row'),
9283							$rowParent = $index_row.closest('.row-parent'),
9284							$tmbs = $('.tmb', $index_row),
9285							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
9286							$uncont = $index_row.closest('.uncont'),
9287							$parent_col = $index_row.closest('.wpb_column'),
9288							col_w = $uncont.width(),
9289							data_lg = parseFloat( $index_row.attr('data-lg') ),
9290							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
9291							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
9292							tmb_w;
9293
9294						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
9295						tmb_w = ( col_w + padding_tmb ) / data_lg;
9296
9297						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
9298							tmb_w = ( col_w + padding_tmb ) / data_sm;
9299						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
9300							tmb_w = ( col_w + padding_tmb ) / data_md;
9301						}
9302
9303						if ( !isNaN(tmb_w) ) {
9304							$tmbs.css({
9305								'width': tmb_w
9306							});
9307						}
9308
9309						$tmbs.css({
9310							'visibility': 'visible'
9311						});
9312
9313					});
9314				};
9315
9316				horWidth();
9317				clearRequestTimeout(setHorW);
9318				setHorW = requestTimeout( function(){
9319					setItemsRelHeight();
9320					horWidth();
9321				}, 100 );
9322
9323				if ( SiteParameters.is_frontend_editor ) {
9324					return;
9325				}
9326
9327				var $vmenu = $('body.vmenu .vmenu-container'),
9328					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
9329					winWidth = window.innerWidth - vmenuW,
9330					$tmb = $('.tmb', $index_scroll).eq(0),
9331					paddingRight = parseFloat( $tmb.css('padding-right') ),
9332					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_scroll.width() + paddingRight ) ),
9333					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
9334					scroll_anim;
9335
9336				if ( $('body').hasClass('rtl') ) {
9337					if ( dir === 'left' ) {
9338						scroll_anim = gsap.fromTo( $pinWrap, {
9339							x: stickyScrollLength
9340						},{
9341							x: 0,
9342							ease: "none"
9343						});
9344					} else {
9345						scroll_anim = gsap.fromTo( $pinWrap, {
9346							x: 0
9347						},{
9348							x: stickyScrollLength,
9349							ease: "none"
9350						});
9351					}
9352				} else {
9353					if ( dir === 'left' ) {
9354						scroll_anim = gsap.fromTo( $pinWrap, {
9355							x: -stickyScrollLength
9356						},{
9357							x: 0,
9358							ease: "none"
9359						});
9360					} else {
9361						scroll_anim = gsap.fromTo( $pinWrap, {
9362							x: 0
9363						},{
9364							x: -stickyScrollLength,
9365							ease: "none"
9366						});
9367					}
9368				}
9369
9370				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
9371					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
9372				}
9373
9374				var animationIncrease;
9375
9376				var checkForAnimations = function(){
9377					animationIncrease = 0
9378					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
9379						var _this = this,
9380							isScrolling;
9381						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
9382							var delayAttr = parseFloat( $(_this).attr('data-delay') );
9383							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
9384							requestTimeout(function() {
9385								$(_this).addClass('start_animation');
9386							}, delayAttr + animationIncrease);
9387							animationIncrease += 150;
9388						}
9389					});
9390				};
9391				checkForAnimations();
9392
9393				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
9394				var start = 0;
9395
9396				var horST = ScrollTrigger.create({
9397					id: "stickySectionScrolling" + key,
9398					scrub: true,
9399					trigger: $pinTrigger[0],
9400					pin: true,
9401					anticipatePin: 1,
9402					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
9403					end: function() { return "+="+stickyScrollLength; },
9404					animation: scroll_anim,
9405					ease: Sine.easeOut,
9406					onUpdate: checkForAnimations,
9407					invalidateOnRefresh: true,
9408					onEnter: function(){
9409						$pinTrigger.addClass('enter-st');
9410					},
9411					onEnterBack: function(){
9412						$pinTrigger.addClass('enter-st');
9413					},
9414					onLeave: function(){
9415						$pinTrigger.removeClass('enter-st');
9416					},
9417					onLeaveBack: function(){
9418						$pinTrigger.removeClass('enter-st');
9419					}
9420				});
9421
9422				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
9423				window.dispatchEvent(new CustomEvent('boxResized'));
9424
9425				var testSecondTrigger = function(){
9426					animationIncrease = 0
9427					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
9428						var _this = this;
9429						if ( checkVisible(_this) ) {
9430							var delayAttr = parseFloat( $(_this).attr('data-delay') );
9431							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
9432							requestTimeout(function() {
9433								$(_this).addClass('start_animation');
9434							}, delayAttr + animationIncrease);
9435							animationIncrease += 150;
9436						}
9437					});
9438
9439				};
9440
9441				var verST = ScrollTrigger.create({
9442					id: "verticalSectionScrolling" + key,
9443					trigger: $pinTrigger[0],
9444					start: "top center",
9445					end: function() { return "+="+UNCODE.wheight; },
9446					onUpdate: testSecondTrigger,
9447					invalidateOnRefresh: true
9448				});
9449
9450				var setCTA,
9451
9452				dis_enable_ST = function(){
9453					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
9454						horST.kill();
9455						verST.kill();
9456						$pinTrigger.addClass('disabled');
9457						st_active = false;
9458					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
9459						horST.kill();
9460						verST.kill();
9461						$pinTrigger.addClass('disabled');
9462						st_active = false;
9463					}
9464				};
9465
9466				$(window).on('resize load', function() {
9467					clearRequestTimeout(setCTA);
9468					setCTA = requestTimeout(function() {
9469						dis_enable_ST();
9470						checkForAnimations();
9471					}, 500);
9472				});
9473
9474			});
9475		};
9476
9477		$(window).on( 'load', function(){
9478			horScrollSizes();
9479		});
9480		var setResize,
9481			doubleResize = true,
9482			oldW = UNCODE.wwidth;
9483		$(window).on( 'resize orientationchange', function(){
9484			if ( 'onorientationchange' in window && oldW === UNCODE.wwidth ) {
9485				return;
9486			} else {
9487				oldW = UNCODE.wwidth;
9488			}
9489			setItemsRelHeight(true);
9490			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
9491			Array.prototype.forEach.call($row_inners, function(el) {
9492				el.style.height = '';
9493				el.style.marginBottom = '';
9494			});
9495			clearRequestTimeout(setResize);
9496			setResize = requestTimeout( function(){
9497				setItemsRelHeight();
9498				horScrollSizes();
9499				ScrollTrigger.refresh();
9500				if ( doubleResize === true ) {
9501					window.dispatchEvent(new Event('resize'));
9502					doubleResize = false;
9503				} else {
9504					doubleResize = true;
9505				}
9506				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true);
9507			}, 100 );
9508		});
9509
9510		var show_pins = function(){
9511			$('.index-scroll').css({'opacity':'1'});
9512			setResize = requestTimeout( function(){
9513			}, 10 );
9514		};
9515		ScrollTrigger.addEventListener("refresh", show_pins);
9516		$(window).on( 'uncode.re-layout', function(){
9517			$('.index-scroll').css({'opacity':'0'});
9518			ScrollTrigger.refresh(true);
9519		});
9520	}
9521
9522};
9523
9524UNCODE.stickyTrigger = function( $el ) {
9525	if ( SiteParameters.is_frontend_editor ) {
9526		return false;
9527	}
9528
9529	var stickyTrigger = function(){
9530		var stickyTrick = $('.sticky-trigger').each(function(){
9531			var $sticky = $(this),
9532				$inside = $('> div', $sticky),
9533				insideH = $inside.outerHeight(),
9534				$row = $sticky.closest('.vc_row'),
9535				$uncont = $sticky.closest('.uncont'),
9536				rowBottom,
9537				uncontBottom ,
9538				diffBottom;
9539
9540			ScrollTrigger.create({
9541				trigger: $sticky,
9542				start: function(){ return "top center-=" + insideH/2; },
9543				endTrigger: $row,
9544				end:  function(){
9545					rowBottom = $row.offset().top + $row.outerHeight();
9546					uncontBottom = $uncont.offset().top + $uncont.outerHeight();
9547					diffBottom = rowBottom - uncontBottom;
9548					return "bottom center+=" + ( insideH/2 + diffBottom );
9549				},
9550				anticipatePin: true,
9551				pin: true,
9552				pinSpacing: false,
9553				scrub: true,
9554				invalidateOnRefresh: true,
9555			});
9556
9557		});
9558	},
9559	setResizeSticky;
9560
9561	$(window).on( 'load', function(){
9562		stickyTrigger();
9563	});
9564	$(window).on( 'resize', function(){
9565		clearRequestTimeout(setResizeSticky);
9566		setResizeSticky = requestTimeout( function(){
9567			stickyTrigger();
9568			ScrollTrigger.refresh();
9569		}, 1000 );
9570	});
9571
9572};
9573
9574UNCODE.revslider = function() {
9575	$(window).on("load", function() {
9576		$('rs-module').each(function(){
9577			var $slider = $(this);
9578
9579			$slider.on('revolution.slide.onloaded', function(e, data){
9580				if ( $(e.currentTarget).closest(".header-revslider").length ) {
9581					var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"),
9582						scrolltop = $(document).scrollTop();
9583					if ( style != undefined ) {
9584						UNCODE.switchColorsMenu(scrolltop, style);
9585					}
9586				}
9587			});
9588
9589			$slider.on('revolution.slide.onchange', function(e, data){
9590				if ( $(e.currentTarget).closest(".header-revslider").length ) {
9591					var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"),
9592						scrolltop = $(document).scrollTop();
9593					if ( style != undefined ) {
9594						UNCODE.switchColorsMenu(scrolltop, style);
9595					}
9596				}
9597			});
9598
9599		});
9600	});
9601};
9602
9603UNCODE.layerslider = function() {
9604	$(window).on("load", function() {
9605
9606		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
9607
9608			var slideData = slider.slides.current.data,
9609				scrolltop = $(document).scrollTop();
9610			if( slideData && slideData.skin ) {
9611
9612				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
9613
9614			}
9615		});
9616
9617	});
9618};
9619
9620UNCODE.ajax_filters = function() {
9621
9622/*************************
9623 *
9624 * Filters Menu and Widgets Area
9625 *
9626 ************************/
9627
9628 	var clear_clicked = false;
9629
9630 	var init_ajax_grid = function(){
9631
9632		var $grids = $('.ajax-grid-system:not(.init-ajax-grid)');
9633		$grids.each(function(index, val){
9634			var $body = $('body'),
9635				$grid = $(val).addClass('init-ajax-grid'),
9636				starting_point = $grid.attr('data-toggle'),
9637				$trigger = $('.uncode-toggle-ajax-filters', $grid),
9638				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid),
9639				$isotope_wrapper = $('.isotope-wrapper', $grid),
9640				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper),
9641				$sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid),
9642				$footprint = $('.ajax-filter-footprint', $grid),
9643				sidebar_w,
9644				data_w = parseFloat( $sidebar.attr('data-max-width') ),
9645				$firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'),
9646				skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark',
9647				$positioned_top = $('.ajax-filter-position-horizontal', $grid),
9648				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
9649				$close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper),
9650				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0),
9651				sidew,
9652				$inside_row = $('> .row-parent', $vc_row),
9653				bg_row,
9654				$side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper),
9655				$side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper),
9656				$apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
9657				sidebar_overlay = false,
9658				sidebar_hover = false,
9659				switchMobile = false,
9660				scrollTop;
9661
9662			if ( $vc_row.attr('class') ) {
9663				bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/);
9664			}
9665
9666			if ( bg_row != null ) {
9667				$side_header.add($side_footer).addClass(bg_row[0]);
9668			}
9669
9670			$trigger.add($apply_filters).on('click', function(e){
9671				e.preventDefault();
9672				e.stopPropagation();
9673				$grid = $('.ajax-grid-system').eq(0);
9674				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
9675				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
9676				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
9677				sidebar_w = $sidebar_wrapper.width();
9678				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
9679				if ($(this).hasClass('ajax-filter-sidebar__button--clear')) {
9680					$(this).trigger('uncode-ajax-clear-filters');
9681				}
9682				if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
9683					$grid.toggleClass('ajax-hide-filters-blanks');
9684					$sidebar.slideToggle({
9685						duration: 400,
9686						easing: 'easeOutQuad',
9687					});
9688				} else {
9689					$grid.removeClass('ajax-hide-filters-blanks');
9690					$grid.toggleClass('ajax-hide-filters');
9691					if ( $grid.hasClass('ajax-hide-filters') ) {
9692						$body.addClass('ajax-hide-filters');
9693					} else {
9694						scrollTop = $('html, body').scrollTop();
9695						$body.removeClass('ajax-hide-filters');
9696					}
9697				}
9698				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
9699					$('html, body').scrollTop(scrollTop);
9700				}
9701				return false;
9702			});
9703
9704			$close_btn.on('click', function(e){
9705				e.preventDefault();
9706				$grid = $('.ajax-grid-system').eq(0);
9707				$grid.addClass('ajax-hide-filters');
9708				if ( $grid.hasClass('ajax-hide-filters') ) {
9709					$body.addClass('ajax-hide-filters');
9710				} else {
9711					scrollTop = $('html, body').scrollTop();
9712					$body.removeClass('ajax-hide-filters');
9713				}
9714				$('html, body').scrollTop(scrollTop);
9715			});
9716
9717			$sidebar_wrapper.on('mouseover',function(){
9718				sidebar_hover = true;
9719			}).on('mouseout', function(){
9720				sidebar_hover = false;
9721			});
9722
9723			$body.off('click').on('click', function( e, from ){
9724				if ( $(e.target).closest('.ajax-filter-sidebar').length ) {
9725					return;
9726				}
9727				if (undefined !== from && from === 'select_active_attributes') {
9728					return;
9729				}
9730				if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) {
9731					$grid.add($body).addClass('ajax-hide-filters');
9732				}
9733			});
9734
9735			$sorting_trgr.on('click', function(e) {
9736				e.preventDefault();
9737			});
9738
9739			var inside_width = function(){
9740				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
9741				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
9742				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
9743				$inside_row = $('> .row-parent', $vc_row);
9744				if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) {
9745					sidew = $sidebar.width();
9746					$inside_row.css({
9747						width: sidew
9748					});
9749				} else {
9750					$inside_row.css({
9751						width: ''
9752					});
9753				}
9754			};
9755			inside_width();
9756
9757			var ajax_sidebar_position = function(e, f_editor){
9758				$grid = $('.ajax-grid-system').eq(0);
9759				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
9760				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
9761				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
9762				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
9763				$inside_row = $('> .row-parent', $vc_row);
9764				scrollTop = $('html, body').scrollTop();
9765				if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) {
9766					$grid.add($body).addClass('ajax-hide-filters');
9767					$sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />');
9768					$body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
9769					sidebar_overlay = true;
9770					$body.addClass('ajax-filter-sidebar-overlay');
9771					$sidebar_wrapper.addClass(skin);
9772					var sideHeadH = $side_header.outerHeight(),
9773						sideFooterH = $side_footer.outerHeight();
9774					if ( data_w !== '' && data_w > 0 ) {
9775						if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
9776							$sidebar.css({
9777								'max-width': data_w
9778							});
9779						} else {
9780							$sidebar.css({
9781								'max-width':'none'
9782							});
9783						}
9784					}
9785					$vc_row.css({
9786						'padding-top':sideHeadH,
9787						'padding-bottom':sideFooterH
9788					});
9789					var sidew = $sidebar.width();
9790					$inside_row.css({
9791						width: sidew
9792					});
9793					switchMobile = true;
9794				} else {
9795					if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) {
9796						scrollTop = $('html, body').scrollTop();
9797						$grid.add($body).removeClass('ajax-hide-filters');
9798					}
9799					if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) {
9800						$grid.addClass('ajax-hide-filters-blanks');
9801						$sidebar.hide();
9802					}
9803					$('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas'));
9804					$('.ajax-sidebar-placeholder', $grid).remove();
9805					sidebar_overlay = false;
9806					$body.removeClass('ajax-filter-sidebar-overlay');
9807					$sidebar_wrapper.removeClass(skin);
9808					if ( data_w !== '' && data_w > 0 ) {
9809						$sidebar.css({
9810							'max-width':'none'
9811						});
9812					}
9813					$vc_row.css({
9814						'padding-top':0,
9815						'padding-bottom':0,
9816					});
9817
9818					$inside_row.css({
9819						width: ''
9820					});
9821
9822					if ( f_editor === true ) {
9823						UNCODE.ajax_filters();
9824					}
9825
9826					switchMobile = false;
9827				}
9828				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
9829					$('html, body').scrollTop(scrollTop);
9830				}
9831			};
9832
9833			var sidebar_width = function(){
9834				if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
9835					sidebar_w = $footprint.width();
9836					$sidebar.css({ width: sidebar_w });
9837				} else {
9838					$sidebar.css({ width: '' });
9839				}
9840			};
9841			sidebar_width();
9842
9843			if ( SiteParameters.is_frontend_editor ) {
9844				ajax_sidebar_position();
9845			}
9846
9847			$(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){
9848				if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) {
9849					ajax_sidebar_position(e);
9850				}
9851				sidebar_width();
9852			});
9853
9854			$(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){
9855				ajax_sidebar_position(e, true);
9856			});
9857
9858			$isotope_wrapper.on('transitionend', function(e){
9859				if ( $(e.target).hasClass('isotope-wrapper') ) {
9860					window.dispatchEvent(new CustomEvent('boxResized'));
9861				}
9862				return false;
9863			});
9864
9865			if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) {
9866				var $grid = $('.ajax-grid-system').eq(0);
9867				$grid.addClass('ajax-hide-filters');
9868			}
9869
9870		});
9871	};
9872
9873	init_ajax_grid();
9874	$(document).on('uncode-ajax-filtered', init_ajax_grid);
9875
9876/*************************
9877 *
9878 * Hover hack
9879 *
9880 ************************/
9881 	var widget_hover_hack = function() {
9882 		$('.widget, .uncode_widget').each(function(){
9883			var $widget = $(this),
9884				class_w = $widget.attr('class'),
9885				$lis = $('ul > li', $widget).has('a'),
9886				$footer = $widget.closest('#colophon');
9887
9888			if ( class_w.indexOf('widget_yith') > 0 ) {
9889				return true;
9890			}
9891
9892			$lis.each(function(){
9893 				var $li = $(this),
9894 					$a = $('a', $li),
9895 					$label = $a.closest('label');
9896
9897				if ( !$footer.length ) {
9898					$li.addClass('no-evts');
9899				}
9900		
9901				if ( ! $('span', $a).length ) {
9902 					$li.addClass( 'li-hover' );
9903 				}
9904
9905 				$('li', $li).hover(function(e){
9906 					$(e.target).parents('li').each(function(){
9907 						$(this).addClass( 'parent-li-hover' );
9908 					});
9909 				}, function(e){
9910 					$(e.target).parents('li').each(function(key, val){
9911 						if ( key === 0) {
9912	 						$(val).removeClass( 'parent-li-hover' );
9913	 					}
9914 					});
9915 				});
9916
9917	 			$li.off('mouseup').on('mouseup', function(e){
9918	 				e.stopPropagation();
9919	 				var $a = $('a', this).first();
9920	 				$a[0].click();
9921	 			});
9922 			});
9923 		});
9924 	}
9925	widget_hover_hack();
9926	$(document).on('uncode-ajax-filtered', widget_hover_hack);
9927
9928/*************************
9929 *
9930 * Init Filters
9931 *
9932 ************************/
9933
9934	function init_filters() {
9935		$(document).on('click', '.term-filter-link', function(e) {
9936			var _this = $(this);
9937			var widget = _this.closest('.uncode_widget');
9938			var container = get_filters_container();
9939
9940			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
9941				return true;
9942			}
9943
9944			e.preventDefault();
9945
9946			if (widget.hasClass('widget-ajax-filters--checkbox')) {
9947				_this.parent().find('input[type="checkbox"]').trigger('click');
9948			} else {
9949				if (_this.hasClass('term-filter-link--active')) {
9950					_this.removeClass('term-filter-link--active');
9951				} else {
9952					_this.addClass('term-filter-link--active');
9953
9954					if (widget.hasClass('widget-ajax-filters--single')) {
9955						widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active');
9956					}
9957				}
9958
9959				var url = _this.attr('href');
9960
9961				reload_items(container, url, true);
9962			}
9963		});
9964
9965		$(document).on('click', '.term-filter input[type="checkbox"]', function(e) {
9966			var _this = $(this);
9967			var widget = _this.closest('.uncode_widget');
9968			var link = _this.closest('.term-filter').find('.term-filter-link');
9969			var url = link.attr('href');
9970			var container = get_filters_container();
9971
9972			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
9973				window.location = url;
9974				return;
9975			}
9976
9977			if (widget.hasClass('widget-ajax-filters--single')) {
9978				widget.find('input[type="checkbox"]').each(function() {
9979					if (_this.attr('id') !== $(this).attr('id')) {
9980						$(this).prop('checked', false);
9981						$(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active');
9982					}
9983				});
9984			}
9985
9986			if (_this.prop('checked')) {
9987				link.addClass('term-filter-link--active');
9988			} else {
9989				link.removeClass('term-filter-link--active');
9990			}
9991
9992			reload_items(container, url, true);
9993		});
9994
9995		$(document).on('change', 'select.select--term-filters', function(e) {
9996			var _this = $(this);
9997			var selected = _this.find('option:selected');
9998			var option = $(selected);
9999			var url = option.attr('data-term-filter-url');
10000			var container = get_filters_container();
10001			var widget = _this.closest('.uncode_widget');
10002
10003			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
10004				window.location = url;
10005			} else {
10006				reload_items(container, url, true);
10007			}
10008		});
10009
10010		$(document).on('click', '.filter-list__link', function(e) {
10011			if (SiteParameters.is_frontend_editor) {
10012				return false;
10013			}
10014
10015			e.preventDefault();
10016
10017			var _this = $(this);
10018			var container = get_filters_container();
10019			var url = _this.attr('href');
10020			reload_items(container, url, true);
10021		});
10022
10023		$('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) {
10024			var _this = $(this);
10025			var container = get_filters_container();
10026			var url = _this.attr('href');
10027			reload_items(container, url, true);
10028		});
10029
10030		$(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) {
10031
10032			var _this = $(this);
10033			var container = get_filters_container();
10034			var url = _this.attr('href');
10035
10036			if ( container.length ) {
10037				e.preventDefault();
10038				reload_items(container, url, true);
10039			}
10040		});
10041
10042		$(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) {
10043			var _this = $(this);
10044			var container = get_filters_container();
10045
10046			if (container.length > 0) {
10047				e.preventDefault();
10048
10049				var min_price = $('#min_price').val();
10050				var max_price = $('#max_price').val();
10051				var location = window.location;
10052				var url = location.href;
10053				var page_uri = location.origin + location.pathname;
10054				var is_filtered = page_uri !== url;
10055
10056				if (is_filtered) {
10057					url = remove_parameter_from_url(url, 'min_price');
10058					url = remove_parameter_from_url(url, 'max_price');
10059				}
10060
10061				var concat = page_uri === url ? '?' : '&';
10062				var params = {'min_price': min_price, 'max_price': max_price};
10063
10064				url = url + concat + $.param(params);
10065
10066				reload_items(container, url, true);
10067			}
10068		});
10069
10070		var search_timer;
10071
10072		$(document).on('keyup', '.term-filters-search-input', function(e) {
10073			var _this = $(this);
10074			var container = get_filters_container();
10075			var value = _this.val();
10076
10077			if (search_timer) {
10078				clearTimeout(search_timer);
10079			}
10080
10081			search_timer = setTimeout(function() {
10082				update_search_url(container, value);
10083			}, 500);
10084		});
10085	}
10086
10087	function update_search_url(container, search_value) {
10088		var location = window.location;
10089		var url = location.href;
10090		var page_uri = location.origin + location.pathname;
10091		var is_filtered = page_uri !== url;
10092		var key_search = SiteParameters.ajax_filter_key_search;
10093		var key_unfilter = SiteParameters.ajax_filter_key_unfilter;
10094
10095		if (is_filtered) {
10096			url = remove_parameter_from_url(url, key_search);
10097			url = remove_parameter_from_url(url, key_unfilter);
10098		}
10099
10100		if (search_value) {
10101			var concat = page_uri === url ? '?' : '&';
10102			var params = {};
10103
10104			params[key_search] = search_value;
10105			params[key_unfilter] = 1;
10106			url = url + concat + $.param(params);
10107		} else {
10108			url = remove_parameter_from_url(url, key_search);
10109		}
10110
10111		reload_items(container, url, true);
10112	}
10113
10114	function remove_parameter_from_url(url, parameter) {
10115		return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
10116	}
10117
10118	function get_filters_container() {
10119		var container = $('.ajax-grid-system');
10120
10121		if (container.length == 0) {
10122			container = $('.ajax-filters');
10123		}
10124
10125		return container;
10126	}
10127
10128	function update_widgets_state(widgets_states, container) {
10129		for (var i = widgets_states.length - 1; i >= 0; i--) {
10130			var state = widgets_states[i];
10131
10132			if (!state.collapse) {
10133				continue;
10134			}
10135
10136			var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"');
10137
10138			if (state.open) {
10139				new_widget.find('.widget-title').addClass('open');
10140				if (state.css) {
10141					new_widget.find('.widget-collapse-content').attr('style', state.css);
10142				}
10143			} else {
10144				new_widget.find('.widget-title').removeClass('open');
10145				if (state.css) {
10146					new_widget.find('.widget-collapse-content').attr('style', state.css);
10147				}
10148			}
10149		}
10150	}
10151
10152	// Reload items via AJAX
10153	function reload_items(container, url, push) {
10154		container.addClass('grid-filtering');
10155
10156		$.ajax({
10157			url     : url,
10158			success : function(response) {
10159				if (!response) {
10160					return;
10161				}
10162
10163				$(document).trigger('uncode-ajax-pre-filtered');
10164
10165				var container_id = container.attr('id');
10166				var pagination = $('.row-navigation');
10167
10168				if (container_id) {
10169					var container_to_append = $(response).find('#' + container_id);
10170					var pagination_to_append = $(response).find('.row-navigation');
10171					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
10172
10173					// Remember open/closed widgets
10174					var widgets = $('.uncode_widget');
10175					var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append;
10176					var widgets_states = [];
10177
10178					widgets.each(function() {
10179						var widget = $(this);
10180						var id = widget.attr('data-id');
10181						var state = {
10182							'id': id,
10183							'collapse': false,
10184							'open': false,
10185							'css': false,
10186						};
10187
10188						var collapse_wrapper = widget.find('.widget-collapse-content');
10189
10190						if (collapse_wrapper.length > 0) {
10191							state.collapse = true;
10192
10193							var collapse_wrapper_css = collapse_wrapper.attr('style');
10194							var title = widget.find('.widget-title');
10195
10196							state.css = collapse_wrapper_css;
10197
10198							if (title.hasClass('open')) {
10199								state.open = true;
10200							} else {
10201								state.open = false;
10202							}
10203						}
10204
10205						widgets_states.push(state);
10206					});
10207
10208					// Update widgets state
10209					if (offcanvas_sidebar_wrapper.length === 0) {
10210						update_widgets_state(widgets_states, container_to_append);
10211					}
10212
10213					// Update default sidebar state
10214					if (!container.hasClass('ajax-hide-filters')) {
10215						container_to_append.removeClass('ajax-hide-filters');
10216					}
10217
10218					// Update horizontal sidebar
10219					if (!container.hasClass('ajax-hide-filters-blanks')) {
10220						container_to_append.removeClass('ajax-hide-filters-blanks');
10221					}
10222					var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal');
10223					if (horizontal_sidebar_wrapper.length > 0) {
10224						var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar');
10225						var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style');
10226						var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0);
10227						var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style');
10228
10229						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style);
10230						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style);
10231					}
10232
10233					// Append container
10234					container.replaceWith(container_to_append);
10235
10236					// Append pagination
10237					if (pagination.length > 0) {
10238						if (pagination_to_append.length > 0) {
10239							pagination.html(pagination_to_append.html());
10240						} else {
10241							pagination.html('');
10242						}
10243					} else {
10244						if (pagination_to_append.length > 0) {
10245							$('.post-wrapper').append(pagination_to_append);
10246						}
10247					}
10248
10249					// Update off canvas sidebar (mobile and overlay)
10250					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
10251
10252					if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) {
10253						var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0);
10254						var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0);
10255						container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />');
10256						container_to_append.find('.ajax-filter-sidebar-wrapper').remove();
10257
10258						// Update widgets state
10259						update_widgets_state(widgets_states, sidebar_to_append);
10260
10261						// Update sidebar
10262						sidebar_container.html(sidebar_to_append.html());
10263					}
10264
10265					if (push) {
10266						UNCODE.lastURL = url;
10267						window.history.pushState(
10268							{ pageTitle: document.title },
10269							'',
10270							url
10271						);
10272					}
10273
10274					if (typeof UNCODE.isotopeLayout !== 'undefined') {
10275						UNCODE.isotopeLayout();
10276					}
10277					if (typeof UNCODE.justifiedGallery !== 'undefined') {
10278						UNCODE.justifiedGallery();
10279					}
10280					if (typeof UNCODE.cssGrid !== 'undefined') {
10281						UNCODE.cssGrid();
10282					}
10283					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
10284						UNCODE.lightbox();
10285					}
10286					if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
10287						UNCODE.lightgallery();
10288					}
10289					if (typeof UNCODE.carousel !== 'undefined') {
10290						UNCODE.carousel($('body'));
10291					}
10292					UNCODE.animations();
10293					if (typeof UNCODE.filters !== 'undefined') {
10294						UNCODE.filters();
10295					}
10296					if (typeof UNCODE.widgets !== 'undefined') {
10297						UNCODE.widgets();
10298					}
10299
10300					if (SiteParameters.dynamic_srcset_active === '1') {
10301						UNCODE.refresh_dynamic_srcset_size();
10302					}
10303
10304					if (typeof UNCODE.menuSmartInit !== 'undefined') {
10305						UNCODE.menuSmartInit();
10306					}
10307
10308					maybe_scroll_to_top();
10309
10310					$(document).trigger('uncode-ajax-filtered');
10311					$(document.body).trigger('init_price_filter');
10312				}
10313			},
10314			error: function() {
10315				container.removeClass('grid-filtering');
10316
10317				if (SiteParameters.enable_debug == true) {
10318					// This console log is disabled by default
10319					// So nothing is printed in a typical installation
10320					//
10321					// It can be enabled for debugging purposes setting
10322					// the 'uncode_enable_debug_on_js_scripts' filter to true
10323					console.log('There was an error retrieving the products');
10324				}
10325			}
10326		});
10327	}
10328
10329	// Scroll to top after filtering
10330	function maybe_scroll_to_top() {
10331		var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
10332
10333		if (offcanvas_sidebar_wrapper.length > 0) {
10334			return;
10335		}
10336
10337		var container = get_filters_container();
10338		var bound = container[0].getBoundingClientRect();
10339
10340		if (bound.y < 0) {
10341			$(window).scrollTop(container.offset().top);
10342		}
10343	}
10344
10345	// Back/forward browser buttons
10346	$(window).on("popstate.ajaxfilters", function(e) {
10347		var location = window.location;
10348		var url = location.href;
10349		var params = UNCODE.getURLParams(window.location);
10350		var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
10351
10352		UNCODE.lastURL = url;
10353
10354		if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
10355			return;
10356		}
10357
10358		var container = get_filters_container();
10359
10360		reload_items(container, url, false);
10361	});
10362
10363	// Destroy load more before to init a new one
10364	$(window).on('uncode-ajax-pre-filtered', function() {
10365		if ($.fn.infinitescroll) {
10366			$('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy');
10367		}
10368	});
10369
10370	init_filters();
10371};
10372
10373	UNCODE.init = function() {
10374		var wfl_check = false, wfl_request, waypoint_request;
10375		UNCODE.preventDoubleTransition();
10376		UNCODE.betterResize();
10377		UNCODE.utils();
10378		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
10379			UNCODE.changeSkinOnScroll();
10380		}
10381		if (typeof UNCODE.share !== 'undefined') {
10382			UNCODE.share();
10383		}
10384		if (typeof UNCODE.tooltip !== 'undefined') {
10385			UNCODE.tooltip();
10386		}
10387		if (typeof UNCODE.counters !== 'undefined') {
10388			UNCODE.counters();
10389		}
10390		if (typeof UNCODE.countdowns !== 'undefined') {
10391			UNCODE.countdowns();
10392		}
10393		if (typeof UNCODE.tabs !== 'undefined') {
10394			UNCODE.tabs();
10395		}
10396		if (typeof UNCODE.collapse !== 'undefined') {
10397			UNCODE.collapse();
10398		}
10399		if (typeof UNCODE.bigText !== 'undefined') {
10400			UNCODE.bigText();
10401		}
10402		UNCODE.menuSystem();
10403		if (typeof UNCODE.bgChanger !== 'undefined') {
10404			UNCODE.bgChanger();
10405		}
10406		if (typeof UNCODE.magicCursor !== 'undefined') {
10407			UNCODE.magicCursor();
10408		}
10409		if (typeof UNCODE.magneticCursor !== 'undefined') {
10410			UNCODE.magneticCursor();
10411		}
10412		if (typeof UNCODE.dropImage !== 'undefined') {
10413			UNCODE.dropImage();
10414		}
10415		if (typeof UNCODE.postTable !== 'undefined') {
10416			UNCODE.postTable();
10417		}
10418		if (typeof UNCODE.rotatingTxt !== 'undefined') {
10419			UNCODE.rotatingTxt();
10420		}
10421		if (typeof UNCODE.okvideo !== 'undefined') {
10422			UNCODE.okvideo();
10423		}
10424		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
10425			UNCODE.backgroundSelfVideos();
10426		}
10427		UNCODE.tapHover();
10428		if (typeof UNCODE.isotopeLayout !== 'undefined') {
10429			UNCODE.isotopeLayout();
10430		}
10431		if (typeof UNCODE.justifiedGallery !== 'undefined') {
10432			UNCODE.justifiedGallery();
10433		}
10434		if (typeof UNCODE.cssGrid !== 'undefined') {
10435			UNCODE.cssGrid();
10436		}
10437		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
10438			UNCODE.lightbox();
10439		}
10440		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
10441			$(window).on('load',function(){
10442				UNCODE.lightgallery();
10443			});
10444		}
10445		if (typeof UNCODE.carousel !== 'undefined') {
10446			UNCODE.carousel($('body'));
10447		}
10448		if (typeof UNCODE.lettering !== 'undefined') {
10449			UNCODE.lettering();
10450		}
10451		UNCODE.animations();
10452		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
10453			UNCODE.stickyElements();
10454		}
10455		if (typeof UNCODE.twentytwenty !== 'undefined') {
10456			UNCODE.twentytwenty();
10457		}
10458		UNCODE.disableHoverScroll();
10459		UNCODE.printScreen();
10460		if (typeof UNCODE.particles !== 'undefined') {
10461			UNCODE.particles();
10462		}
10463		if (typeof UNCODE.filters !== 'undefined') {
10464			UNCODE.filters();
10465		}
10466		if (typeof UNCODE.ajax_filters !== 'undefined') {
10467			UNCODE.ajax_filters();
10468		}
10469		if (typeof UNCODE.widgets !== 'undefined') {
10470			UNCODE.widgets();
10471		}
10472		if (typeof UNCODE.unmodal !== 'undefined') {
10473			UNCODE.unmodal();
10474		}
10475		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
10476			if ( !UNCODE.isFullPage ) {
10477				UNCODE.checkScrollForTabs();
10478			}
10479		}
10480		if (typeof UNCODE.onePage !== 'undefined') {
10481			UNCODE.onePage(UNCODE.isMobile);
10482		}
10483		if (typeof UNCODE.fullPage !== 'undefined') {
10484			$(document).ready(function(){
10485				UNCODE.fullPage();
10486			});
10487		}
10488		if (typeof UNCODE.skewIt !== 'undefined') {
10489			UNCODE.skewIt();
10490		}
10491		if (typeof UNCODE.rotateIt !== 'undefined') {
10492			UNCODE.rotateIt();
10493		}
10494		if (typeof UNCODE.textMarquee !== 'undefined') {
10495			UNCODE.textMarquee();
10496		}
10497		if (typeof UNCODE.stickyScroll !== 'undefined') {
10498			UNCODE.stickyScroll();
10499		}
10500		if (typeof UNCODE.stickyTrigger !== 'undefined') {
10501			UNCODE.stickyTrigger();
10502		}
10503		if (typeof UNCODE.verticalText !== 'undefined') {
10504			UNCODE.verticalText();
10505		}
10506		if (typeof UNCODE.revslider !== 'undefined') {
10507			UNCODE.revslider();
10508		}
10509		if (typeof UNCODE.layerslider !== 'undefined') {
10510			UNCODE.layerslider();
10511		}
10512		$(window).on('load',function(){
10513			clearRequestTimeout(waypoint_request);
10514			waypoint_request = requestTimeout( function(){
10515				Waypoint.refreshAll();
10516			}, 1000);
10517
10518			if (typeof UNCODE.parallax !== 'undefined') {
10519				UNCODE.parallax();
10520			}
10521		});
10522	}
10523
10524	if ( ! SiteParameters.is_frontend_editor ) {
10525		UNCODE.init();
10526	}
10527
10528
10529})(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.