PageSourceSearch

https://cathedralridgewinery.com/wp-content/themes/uncode/library/js/app.js?ver=122677401

js cathedralridgewinery.com collected 2026-09-26 04:38:02 UTC 181,849 bytes, 5,470 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
55Number.isInteger = Number.isInteger || function(value) {
56    return typeof value === "number" &&
57           isFinite(value) &&
58           Math.floor(value) === value;
59};
60
61UNCODE.utils = function() {
62	$('.btn-tooltip').tooltip();
63	$(document).on('mouseover', 'a', function() {
64		$(this).attr('data-title', $(this).attr('title'));
65		$(this).removeAttr('title');
66	});
67	$(document).on('mouseout', 'a', function() {
68		$(this).attr('title', $(this).attr('data-title'));
69		$(this).removeAttr('data-title');
70	});
71	var $counters = $('.counter:not(.counter-init)');
72	$counters.each(function(){
73		var $counter = $(this).addClass('counter-init');
74		if ( $counter.closest( '.owl-carousel' ).length ) {
75			return;
76		}
77		$counter.addClass('started').counterUp({
78			delay: 10,
79			time: 1500
80		});
81	});
82	var $countdowns = $('[data-uncode-countdown]:not(.counter-init)');
83	$countdowns.each(function() {
84		var $this = $(this).addClass('counter-init'),
85			finalDate = $(this).data('uncode-countdown');
86		$this.countdown(finalDate, function(event) {
87			$this.html(event.strftime('%D <small>' + SiteParameters.days + '</small> %H <small>' + SiteParameters.hours + '</small> %M <small>' + SiteParameters.minutes + '</small> %S <small>' + SiteParameters.seconds + '</small>'));
88		});
89	});
90
91	var share_button_element = $('.share-button');
92	var share_button_url = share_button_element.data('url');
93
94	var share_button_config = {
95		ui: {
96			flyout: "top center",
97			button_font: false,
98			button_text: '',
99			icon_font: false
100		}
101	};
102
103	if (share_button_url) {
104		share_button_config.url = share_button_url.replace("&", "%26");
105	}
106
107	var share_button_top = new Share('.share-button', share_button_config);
108
109	this.get_scroll_offset = function(e) {
110
111		var scroll_offset = 0,
112			is_first_link = false,
113			target,
114			trigger;
115
116		if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) {
117			target = e.target;
118			trigger = e.currentTarget;
119		}
120
121		if ($('.menu-hide').length || $('.menu-hide-vertical').length) {
122			if (UNCODE.bodyTop > UNCODE.wheight / 2) {
123				UNCODE.hideMenu(100);
124			}
125		}
126
127		if ( UNCODE.wwidth < UNCODE.mediaQuery && $('body').hasClass('menu-mobile-transparent') ) {
128			scroll_offset += $('#logo-container-mobile').outerHeight();
129		} else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) {
130			scroll_offset += $('.menu-sticky .menu-container').outerHeight();
131		} else {
132			if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) {
133				scroll_offset += UNCODE.menuMobileHeight;
134			} else {
135				if ( typeof target !== 'undefined' && target.closest('.main-menu-container') != null && UNCODE.wwidth < UNCODE.mediaQuery && ! $('body').hasClass('menu-mobile-transparent') && ! $('.menu-sticky').length ) {
136					scroll_offset += $('.main-menu-container > div:first-child()').height() - 2;
137				} else {
138					if ( $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) {
139						scroll_offset += UNCODE.menuMobileHeight;
140					}
141				}
142			}
143		}
144
145		scroll_offset += UNCODE.bodyBorder;
146
147		return scroll_offset;
148	}
149
150	if ( !UNCODE.isFullPage ) {
151		$(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link)', function(e) {
152
153			var hash = (e.currentTarget).hash,
154			is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false,
155			anchor = '';
156			if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return;
157			if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) {
158				e.preventDefault();
159				if (!$('#tab-reviews').is(':visible')) {
160					$('a[href="#tab-reviews"]').trigger('click');
161				}
162				var calc_scroll = $('.wootabs .tab-content').offset().top;
163				calc_scroll -= UNCODE.get_scroll_offset(e);
164
165				var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
166
167				if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
168					scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
169				}
170
171				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
172					delta = bodyTop - calc_scroll,
173					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
174				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
175
176				requestTimeout(function(){
177					if (scrollSpeed == 0) {
178						$('html, body').scrollTop(calc_scroll);
179						UNCODE.scrolling = false;
180					} else {
181   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
182							$(this).stop();
183						}).animate({
184								scrollTop: calc_scroll
185							}, scrollSpeed, 'easeInOutCubic', function() {
186								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
187								UNCODE.scrolling = false;
188							}
189						);
190					}
191				}, 200);
192				return;
193			}
194			if (hash != undefined) {
195				var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
196				var anchor = this.hash.slice(1);
197				if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) {
198			  		if ( !specialFormat.test(hash) ) {
199			  			if ( $(hash).length )
200			  				anchor = $(hash);
201			  		}
202				}
203			}
204
205			if (is_scrolltop || anchor != '') {
206				if (is_scrolltop) {
207					e.preventDefault();
208					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
209					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
210					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
211
212					if (scrollSpeed == 0) {
213						$('html, body').scrollTop(0);
214						UNCODE.scrolling = false;
215					} else {
216   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
217							$(this).stop();
218						}).animate({
219							scrollTop: 0
220						}, scrollSpeed, 'easeInOutCubic', function() {
221							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
222							UNCODE.scrolling = false;
223						});
224					}
225				} else {
226					var scrollSection = (typeof anchor === 'string') ? $('[data-name=' + anchor + ']') : anchor;
227					$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) {
228						var get_href = $(val).attr('href');
229						if (get_href != undefined) {
230							if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active');
231							else $(val).parent().removeClass('active');
232						}
233					});
234					if (scrollSection.length) {
235						if ( $('body').hasClass('uncode-scroll-no-history') ) {
236							e.preventDefault();
237						}
238
239						if (UNCODE.menuOpened) {
240							if (UNCODE.wwidth < UNCODE.mediaQuery) {
241								window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
242							} else {
243								$('.mmb-container-overlay .overlay-close').trigger('click');
244							}
245						}
246
247						var calc_scroll = scrollSection.offset().top,
248							getOffset = UNCODE.get_scroll_offset(e),
249							$logo = $('#logo-container-mobile'),
250							logoH,
251							$menu = $('#masthead .menu-container'),
252							menuH;
253
254						calc_scroll -= getOffset;
255
256						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
257							delta = bodyTop - calc_scroll,
258							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
259						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
260
261						if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) {
262							logoH = $logo.outerHeight(),
263							menuH = $menu.outerHeight();
264							if ( calc_scroll < ( logoH + menuH ) ) {
265								calc_scroll = 0;
266							}
267						}
268
269						if (scrollSpeed == 0) {
270							$('html, body').scrollTop(calc_scroll);
271							UNCODE.scrolling = false;
272						} else {
273	   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
274								$(this).stop();
275							}).animate({
276								scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
277							}, scrollSpeed, 'easeInOutCubic', function() {
278								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
279								UNCODE.scrolling = false;
280								if (getOffset != UNCODE.get_scroll_offset(e)) {
281									calc_scroll = scrollSection.offset().top;
282									getOffset = UNCODE.get_scroll_offset(e);
283									calc_scroll -= getOffset;
284									$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
285										$(this).stop();
286									}).animate({
287										scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
288										}, scrollSpeed, 'easeInOutCubic', function() {
289											$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
290											UNCODE.scrolling = false;
291										}
292									);
293								}
294							});
295						}
296					}
297				}
298			}
299		});
300		$('.header-scrolldown').on('click', function(event) {
301
302			event.preventDefault();
303
304			var pageHeader = $(event.target).closest('#page-header'),
305				pageHeaderTop = pageHeader.offset().top,
306				pageHeaderHeight = pageHeader.outerHeight(),
307				scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
308			if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
309
310			var calc_scroll = pageHeaderTop + pageHeaderHeight,
311			getOffset = UNCODE.get_scroll_offset(event);
312			calc_scroll -= getOffset;
313
314			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
315
316			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
317				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
318			}
319
320			if (scrollSpeed == 0) {
321				$('html, body').scrollTop(calc_scroll);
322				UNCODE.scrolling = false;
323			} else {
324					$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
325						$(this).stop();
326					}).animate({
327						scrollTop: calc_scroll
328					}, scrollSpeed, 'easeInOutCubic', function() {
329						$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
330						UNCODE.scrolling = false;
331						if (getOffset != UNCODE.get_scroll_offset(event)) {
332							calc_scroll = pageHeaderTop + pageHeaderHeight;
333							getOffset = UNCODE.get_scroll_offset(event);
334							calc_scroll -= getOffset;
335								$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
336									$(this).stop();
337								}).animate({
338									scrollTop: calc_scroll
339								}, scrollSpeed, 'easeInOutCubic', function() {
340									$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
341									UNCODE.scrolling = false;
342								}
343							);
344						}
345					}
346				);
347			}
348		});
349	}
350	// TAB DATA-API
351	// ============
352	$(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function(e) {
353		e.preventDefault()
354		$(this).tab('show');
355		requestTimeout(function() {
356			window.dispatchEvent(UNCODE.boxEvent);
357		}, 300);
358	});
359	// COLLAPSE DATA-API
360	// =================
361	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
362		var $this = $(this),
363			href
364		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
365		var $target = $(target)
366		var data = $target.data('bs.collapse')
367		var option = data ? 'toggle' : $this.data()
368		var parent = $this.attr('data-parent')
369		var $parent = parent && $(parent)
370		var $title = $(this).parent()
371		if ($parent) {
372			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
373			if ($title.hasClass('active')) {
374				$title.removeClass('active');
375			} else {
376				$parent.find('.panel-title').removeClass('active')
377				$title[!$target.hasClass('in') ? 'addClass' : 'removeClass']('active')
378			}
379		}
380		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
381	});
382	// FitText
383	// =================
384	window.uncode_textfill = function(el, loaded) {
385		if (el == undefined) el = $('body');
386		$.each($('.bigtext', el), function(index, val) {
387			$(val).bigtext({
388				minfontsize: 24
389			});
390			if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
391				opacity: 1
392			});
393			requestTimeout(function() {
394				if ($(val).find('.animate_when_almost_visible').length != 0) {
395					$(val).css({opacity: 1});
396				}
397			}, 400);
398		});
399	}
400	window.uncode_textfill();
401
402	// Colomun hover effect
403	// =================
404	$(document).on('mouseenter', '.col-link', function(e) {
405		var uncol = $(e.target).prev('.uncol'),
406		el = uncol.find('.column-background');
407		if (el) {
408			$('.btn-container .btn', uncol).toggleClass('active');
409			var elOverlay = $(el[0]).find('.block-bg-overlay');
410			if (elOverlay.length) {
411				var getOpacity = $(elOverlay).css('opacity');
412				if (getOpacity != 1) {
413					getOpacity = Math.round(getOpacity * 100) / 100;
414					var newOpacity = getOpacity + .1;
415					$(elOverlay).data('data-opacity', getOpacity);
416					$(elOverlay).css('opacity', newOpacity);
417				}
418			}
419		}
420	}).on('mouseleave', '.col-link', function(e) {
421		var uncol = $(e.target).prev('.uncol'),
422		el = uncol.find('.column-background');
423		$('.btn-container .btn', uncol).toggleClass('active');
424		if (el) {
425			var elOverlay = $(el[0]).find('.block-bg-overlay');
426			if (elOverlay.length) {
427				var getOpacity = $(elOverlay).data('data-opacity');
428				$(elOverlay).css('opacity', getOpacity);
429			}
430		}
431	});
432
433	// REVSLIDER API
434	// ============
435	$(window).on("load", function() {
436		$('.rev_slider_wrapper, rs-module-wrap').each(function(){
437			var $this = jQuery(this),
438   		id_array = $this.attr("id").split("_"),
439   		id = id_array[2];
440   		if (id != undefined && id != '') {
441				$.globalEval('revapi'+id+'.bind("revolution.slide.onloaded",function (e, data) { if (jQuery(e.currentTarget).closest(".header-revslider").length) { var style = jQuery(e.currentTarget).find("li, rs-slide").eq(0).attr("data-skin"), scrolltop = jQuery(document).scrollTop(); if (style != undefined) UNCODE.switchColorsMenu(scrolltop, style);}})');
442				$.globalEval('revapi'+id+'.bind("revolution.slide.onchange",function (e,data) { if (jQuery(e.currentTarget).closest(".header-revslider").length) { var style = jQuery(e.currentTarget).find("li, rs-slide").eq(data.slideIndex - 1).attr("data-skin"), scrolltop = jQuery(document).scrollTop(); if (style != undefined) UNCODE.switchColorsMenu(scrolltop, style);}})');
443   		}
444		});
445	});
446
447	// LAYERSLIDE API
448	// ============
449	$(window).on("load", function() {
450
451		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
452
453			var slideData = slider.slides.current.data,
454				scrolltop = $(document).scrollTop();
455			if( slideData && slideData.skin ) {
456
457				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
458
459			}
460		});
461
462	});
463	// Admin bar
464	// ============
465	$(window).resize(function() {
466		if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) {
467			var getAdminBar = $('#wpadminbar');
468			if (getAdminBar.length) {
469				if (getAdminBar.css('position') !== 'hidden') {
470					var getAdminBarHeight = getAdminBar.height();
471					if (getAdminBar.css('position') === 'fixed') {
472						$('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'});
473						$('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'});
474					} else {
475						$('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'});
476						$('.body-borders .top-border').css({'margin-top':'0px'});
477					}
478				}
479			}
480		}
481	});
482	// Facebook
483	// ===========
484 	this.fb_timeout = undefined;
485	$(window).resize(function() {
486		$('.facebook-object').each(function(index, el) {
487			var el = $(el),
488			parentWidth = el.closest('.tmb').width();
489			el.width(parentWidth);
490		});
491		if (this.fb_timeout == undefined) {
492			if ($('.facebook-object').length) {
493				window.clearTimeout(this.fb_timeout);
494				this.fb_timeout = window.setTimeout(function(msg) {
495		  	window.dispatchEvent(UNCODE.boxEvent);
496			}, 1000);
497			}
498		}
499	});
500	// Print
501	// ===========
502	var beforePrint = function() {
503		window.dispatchEvent(new CustomEvent('resize'));
504		window.dispatchEvent(UNCODE.boxEvent);
505	};
506
507	if (window.matchMedia) {
508		var mediaQueryList = window.matchMedia('print');
509		mediaQueryList.addListener(function(mql) {
510			if (mql.matches) {
511				beforePrint();
512			}
513		});
514	}
515
516	window.onbeforeprint = beforePrint;
517}
518
519UNCODE.lettering = function() {
520
521	var setCTA;
522	var highlightStill = function(){
523
524		var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)');
525
526		$.each($heading_texts, function(key, el) {
527			var $heading = $(el);
528
529			if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) {
530				return;
531			}
532
533			if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) {
534				return;
535			}
536
537			var waypoint = new Waypoint({
538				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
539				element: el,
540				handler: function() {
541					var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element),
542						anims_l = $anims.length;
543					$anims.each(function(_key_, _el_){
544						var $anim = $(_el_);
545
546						if ( ! $anim.hasClass('heading-text-highlight-animated') ) {
547							$anim.addClass('heading-text-highlight-animated');
548
549							if ( $heading.data('animate') === true ) {
550								$anim.css({
551									'-webkit-transition-duration': '0ms',
552									'-moz-transition-duration': '0ms',
553									'-o-transition-duration': '0ms',
554									'transition-duration': '0ms',
555								});
556							} else {
557								$anim.css({
558									'-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms',
559									'-moz-transition-delay': ((_key_ + 2) * 200) + 'ms',
560									'-o-transition-delay': ((_key_ + 2) * 200) + 'ms',
561									'transition-delay': ((_key_ + 2) * 200) + 'ms',
562								});
563							}
564						}
565
566					});
567					$anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) {
568						$heading.data('animate', true);
569					});
570					$anims.removeAttr('data-animated');
571				},
572				offset: '100%'
573			});
574
575		});
576
577		Waypoint.refreshAll();
578		$( document.body ).trigger('uncode_waypoints');
579
580	}
581
582	requestTimeout(function(){
583		highlightStill();
584		$(window).on( 'resize', function(){
585			clearRequestTimeout(setCTA);
586			setCTA = requestTimeout( highlightStill, 100 );
587		});
588	}, 400);
589
590};
591
592UNCODE.isUnmodalOpen = false;
593
594UNCODE.menuSystem = function() {
595
596	function menuMobile() {
597		var $body = $('body'),
598			$mobileToggleButton = $('.mobile-menu-button'),
599			$box,
600			$el,
601			$el_transp,
602			elHeight,
603			check,
604			animating = false,
605			stickyMobile = false,
606			menuClose = new CustomEvent('menuMobileClose'),
607			menuOpen = new CustomEvent('menuMobileOpen');
608		UNCODE.menuOpened = false;
609		$mobileToggleButton.on('click', function(event) {
610			var btn = this;
611			if ($(btn).hasClass('overlay-close')) return;
612			event.preventDefault();
613			if (UNCODE.wwidth <= UNCODE.mediaQuery) {
614				$box = $(this).closest('.box-container').find('.main-menu-container');
615				$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner');
616				$el_transp = $('.menu-absolute.menu-transparent');
617				if (UNCODE.isMobile) {
618					if ( $('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only, .main-header .menu-sticky-vertical, .main-header .menu-hide-only-vertical').length ) {
619						stickyMobile = true;
620						elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
621					} else {
622						elHeight = 0;
623						$.each($box.find('> div'), function(index, val) {
624							elHeight += $(val).outerHeight();
625						});
626					}
627				} else {
628					elHeight = 0;
629					$.each($el, function(index, val) {
630						elHeight += $(val).outerHeight();
631					});
632				}
633				var open = function() {
634					if (!animating) {
635						$body.addClass('open-overlay-menu');
636						window.dispatchEvent(menuOpen);
637						animating = true;
638						UNCODE.menuOpened = true;
639						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) {
640							$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
641							if ($('body.menu-offcanvas').length) {
642								$('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed'});
643								$('.vmenu-container.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + 
643UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
644							} else {
645								if ( $('.menu-hide, .menu-sticky').length ) {
646									$('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed'});
647								}
648							}
649						}
650						if ($('body.hmenu-center').length && ($('.menu-hide, .menu-sticky').length)) {
651							$('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
652						}
653						btn.classList.add('close');
654						$box.addClass('open-items');
655						if ($el_transp.length && $('body.menu-mobile-transparent').length) {
656							$el_transp.addClass('is_mobile_open');
657						}
658						$box.animate({
659							height: elHeight
660						}, 600, "easeInOutCirc", function() {
661							animating = false;
662							if (!stickyMobile) $box.css('height', 'auto');
663						});
664					}
665				};
666
667				var close = function() {
668					if (!animating) {
669						window.dispatchEvent(menuClose);
670						animating = true;
671						UNCODE.menuOpened = false;
672						btn.classList.remove('close');
673						btn.classList.add('closing');
674						$box.addClass('close');
675						requestTimeout(function() {
676							$box.removeClass('close');
677							$box.removeClass('open-items');
678							btn.classList.remove('closing');
679							if ($el_transp.length) {
680								$el_transp.removeClass('is_mobile_open');
681							}
682						}, 500);
683						$box.animate({
684							height: 0
685						}, {
686							duration: 600,
687							easing: "easeInOutCirc",
688							complete: function(elements) {
689								$(elements).css('height', '');
690								animating = false;
691								if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) {
692									$('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.isotope-filters)').css('position','relative');
693								}
694								$body.removeClass('open-overlay-menu');
695							}
696						});
697					}
698				};
699				check = (!UNCODE.menuOpened) ? open() : close();
700			}
701		});
702		window.addEventListener('menuMobileTrigged', function(e) {
703			$('.mobile-menu-button.close').trigger('click');
704		});
705		window.addEventListener('orientationchange', function(e) {
706			$('#logo-container-mobile .mobile-menu-button.close').trigger('click');
707		});
708		window.addEventListener("resize", function() {
709			if ($(window).width() < UNCODE.mediaQuery) {
710				if (UNCODE.isMobile) {
711					var $box = $('.box-container .main-menu-container'),
712						$el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner');
713					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto') {
714						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
715							elHeight = 0;
716							$.each($el, function(index, val) {
717								elHeight += $(val).outerHeight();
718							});
719							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;
720							$($box).css('height', elHeight + 'px');
721						}
722					}
723				}
724			} else {
725				$('.menu-hide-vertical').removeAttr('style');
726				$('.menu-container-mobile').removeAttr('style');
727				$('.vmenu-container.menu-container').removeAttr('style');
728			}
729		});
730	};
731
732	function menuOffCanvas() {
733		var menuClose = new CustomEvent('menuCanvasClose'),
734			menuOpen = new CustomEvent('menuCanvasOpen');
735		$('.menu-primary .menu-button-offcanvas').click(function(event) {
736			if ($(window).width() > UNCODE.mediaQuery) {
737				if ($(event.currentTarget).hasClass('close')) {
738					$(event.currentTarget).removeClass('close');
739					$(event.currentTarget).addClass('closing');
740					requestTimeout(function() {
741						$(event.currentTarget).removeClass('closing');
742						window.dispatchEvent(menuClose);
743					}, 500);
744				} else {
745					$(event.currentTarget).addClass('close');
746					window.dispatchEvent(menuOpen);
747				}
748
749			}
750			$('body').toggleClass('off-opened');
751		});
752	};
753	function menuSmart() {
754		var $menusmart = $('[class*="menu-smart"]');
755		if ($menusmart.length > 0) {
756			$menusmart.smartmenus({
757				subIndicators: false,
758				subIndicatorsPos: 'append',
759				subMenusMinWidth: '13em',
760				subIndicatorsText: '',
761				showTimeout: 50,
762				hideTimeout: 50,
763				showFunction: function($ul, complete) {
764					$ul.fadeIn(0, 'linear', complete);
765					$ul.addClass('open-animated');
766				},
767				hideFunction: function($ul, complete) {
768					var fixIE = $('html.ie').length;
769					if (fixIE) {
770						var $rowParent = $($ul).closest('.main-menu-container');
771						$rowParent.height('auto');
772					}
773					$ul.fadeOut(0, 'linear', complete);
774					$ul.removeClass('open-animated');
775				},
776				collapsibleShowFunction: function($ul, complete) {
777					$ul.slideDown(400, 'easeInOutCirc', function() {
778				12});
779				},
780				collapsibleHideFunction: function($ul, complete) {
781					$ul.slideUp(200, 'easeInOutCirc', complete);
782				},
783				hideOnClick: true
784			});
785
786			if ( $('body').hasClass('menu-accordion-active') ) {
787				requestTimeout(function(){
788					$menusmart.addClass('menu-smart-init');
789					$menusmart.smartmenus( 'itemActivate', $menusmart.find( '.current-menu-item > a' ).eq( -1 ) );
790				}, 1000);
791			}
792		}
793
794	};
795	function menuOverlay() {
796		if ( $('.overlay').length ) {
797			$('.overlay').removeClass('hidden');
798		}
799		if ($('.overlay-sequential, .menu-mobile-animated').length > 0) {
800			$('.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) {
801				var transDelay = (index / 20) + 0.1;
802				if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery )
803					transDelay = transDelay + 0.3;
804				$(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');
805			});
806		}
807	};
808	function menuAppend() {
809		var $body = $('body'),
810			$menuCont = $('.menu-container'),
811			$cta = $('.navbar-cta'),
812			$socials = $('.navbar-social'),
813			$ul = $('.navbar-main ul.menu-primary-inner'),
814			$ulCta,
815			$ulSocials,
816			$firstMenu = $('.main-menu-container:first-child', $menuCont),
817			$secondMenu = $('.main-menu-container:last-child', $menuCont),
818			$firstNav = $('.navbar-nav:first-child', $firstMenu),
819			$secondNav = $('.navbar-nav:first-child', $secondMenu),
820			$ulFirst = $('> ul', $firstNav),
821			$ulSecond = $('> ul', $secondNav),
822			setCTA,
823			appendCTA = function(){
824				return true;
825			},
826			appendSocials = function(){
827				return true;
828			},
829			appendSplit = function(){
830				return true;
831			};
832
833		if ( $body.hasClass('cta-not-appended') )
834			return false;
835
836		if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) {
837			$ulCta = $('> ul', $cta);
838
839			appendCTA = function(){
840				if (UNCODE.wwidth < UNCODE.mediaQuery) {
841					$ul.after($ulCta);
842				} else {
843					$cta.append($ulCta);
844				}
845			}
846		}
847		appendCTA();
848
849		if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') ) && $socials.length ) {
850			$ulSocials = $('> ul', $socials);
851
852			appendSocials = function(){
853				if (UNCODE.wwidth < UNCODE.mediaQuery) {
854					$ul.after($ulSocials);
855				} else {
856					$socials.append($ulSocials);
857				}
858			}
859		}
860		appendSocials();
861
862		if ( ( $body.hasClass('hmenu-center-double') ) ) {
863			appendSplit = function(){
864				if (UNCODE.wwidth < UNCODE.mediaQuery) {
865					if ( $secondNav.length ) {
866						$secondNav.prepend($ulFirst);
867					}
868					$firstMenu.hide();
869				} else {
870					$firstNav.append($ulFirst);
871					$firstMenu.css({
872						'display': 'table-cell'
873					});
874				}
875			}
876		}
877		appendSplit();
878
879		$(window).on( 'resize', function(){
880			clearRequestTimeout(setCTA);
881			setCTA = requestTimeout( function() {
882				appendCTA();
883				appendSocials();
884				appendSplit();
885			}, 10 );
886		});
887	}
888	//menuMobileButton();
889	menuMobile();
890	menuOffCanvas();
891	menuSmart();
892	menuOverlay();
893	menuAppend();
894	var setMenuOverlay;
895	$(window).on( 'resize', function(){
896		if ( $('.overlay').length && $(window).width() > 1024 ) {
897			$('.overlay').addClass('hidden');
898		}
899		clearRequestTimeout(setMenuOverlay);
900		setMenuOverlay = requestTimeout( menuOverlay, 150 );
901	});
902};
903
904UNCODE.okvideo = function() {
905	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
906	$.okvideo = function(options) {
907		// if the option var was just a string, turn it into an object
908		if (typeof options !== 'object') options = {
909			'video': options
910		};
911		var base = this;
912		// kick things off
913		base.init = function() {
914			base.options = $.extend({}, $.okvideo.options, options);
915			// support older versions of okvideo
916			if (base.options.video === null) base.options.video = base.options.source;
917			base.setOptions();
918			var target = base.options.target || $('body');
919			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
920			var zIndex = base.options.controls === 3 ? -999 : "auto";
921			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
922				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>';
923				if (OKEvents.utils.isMobile()) {
924					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>');
925				} else {
926					if (base.options.controls === 3) {
927						target.append(mask)
928					}
929					if (base.options.adproof === 1) {
930						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>');
931					} else {
932						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>');
933					}
934				}
935				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
936				if (base.options.playlist.list === null) {
937					if (base.options.video.provider === 'youtube') {
938						base.loadYouTubeAPI();
939					} else if (base.options.video.provider === 'vimeo') {
940						base.options.volume /= 100;
941						base.loadVimeoAPI();
942					}
943				} else {
944					base.loadYouTubeAPI();
945				}
946			}
947		};
948		// clean the options
949		base.setOptions = function() {
950			// exchange 'true' for '1' and 'false' for 3
951			for (var key in this.options) {
952				if (this.options[key] === true) this.options[key] = 1;
953				if (this.options[key] === false) this.options[key] = 3;
954			}
955			if (base.options.playlist.list === null) {
956				base.options.video = base.determineProvider();
957			}
958			// pass options to the window
959			$(window).data('okoptions-' + base.options.id, base.options);
960		};
961		// insert js into the head and exectue a callback function
962		base.insertJS = function(src, callback){
963			var tag;
964			if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) {
965				tag = UNCODE.insertedSripts[src];
966				if (callback){
967					if (tag.readyState){  //IE
968						tag.onreadystatechange = function(){
969							if (tag.readyState === "loaded" ||
970								tag.readyState === "complete"){
971								tag.onreadystatechange = null;
972								callback();
973							}
974						};
975					} else {
976						$(tag).load(callback);
977					}
978				}
979				return;
980			}
981			tag = document.createElement('script');
982			if (callback){
983				if (tag.readyState){  //IE
984					tag.onreadystatechange = function(){
985						if (tag.readyState === "loaded" || tag.readyState === "complete"){
986							tag.onreadystatechange = null;
987							callback();
988						}
989					};
990				} else {
991					tag.onload = function() {
992						callback();
993					};
994				}
995			}
996			tag.src = src;
997			var firstScriptTag = document.getElementsByTagName('script')[0];
998			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
999			if ( ! UNCODE.insertedSripts ) {
1000				UNCODE.insertedSripts = [];
1001			}
1002			UNCODE.insertedSripts[src] = tag;
1003		};
1004		// load the youtube api
1005		base.loadYouTubeAPI = function(callback) {
1006			base.insertJS('https://www.youtube.com/player_api');
1007		};
1008		base.loadYouTubePlaylist = function() {
1009			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
1010		};
1011		// load the vimeo api by replacing the div with an iframe and loading js
1012		base.loadVimeoAPI = function() {
1013			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,
1014			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" />');
1015			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
1016			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
1017			base.insertJS('//f.vimeocdn.com/js/froogaloop2.min.js', function() {
1018				vimeoPlayerReady(base.options.id);
1019			});
1020		};
1021		// is it from youtube or vimeo?
1022		base.determineProvider = function() {
1023			var a = document.createElement('a');
1024			a.href = base.options.video;
1025			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
1026				var videoid = a.href.split('/')[3].toString();
1027				var query = videoid.substring(videoid.indexOf('?') + 1);
1028				if (query != '') {
1029					var vars = query.split('&');
1030					for (var i = 0; i < vars.length; i++) {
1031						var pair = vars[i].split('=');
1032						if (pair[0] == 'v') {
1033							videoid = pair[1];
1034						}
1035					}
1036				}
1037				return {
1038					"provider": "youtube",
1039					"id": videoid
1040				};
1041			} else if (/vimeo.com/.test(base.options.video)) {
1042				return {
1043					"provider": "vimeo",
1044					"id": (a.href.split('/')[3].toString()).split('#')[0],
1045				};
1046			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
1047				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
1048				if (id.length == 11) {
1049					return {
1050						"provider": "youtube",
1051						"id": id.toString()
1052					};
1053				} else {
1054					for (var i = 0; i < base.options.video.length; i++) {
1055						if (typeof parseInt(base.options.video[i]) !== "number") {
1056							throw 'not vimeo but thought it was for a sec';
1057						}
1058					}
1059					return {
1060						"provider": "vimeo",
1061						"id": base.options.video
1062					};
1063				}
1064			} else {
1065				throw "OKVideo: Invalid video source";
1066			}
1067		};
1068		base.init();
1069	};
1070	$.okvideo.options = {
1071		id: null,
1072		source: null, // Deprecate dis l8r
1073		video: null,
1074		playlist: { // eat ur heart out @brokyo
1075			list: null,
1076			index: 0,
1077			startSeconds: 0,
1078			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
1079		},
1080		disableKeyControl: 1,
1081		captions: 0,
1082		loop: 1,
1083		hd: 1,
1084		volume: 0,
1085		adproof: false,
1086		unstarted: null,
1087		onFinished: null,
1088		onReady: null,
1089		onPlay: null,
1090		onPause: null,
1091		buffering: null,
1092		controls: false,
1093		autoplay: true,
1094		annotations: true,
1095		cued: null
1096	};
1097	$.fn.okvideo = function(options) {
1098		options.target = this;
1099		return this.each(function() {
1100			(new $.okvideo(options));
1101		});
1102	};
1103
1104	$(".no-touch .uncode-video-container.video").each(function(index, el) {
1105		var $this = $(this),
1106			url = $this.attr('data-video'),
1107			id = $this.attr('data-id'),
1108			cloned = $this.closest('.owl-item');
1109		if (!cloned.hasClass('cloned') || cloned.length == 0) {
1110			$this.okvideo({
1111				id: id,
1112				source: url.split('#')[0],
1113				time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
1114				autoplay: 1,
1115				controls: 0,
1116				volume: 0,
1117				adproof: 0,
1118				caller: $this,
1119				hd: 1,
1120				onReady: function(player) {
1121					var getPlayer = player.c || player,
1122					getContainer = $(getPlayer).closest('.background-element');
1123					if (getContainer.length) {
1124						UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video');
1125					}
1126				}
1127			});
1128		}
1129	});
1130	$(".background-video-shortcode").each(function(index, el) {
1131		if ( SiteParameters.block_mobile_videos === true ) {
1132			return false;
1133		}
1134		if ( $(this).closest('mediaelementwrapper').length ) {
1135			return true;
1136		}
1137		var $video_el = $(this),
1138			$parent_carousel = $video_el.parents('.uncode-slider').eq(0),
1139			video_id = $video_el.attr('id');
1140
1141		if ( SiteParameters.is_frontend_editor ) {
1142			video_id = video_id + '_' + index;
1143			$video_el.attr('id', video_id);
1144		}
1145
1146		if (typeof MediaElement === "function") {
1147			var media = new MediaElement(video_id, {
1148				startVolume: 0,
1149				loop: true,
1150				success: function(mediaElement, domObject) {
1151					domObject.volume = 0;
1152					$(mediaElement).data('started', false);
1153					mediaElement.addEventListener('timeupdate', function(e) {
1154						if (!$(e.target).data('started')) {
1155							$(mediaElement).data('started', true);
1156						}
1157					});
1158					mediaElement.addEventListener('loadedmetadata', function(e) {
1159						mediaElement.play();
1160					});
1161					if (!UNCODE.isMobile) {
1162						requestTimeout(function() {
1163							UNCODE.initVideoComponent(document.body, '.uncode-video-container.video, .uncode-video-container.self-video');
1164						}, 100);
1165					}
1166					if ( ($('html.firefox').length) && !$parent_carousel.length  ) {
1167						mediaElement.play();
1168					}
1169
1170					mediaElement.addEventListener('play', function() {
1171						$(mediaElement).closest('.uncode-video-container').css('opacity', '1');
1172						$(mediaElement).closest('#page-header').addClass('video-started');
1173						$(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
1174					}, true);
1175
1176				},
1177				// fires when a problem is detected
1178				error: function() {}
1179			});
1180
1181		}
1182	});
1183
1184	var manageVideoSize = function(){
1185
1186		var setVideoFit;
1187		$('.wp-block-embed').each(function(){
1188
1189			var $this = $(this);
1190
1191			if ( $('iframe', $this).length ) {
1192
1193				var $iframe = $('> iframe, > a > iframe', $this),
1194					w = parseFloat($iframe.attr('width')),
1195					h = parseFloat($iframe.attr('height')),
1196					url = $iframe.attr('src'),
1197					ratio, frW;
1198
1199				if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0  ) {
1200
1201					ratio = h / w;
1202					var resizeiFrame = function(){
1203						frW = $iframe.width();
1204						$iframe.css({
1205							height: frW * ratio
1206						});
1207					};
1208					resizeiFrame();
1209					$(window).on('resize load', resizeiFrame);
1210
1211				}
1212
1213			}
1214
1215		});
1216
1217	};
1218
1219	manageVideoSize();
1220};
1221
1222UNCODE.disableHoverScroll = function() {
1223
1224    if (!UNCODE.isMobile && !UNCODE.isFullPage) {
1225        var body = document.body,
1226        timer;
1227
1228        window.addEventListener('scroll', function() {
1229            clearRequestTimeout(timer);
1230            if (body.classList)  {
1231                if (!body.classList.contains('disable-hover')) {
1232                    body.classList.add('disable-hover')
1233                }
1234
1235                timer = requestTimeout(function() {
1236                    body.classList.remove('disable-hover')
1237                }, 300);
1238            }
1239        }, false);
1240    }
1241};
1242
1243UNCODE.isotopeLayout = function() {
1244	if ($('.isotope-layout').length > 0) {
1245		var isotopeContainersArray = [],
1246			typeGridArray = [],
1247			layoutGridArray = [],
1248			screenLgArray = [],
1249			screenMdArray = [],
1250			screenSmArray = [],
1251			transitionDuration = [],
1252			$filterItems = [],
1253			$filters = $('.isotope-system .isotope-filters'),
1254			$itemSelector = '.tmb-iso',
1255			$items,
1256			itemMargin,
1257			correctionFactor = 0,
1258			firstLoad = true,
1259			isOriginLeft = $('body').hasClass('rtl') ? false : true;
1260		$('[class*="isotope-container"]').each(function() {
1261			var isoData = $(this).data(),
1262			$data_lg,
1263			$data_md,
1264			$data_sm;
1265			$(this).children('.tmb').addClass('tmb-iso');
1266			if (isoData.lg !== undefined) $data_lg = $(this).attr('data-lg');
1267			else $data_lg = '1000';
1268			if (isoData.md !== undefined) $data_md = $(this).attr('data-md');
1269			else $data_md = '600';
1270			if (isoData.sm !== undefined) $data_sm = $(this).attr('data-sm');
1271			else $data_sm = '480';
1272			screenLgArray.push($data_lg);
1273			screenMdArray.push($data_md);
1274			screenSmArray.push($data_sm);
1275			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
1276			if (isoData.type == 'metro') typeGridArray.push(true);
1277			else typeGridArray.push(false);
1278			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
1279			else layoutGridArray.push('masonry');
1280			isotopeContainersArray.push($(this));
1281		});
1282		var colWidth = function(index) {
1283				$(isotopeContainersArray[index]).width('');
1284				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
1285					widthAvailable = $(isotopeContainersArray[index]).width(),
1286					columnNum = 12,
1287					columnWidth = 0,
1288					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
1289					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
1290					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
1291					$rowContainer,
1292					paddingRow,
1293					$colContainer,
1294					paddingCol;
1295
1296				if ( consider_menu )
1297					winHeight = winHeight - UNCODE.menuHeight;
1298
1299				if ( data_vp_height === '1' ) {
1300					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
1301					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
1302					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
1303					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
1304					winHeight = winHeight - ( paddingRow + paddingCol );
1305				}
1306
1307				if (isPx) {
1308					columnWidth = Math.ceil(widthAvailable / columnNum);
1309					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
1310				} else {
1311					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
1312				}
1313				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
1314				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
1315				for (var i = 0, len = $items.length; i < len; i++) {
1316					var $item = $($items[i]),
1317						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
1318						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
1319						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
1320
1321					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
1322						if (multiplier_w != null && multiplier_w[1] !== undefined) {
1323							switch (parseInt(multiplier_w[1])) {
1324								case (5):
1325								case (4):
1326								case (3):
1327									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
1328									multiplier_w[1] = 6;
1329									break;
1330								case (2):
1331								case (1):
1332									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
1333									multiplier_w[1] = 3;
1334									break;
1335								default:
1336									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
1337									multiplier_w[1] = 12;
1338									break;
1339							}
1340						}
1341					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
1342						if (multiplier_w != null && multiplier_w[1] !== undefined) {
1343							switch (parseInt(multiplier_w[1])) {
1344								case (5):
1345								case (4):
1346								case (3):
1347								case (2):
1348								case (1):
1349									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
1350									multiplier_w[1] = 6;
1351									break;
1352								default:
1353									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
1354									multiplier_w[1] = 12;
1355									break;
1356							}
1357						}
1358					} else if (widthAvailable < screenSmArray[index]) {
1359						if (multiplier_w != null && multiplier_w[1] !== undefined) {
1360							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
1361							multiplier_w[1] = 12;
1362							if (typeGridArray[index]) multiplier_h[1] = 12;
1363						}
1364					}
1365					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
1366						height;
1367
1368					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
1369						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
1370						if ( widthAvailable < screenSmArray[index] ) {
1371							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
1372						}
1373					} else {
1374						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
1375					}
1376
1377					if (width >= widthAvailable) {
1378						$item.css({
1379							width: widthAvailable
1380						});
1381						if (typeGridArray[index]) {
1382							$item.children().add($item.find('.backimg')).css({
1383								height: height
1384							});
1385						}
1386					} else {
1387						$item.css({
1388							width: width
1389						});
1390						if (typeGridArray[index]) {
1391							$item.children().add($item.find('.backimg')).css({
1392								height: height
1393							});
1394						}
1395					}
1396				}
1397				return columnWidth;
1398			},
1399			init_isotope = function() {
1400				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
1401					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
1402						isotopeId = isotopeSystem.attr('id'),
1403						$layoutMode = layoutGridArray[i],
1404						setIsotopeFirstRowTimeOut,
1405					setIsotopeFirstRow = function(items){
1406						var firstRow = true;
1407						$(items).each(function(index, val){
1408							var el = items[index].element,
1409								el_top = items[index].position.y,
1410								$el = $(el);
1411							if ( index > 0 && el_top > 0 && firstRow ) {
1412								firstRow = false;
1413							} else if ( index == 0 && el_top == 0 ) {
1414								firstRow = true;
1415							}
1416							if ( firstRow ) {
1417								$el.removeClass('tmb-isotope-further-row');
1418							} else {
1419								$el.addClass('tmb-isotope-further-row');
1420							}
1421						});
1422					};
1423					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
1424						//resizable: true,
1425						itemSelector: $itemSelector,
1426						layoutMode: $layoutMode,
1427						transitionDuration: transitionDuration[i],
1428						masonry: {
1429							columnWidth: colWidth(i)
1430						},
1431						vertical: {
1432							horizontalAlignment: 0.5,
1433						},
1434						sortBy: 'original-order',
1435						isOriginLeft: isOriginLeft
1436					})
1437					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
1438					.on('layoutComplete', function( event, items ){
1439						if ( typeof items[0] !== 'undefined' ) {
1440							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
1441								setIsotopeFirstRow(items);
1442							}
1443						}
1444					})
1445					.on('arrangeComplete', function( event, items ){
1446						if ( typeof items[0] !== 'undefined' ) {
1447							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
1448								clearRequestTimeout(setIsotopeFirstRowTimeOut);
1449								setIsotopeFirstRowTimeOut = requestTimeout(function(){
1450										setIsotopeFirstRow(items);
1451								}, 100);
1452							}
1453						}
1454					});
1455					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite')) {
1456						$(isotopeContainersArray[i]).infinitescroll({
1457								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
1458								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
1459								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li', // selector for all items you'll retrieve
1460								animate: false,
1461								behavior: 'local',
1462								debug: false,
1463								loading: {
1464									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
1465									speed: 0,
1466									finished: undefined,
1467									msg: $('#' + isotopeId + ' .loadmore-button'),
1468								},
1469								errorCallback: function() {
1470									var isotope_system = $(this).closest('.isotope-system');
1471									$('.loading-button', isotope_system).hide();
1472									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
1473								}
1474							},
1475							// append the new items to isotope on the infinitescroll callback function.
1476							function(newElements, opts) {
1477								var $isotope = $(this),
1478									isotopeId = $isotope.closest('.isotope-system').attr('id'),
1479									filters = new Array(),
1480									$loading_button = $isotope.closest('.isotope-system').find('.loading-button'),
1481									$infinite_button = $isotope.closest('.isotope-system').find('.loadmore-button'),
1482									$numPages = $('a', $infinite_button).data('pages'),
1483									delay = 300;
1484								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
1485								$infinite_button.show();
1486								$loading_button.hide();
1487								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
1488								$('> li', $isotope).remove();
1489								$.each($(newElements), function(index, val) {
1490									$(val).addClass('tmb-iso');
1491									if ($(val).is("li")) {
1492										filters.push($(val)[0]);
1493									}
1494								});
1495								newElements = newElements.filter(function(x) {
1496									return filters.indexOf(x) < 0
1497								});
1498								$.each($(filters), function(index, val) {
1499									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
1500								});
1501								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
1502								var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
1503								if (typeof getLightbox === 'object') getLightbox.refresh();
1504								if ( typeof twttr !== 'undefined' )
1505									twttr.widgets.load(isotopeContainersArray[i]);
1506
1507							});
1508						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
1509							var $infinite_isotope = $(isotopeContainersArray[i]),
1510								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
1511							$infinite_isotope.infinitescroll('pause');
1512							$infinite_button.on('click', function(event) {
1513								event.preventDefault();
1514								var $infinite_system = $(event.target).closest('.isotope-system'),
1515								$infinite_isotope = $infinite_system.find('.isotope-container'),
1516								isotopeId = $infinite_system.attr('id');
1517								$(event.currentTarget).html(SiteParameters.loading);
1518								$infinite_isotope.infinitescroll('resume');
1519								$infinite_isotope.infinitescroll('retrieve');
1520								$infinite_isotope.infinitescroll('pause');
1521							});
1522						}
1523					}
1524				}
1525			},
1526			onLayout = function(isotopeObj, startIndex) {
1527				window.uncode_textfill();
1528				isotopeObj.css('opacity', 1);
1529				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
1530
1531				requestTimeout(function() {
1532					window.dispatchEvent(UNCODE.boxEvent);
1533					UNCODE.adaptive();
1534					$(isotopeObj).find('audio,video').each(function() {
1535						$(this).mediaelementplayer({
1536 							pauseOtherPlayers: false,
1537						});
1538					});
1539					if ($(isotopeObj).find('.nested-carousel').length) {
1540						UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
1541						requestTimeout(function() {
1542							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
1543						}, 200);
1544					} else {
1545						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
1546					}
1547				}, 100);
1548
1549			},
1550			boxAnimation = function(items, startIndex, sequential, container) {
1551				var $allItems = items.length - startIndex,
1552					showed = 0,
1553					index = 0;
1554				if (container.closest('.owl-item').length == 1) return false;
1555				$.each(items, function(index, val) {
1556					var elInner = $('> .t-inside', val);
1557					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
1558						return;
1559					}
1560					if (val[0]) val = val[0];
1561					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
1562						new Waypoint({
1563							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
1564							element: val,
1565							handler: function() {
1566								var element = $('> .t-inside', this.element),
1567									parent = $(this.element),
1568									currentIndex = parent.index();
1569								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
1570									delayAttr = parseInt(element.attr('data-delay'));
1571								if (isNaN(delayAttr)) delayAttr = 100;
1572								delay -= showed;
1573								var objTimeout = requestTimeout(function() {
1574									element.removeClass('zoom-reverse').addClass('start_animation');
1575									showed = parent.index();
1576								}, delay * delayAttr)
1577								parent.data('objTimeout', objTimeout);
1578								if (!UNCODE.isUnmodalOpen) {
1579									this.destroy();
1580								}
1581							},
1582							offset: '100%'
1583						})
1584					} else {
1585						if (elInner.hasClass('force-anim')) {
1586							elInner.addClass('start_animation');
1587						} else {
1588							elInner.css('opacity', 1);
1589						}
1590					}
1591					index++;
1592				});
1593			};
1594		if ($('.isotope-pagination').length > 0) {
1595			$('.isotope-system').on('click', '.pagination a', function(evt) {
1596				evt.preventDefault();
1597
1598                var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
1599					container = $(this).closest('.isotope-system'),
1600					calc_scroll = container.closest('.uncol').offset().top,
1601                    getFilterSpanPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span', filterContainer).css("padding-bottom") : 0,
1602                    getFilterPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span a', filterContainer).css("padding-bottom") : 0,
1603                    filterOffset = (getFilterSpanPadding != undefined && getFilterSpanPadding != 0) ? parseInt(getFilterSpanPadding.replace("px", "")) : 0;
1604                filterOffset += (getFilterPadding != undefined && getFilterPadding != 0) ? parseInt(getFilterPadding.replace("px", "")) : 0;
1605
1606                calc_scroll -= filterOffset - 1;
1607                calc_scroll -= UNCODE.get_scroll_offset();
1608
1609				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
1610					delta = bodyTop - calc_scroll,
1611					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
1612				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
1613
1614				if ( !UNCODE.isFullPage ) {
1615					if (scrollSpeed == 0) {
1616						$('html, body').scrollTop(calc_scroll);
1617					} else {
1618						$('html, body').animate({
1619							scrollTop: calc_scroll
1620						},{
1621							easing: 'easeInOutQuad',
1622							duration: scrollSpeed,
1623							complete: function(){
1624								UNCODE.scrolling = false;
1625							}
1626						});
1627					}
1628				}
1629
1630				loadIsotope($(this));
1631				evt.preventDefault();
1632			});
1633		}
1634		$filters.on('click', 'a.isotope-nav-link', function(evt) {
1635			if ($(this).hasClass('no-isotope-filter')) {
1636				return;
1637			}
1638			var $filter = $(this),
1639				filterContainer = $filter.closest('.isotope-filters'),
1640				filterValue = $filter.attr('data-filter'),
1641				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
1642				transitionDuration = container.data().isotope.options.transitionDuration,
1643				delay = 300,
1644				filterItems = [];
1645			if (!$filter.hasClass('active')) {
1646				/** Scroll top with filtering */
1647				if (filterContainer.hasClass('filter-scroll')) {
1648                    var calc_scroll = container.closest('.uncol').offset().top,
1649                    getFilterSpanPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span', filterContainer).css("padding-bottom") : 0,
1650                    getFilterPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span a', filterContainer).css("padding-bottom") : 0,
1651                    filterOffset = (getFilterSpanPadding != undefined && getFilterSpanPadding != 0) ? parseInt(getFilterSpanPadding.replace("px", "")) : 0;
1652                    filterOffset += (getFilterPadding != undefined && getFilterPadding != 0) ? parseInt(getFilterPadding.replace("px", "")) : 0;
1653
1654                    calc_scroll -= filterOffset - 1;
1655                    calc_scroll -= UNCODE.get_scroll_offset();
1656
1657					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
1658						delta = bodyTop - calc_scroll,
1659						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
1660					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
1661
1662					if ( !UNCODE.isFullPage ) {
1663						if (scrollSpeed == 0) {
1664							$('html, body').scrollTop(calc_scroll);
1665							UNCODE.scrolling = false;
1666						} else {
1667							$('html, body').animate({
1668								scrollTop: calc_scroll
1669							},{
1670								easing: 'easeInOutQuad',
1671								duration: scrollSpeed,
1672								complete: function(){
1673									UNCODE.scrolling = false;
1674								}
1675							});
1676						}
1677					}
1678				}
1679				if (filterValue !== undefined) {
1680					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
1681						var parent = $(val).parent(),
1682							objTimeout = parent.data('objTimeout');
1683						if (objTimeout) {
1684							$(val).removeClass('zoom-reverse').removeClass('start_animation')
1685							clearRequestTimeout(objTimeout);
1686						}
1687						if (transitionDuration == 0) {
1688							if ($(val).hasClass('animate_when_almost_visible')) {
1689								$(val).addClass('zoom-reverse').removeClass('start_animation');
1690							} else {
1691								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
1692							}
1693						}
1694					});
1695					requestTimeout(function(){
1696						if ( filterValue == '*' ) {
1697							container.removeClass('isotope-filtered');
1698						} else {
1699							container.addClass('isotope-filtered');
1700						}
1701						container.isotope({
1702							filter: function() {
1703								var block = $(this),
1704								filterable = (filterValue == '*') || block.hasClass(filterValue),
1705								lightboxElements = $('[data-lbox^=ilightbox]', block);
1706								if (filterable) {
1707									if (lightboxElements.length) {
1708										lightboxElements.removeClass('lb-disabled');
1709										container.data('lbox', $(lightboxElements[0]).data('lbox'));
1710									}
1711									filterItems.push(block);
1712								} else {
1713									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
1714								}
1715								return filterable;
1716							}
1717						});
1718						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
1719					}, delay);
1720
1721					/** once filtered - start **/
1722					container.isotope('once', 'arrangeComplete', function() {
1723						var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
1724						if (typeof getLightbox === 'object') getLightbox.refresh();
1725						if (transitionDuration == 0) {
1726							requestTimeout(function() {
1727								boxAnimation(filterItems, 0, false, container);
1728							}, 100);
1729						}
1730						requestTimeout(function() {
1731							Waypoint.refreshAll();
1732						}, 2000);
1733					});
1734					/** once filtered - end **/
1735				} else {
1736					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
1737						var parent = $(val).parent(),
1738							objTimeout = parent.data('objTimeout');
1739						if (objTimeout) {
1740							$(val).removeClass('zoom-reverse').removeClass('start_animation')
1741							clearRequestTimeout(objTimeout);
1742						}
1743						if (transitionDuration == 0) {
1744							if ($(val).hasClass('animate_when_almost_visible')) {
1745								$(val).addClass('zoom-reverse').removeClass('start_animation');
1746							} else {
1747								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
1748							}
1749						}
1750					});
1751					container.parent().addClass('isotope-loading');
1752					loadIsotope($filter);
1753				}
1754			}
1755			evt.preventDefault();
1756		});
1757		$(window).on("popstate", function(e) {
1758			if (e.originalEvent.state === null) return;
1759			var params = {};
1760			if (location.search) {
1761				var parts = location.search.substring(1).split('&');
1762				for (var i = 0; i < parts.length; i++) {
1763					var nv = parts[i].split('=');
1764					if (!nv[0]) continue;
1765					params[nv[0]] = nv[1] || true;
1766				}
1767			}
1768			if (params.id === undefined) {
1769				$.each($('.isotope-system'), function(index, val) {
1770					loadIsotope($(val));
1771				});
1772			} else loadIsotope($('#' + params.id));
1773		});
1774
1775		var loadIsotope = function($href) {
1776			var href = ($href.is("a") ? $href.attr('href') : location),
1777				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
1778				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
1779				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
1780				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
1781				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
1782				isotopeId = isotopeSystem.attr('id');
1783			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
1784				history.pushState({
1785					myIsotope: true
1786				}, document.title, href);
1787			}
1788			$.ajax({
1789				url: href
1790			}).done(function(data) {
1791				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
1792					$resultPagination = $(data).find('#' + isotopeId + ' .pagination'),
1793					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count');
1794				isotopeWrapper.addClass('isotope-reloaded');
1795				requestTimeout(function() {
1796					isotopeWrapper.removeClass('isotope-loading');
1797					isotopeWrapper.removeClass('isotope-reloaded');
1798				}, 500);
1799				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
1800					var parent = $(val).parent(),
1801						objTimeout = parent.data('objTimeout');
1802					if (objTimeout) {
1803						$(val).removeClass('zoom-reverse').removeClass('start_animation')
1804						clearRequestTimeout(objTimeout);
1805					}
1806					if ($(val).hasClass('animate_when_almost_visible')) {
1807						$(val).addClass('zoom-reverse').removeClass('start_animation');
1808					} else {
1809						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
1810					}
1811				});
1812				requestTimeout(function() {
1813					if (isotopeContainer.data('isotope')) {
1814						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
1815						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0));
1816						UNCODE.adaptive();
1817						var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
1818						if (typeof getLightbox === 'object') getLightbox.refresh();
1819					}
1820				}, 300);
1821				$('.pagination', isotopeFooter).remove();
1822				isotopeFooter.append($resultPagination);
1823
1824				if (isotopeResultCount.length > 0) {
1825					$('.woocommerce-result-count', isotopeResultCount).remove();
1826					isotopeResultCount.append($resultCount);
1827				}
1828			});
1829		};
1830		$filters.each(function(i, buttonGroup) {
1831			var $buttonGroup = $(buttonGroup);
1832			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
1833				$buttonGroup.find('.active').removeClass('active');
1834				$(this).addClass('active');
1835
1836			});
1837
1838			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
1839				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
1840				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
1841			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
1842				e.preventDefault();
1843				$cats_filters.slideToggle(400, 'easeInOutCirc');
1844			});
1845
1846		});
1847		window.addEventListener('boxResized', function(e) {
1848			$.each($('.isotope-layout'), function(index, val) {
1849				var $layoutMode = ($(this).data('layout'));
1850				if ($layoutMode === undefined) $layoutMode = 'masonry';
1851				if ($(this).data('isotope')) {
1852					$(this).isotope({
1853						itemSelector: $itemSelector,
1854						layoutMode: $layoutMode,
1855						transitionDuration: transitionDuration[index],
1856						masonry: {
1857							columnWidth: colWidth(index)
1858						},
1859						vertical: {
1860							horizontalAlignment: 0.5,
1861						},
1862						sortBy: 'original-order',
1863						isOriginLeft: isOriginLeft
1864					});
1865					$(this).isotope('unbindResize');
1866				}
1867				$(this).find('.mejs-video,.mejs-audio').each(function() {
1868					$(this).trigger('resize');
1869				});
1870			});
1871		}, false);
1872
1873		init_isotope();
1874	};
1875}
1876
1877UNCODE.lightbox = function() {
1878	UNCODE.lightboxArray = {};
1879	requestTimeout(function() {
1880		var groupsArr = {};
1881		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init])').each(function() {
1882			var group = this.getAttribute("data-lbox"),
1883				values = $(this).data();
1884			$(this).attr('data-lbox-init','true')
1885			groupsArr[group] = values;
1886		});
1887		for (var i in groupsArr) {
1888			var skin = groupsArr[i].skin || 'black',
1889				path = groupsArr[i].dir || 'horizontal',
1890				thumbs = !groupsArr[i].notmb || false,
1891				arrows = !groupsArr[i].noarr || false,
1892				social = groupsArr[i].social || false,
1893				deeplink = groupsArr[i].deep || false,
1894				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled)'),
1895				counter = $els.length,
1896				dataAlbum = $els.attr('data-album');
1897			if (social) social = {
1898				facebook: true,
1899				twitter: true,
1900				reddit: true,
1901				digg: true,
1902				delicious: true
1903			};
1904			UNCODE.lightboxArray[i] = $els.iLightBox({
1905				selector: '[data-lbox="' + i + '"]:not(.lb-disabled)',
1906				skin: skin,
1907				path: path,
1908				linkId: deeplink,
1909				infinite: false,
1910				//fullViewPort: 'fit',
1911				smartRecognition: false,
1912				fullAlone: true,
1913				maxScale: 1,
1914				minScale: .02,
1915				//fullStretchTypes: 'flash, video',
1916				overlay: {
1917					opacity: .94
1918				},
1919				controls: {
1920					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
1921					fullscreen: true,
1922					thumbnail: thumbs,
1923					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
1924				},
1925				show: {
1926					speed: 200
1927				},
1928				hide: {
1929					speed: 200
1930				},
1931				social: {
1932					start: false,
1933					buttons: social
1934				},
1935				caption: {
1936					start: false
1937				},
1938				styles: {
1939					nextOpacity: 1,
1940					nextScale: 1,
1941					prevOpacity: 1,
1942					prevScale: 1
1943				},
1944				effects: {
1945					switchSpeed: 400
1946				},
1947				slideshow: {
1948					pauseTime: 5000
1949				},
1950				thumbnails: {
1951					maxWidth: 60,
1952					maxHeight: 60,
1953					activeOpacity: .2
1954				},
1955				html5video: {
1956					preload: true
1957				},
1958				callback: {
1959					onOpen: function(){
1960						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' )
1961							iNoBounce.enable();
1962					},
1963					onHide: function(){
1964						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' )
1965							iNoBounce.disable()
1966					},
1967				}
1968			});
1969
1970			$(document).on('infinite-loaded', function(){
1971				UNCODE.lightboxArray[i].refresh();
1972			});
1973		};
1974	}, 100);
1975
1976	$(document).on('click', '.lb-disabled', function(e){
1977		e.preventDefault();
1978	});
1979};
1980
1981/*UNCODE.backVideo = function() {
1982	$(function() {
1983		$.each($('.background-video-shortcode'), function() {
1984			var video_id = $(this).attr('id');
1985			if (typeof MediaElement === "function") {
1986				new MediaElement(video_id, {
1987					startVolume: 0,
1988					loop: true,
1989					success: function(mediaElement, domObject) {
1990						mediaElement.play();
1991						$(mediaElement).closest('.uncode-video-container').css('opacity','1');
1992						domObject.volume = 0;
1993					},
1994					// fires when a problem is detected
1995					error: function() {}
1996				});
1997			}
1998		});
1999	});
2000};*/
2001UNCODE.carousel = function(container) {
2002	var $owlContainer = $('.owl-carousel-container', container),
2003		$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
2004		$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
2005		values = {},
2006		tempTimeStamp,
2007		currentIndex,
2008		$owlInsideEqual = [];
2009	$owlSelector.each(function() {
2010		var itemID = $(this).attr('id'),
2011			$elSelector = $(('#' + itemID).toString());
2012		values['id'] = itemID;
2013		values['items'] = 1;
2014		values['columns'] = 3;
2015		values['fade'] = false;
2016		values['nav'] = false;
2017		values['navmobile'] = false;
2018		values['navskin'] = 'light';
2019		values['navspeed'] = 400;
2020		values['dots'] = false;
2021		values['dotsmobile'] = false;
2022		values['loop'] = false;
2023		values['autoplay'] = false;
2024		values['timeout'] = 3000;
2025		values['autoheight'] = false;
2026		values['stagepadding'] = 0;
2027		values['margin'] = 0;
2028		values['lg'] = 1;
2029		values['md'] = 1;
2030		values['sm'] = 1;
2031		$.each($(this).data(), function(i, v) {
2032			values[i] = v;
2033		});
2034
2035		if ($(this).closest('.uncode-slider').length) {
2036			values['navskin'] = '';
2037			values['navmobile'] = false;
2038			//values['dotsmobile'] = true;
2039		} else {
2040			values['navskin'] = ' style-'+values['navskin']+' style-override';
2041		}
2042
2043		var setIndexActive = function(event, init){
2044			var init = typeof init === 'undefined' ? false : init;
2045			if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && $(event.currentTarget).closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
2046				var scrolltop = $(document).scrollTop(),
2047					size = event.page.size,
2048					i;
2049				var setIndex = requestTimeout(function() {
2050					for ( i = 0; i < size; i++ ) {
2051						var itemCont = event.item.index != null ? (event.item.index + i) : i;
2052						var currentItem = $(event.currentTarget).find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
2053						if ($(event.currentTarget).closest('.row-slider').length) {
2054							if (currentItem == undefined) {
2055								currentItem = $(event.currentTarget).children()[i];
2056							}
2057							if ($(currentItem).closest('#page-header').length) {
2058								if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
2059									UNCODE.switchColorsMenu(scrolltop, 'dark');
2060								} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
2061									UNCODE.switchColorsMenu(scrolltop, 'light');
2062								}
2063							}
2064						}
2065						var itendIndex = $(currentItem).attr('data-index');
2066						if ( isNaN(itendIndex) ) {
2067							itendIndex = 1;
2068						}
2069						$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
2070						$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
2071						$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .counter').each(function(){
2072							var $counter = $(this);
2073							$counter.addClass('started').counterUp({
2074								delay: 10,
2075								time: 1500
2076							});
2077						});
2078					}
2079					$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
2080				}, 200);
2081			}
2082			tempTimeStamp = event.timeStamp;
2083		}
2084
2085		/** Initialized */
2086		$elSelector.on('initialized.owl.carousel', function(event) {
2087
2088			$('.owl-dot.active', $elSelector).on('click', function(){
2089				return false;
2090			});
2091
2092			var thiis = $(event.currentTarget),
2093				// get the time from the data method
2094				time = thiis.data("timer-id"),
2095				rowParent = thiis.closest('.row-parent');
2096
2097			if ( typeof rowParent[0] !== 'undefined' ) {
2098				rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
2099			}
2100
2101			if (time) {
2102				clearRequestTimeout(time);
2103			}
2104
2105			thiis.addClass('showControls');
2106			var new_time = requestTimeout(function() {
2107				thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
2108				if (thiis.hasClass('owl-height-viewport'))
2109					setItemsRelHeight(event.currentTarget);
2110				if (thiis.hasClass('owl-height-equal'))
2111					setItemsHeight(event.currentTarget);
2112				if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
2113				if (thiis.closest('.unequal, .unexpand').length) {
2114					UNCODE.setRowHeight(rowParent[0], true);
2115				}
2116			}, 350);
2117			// save the new time
2118			thiis.data("timer-id", new_time);
2119
2120			var scrolltop = $(document).scrollTop();
2121			$(event.currentTarget).closest('.uncode-slider').find('video').removeAttr('poster');
2122
2123			//if (!UNCODE.isMobile) {
2124				/** fix autoplay when visible **/
2125			$(window).on('load', function(){
2126				if ($(event.currentTarget).data('autoplay')) {
2127					$(event.currentTarget).trigger('stop.autoplay.owl');
2128				}
2129				if (UNCODE.isUnmodalOpen && !$(event.currentTarget).closest('#unmodal-content')) {
2130					return;
2131				}
2132				var carouselInView = new Waypoint.Inview({
2133					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
2134					element: $(event.currentTarget)[0],
2135					exited: function() {
2136						var el = $(this.element);
2137						if (el.data('autoplay')) {
2138							el.trigger('stop.owl.autoplay');
2139							el.data('stopped','true');
2140						}
2141					},
2142					enter: function(direction) {
2143						var el = $(this.element);
2144						requestTimeout(function() {
2145							if (el.data('autoplay')) {
2146								el.trigger('play.owl.autoplay');
2147								el.data('stopped','false');
2148							}
2149						}, 100);
2150					}
2151				});
2152			});
2153			//}
2154
2155			// $(window).on('frontend:carousel_updated', function(){
2156			// 	Waypoint.refreshAll();
2157			// });
2158
2159			if (!$(event.currentTarget).closest('.isotope-system').length) {
2160				requestTimeout(function() {
2161					animate_thumb($('.t-inside', el), event);
2162				}, 400);
2163			}
2164
2165			var currentItem = $(event.currentTarget).find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
2166			currentIndex = $(currentItem).attr('data-index');
2167
2168			$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
2169				if ($(val).closest('.uncode-slider').length) {
2170					$(val).removeClass('start_animation');
2171				}
2172			});
2173			$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
2174				if ($(val).closest('.uncode-slider').length) {
2175					$(val).removeClass('already-animated');
2176				}
2177			});
2178
2179			$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
2180				if ($(val).closest('.uncode-slider').length) {
2181					$(val).removeAttr('data-animated');
2182				}
2183			});
2184
2185			$.each($('.owl-item.cloned', event.currentTarget), function(index, val) {
2186				$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
2187			});
2188
2189			$.each($('.owl-item:not(.active)', event.currentTarget), function(index, val) {
2190				if ($(val).attr('data-index') != currentIndex) {
2191					$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
2192					$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
2193				}
2194				if ($(val).attr('data-index') != currentIndex) {
2195					$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
2196				}
2197				if ($(val).attr('data-index') == currentIndex) {
2198					$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
2199				}
2200			});
2201
2202			if ($(event.currentTarget).closest('.uncode-slider').length) {
2203				var el = $(event.currentTarget).closest('.row-parent')[0];
2204				if ($(el).data('imgready')) {
2205					firstLoaded(el, event);
2206				} else {
2207					el.addEventListener("imgLoaded", function(el) {
2208						firstLoaded(el.target, event);
2209					}, false);
2210				}
2211				var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
2212				if (transHeight != null) {
2213					requestTimeout(function() {
2214						$(event.currentTarget).closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
2215					}, 100);
2216				}
2217			} else {
2218				var el = $(event.currentTarget);
2219				el.closest('.uncode-slider').addClass('slider-loaded');
2220			}
2221
2222			requestTimeout(function() {
2223				window.uncode_textfill(thiis);
2224				if ($(event.currentTarget).closest('.uncode-slider').length) {
2225					if ($(event.currentTarget).data('autoplay')) pauseOnHover(event.currentTarget);
2226				}
2227			}, 500);
2228
2229			if ($(event.currentTarget).closest('.unequal').length) {
2230				$owlInsideEqual.push($(event.currentTarget).closest('.row-parent'));
2231			}
2232
2233			var containerClasses = '',
2234				containerStyle = '';
2235			if ( $('.owl-dots-classes', $owlContainer).length ) {
2236				containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
2237				containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
2238				$('.owl-dots-classes', $owlContainer).remove();
2239			}
2240
2241			if ( containerClasses !== '' ) {
2242				requestTimeout(function() {
2243					if ( containerClasses !== '' )
2244						$('.owl-dots', $owlContainer).attr('style', containerStyle);
2245					if ( containerStyle !== '' )
2246						$('.owl-dots', $owlContainer).addClass(containerClasses);
2247				}, 100);
2248			}
2249
2250			$.each($('.column_child.pos-bottom', event.currentTarget), function(index, val) {
2251				$(val).closest('.row-inner').css({
2252					'margin-top': '-1px'
2253				});
2254			});
2255
2256			setIndexActive(event, true);
2257		});
2258
2259		$elSelector.on('resized.owl.carousel', function(event) {
2260			if ($(this).closest('.nested-carousel').length) {
2261				requestTimeout(function() {
2262					window.dispatchEvent(UNCODE.boxEvent);
2263				}, 200);
2264			}
2265			if ( $(event.currentTarget).hasClass('owl-height-equal') )
2266				setItemsHeight(event.currentTarget);
2267
2268			setItemsRelHeight($elSelector);
2269
2270			setIndexActive(event);
2271		});
2272
2273		/** detect resize window for fluid height layout */
2274		var setFluidResize;
2275		function manageFluidCarouseHeight() {
2276			clearRequestTimeout(setFluidResize);
2277			setFluidResize = requestTimeout(function(){
2278				setItemsRelHeight($elSelector);
2279			}, 100);
2280		}
2281		window.addEventListener('resize', manageFluidCarouseHeight);
2282
2283		/** Change */
2284		$elSelector.on('change.owl.carousel', function(event) {
2285			if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
2286		});
2287
2288		/** Changed */
2289		$elSelector.on('changed.owl.carousel', function(event) {
2290			var $row = $elSelector.parents('.row')[0];
2291			if ( typeof $row !== 'undefined' ) {
2292				$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
2293			}
2294			setIndexActive(event);
2295		});
2296
2297		$elSelector.on('translate.owl.carousel', function(event) {
2298			if (UNCODE.isMobile) {
2299				$(event.currentTarget).addClass('owl-translating');
2300			}
2301		});
2302
2303		/** Translated */
2304		$elSelector.on('translated.owl.carousel', function(event) {
2305
2306			var currentItem = $(event.currentTarget).find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
2307				currentIndex = $(currentItem).attr('data-index'),
2308				stagePadding = $(event.currentTarget).data('stagepadding');
2309
2310			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
2311
2312			if (!UNCODE.isMobile) {
2313				UNCODE.owlPlayVideo(event.currentTarget);
2314			}
2315
2316			requestTimeout(function(){
2317				var lastDelayElems = animate_elems($('.owl-item.index-active', event.currentTarget));
2318				var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', event.currentTarget), event);
2319				if ($(event.currentTarget).closest('.uncode-slider').length && $(event.currentTarget).data('autoplay')) {
2320					if (lastDelayElems == undefined) lastDelayElems = 0;
2321					if (lastDelayThumb == undefined) lastDelayThumb = 0;
2322					var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
2323					$(event.currentTarget).trigger('stop.owl.autoplay');
2324					requestTimeout(function() {
2325						if (!$(event.currentTarget).hasClass('owl-mouseenter') && $(event.currentTarget).data('stopped') != 'true') $(event.currentTarget).trigger('play.owl.autoplay');
2326					}, maxDelay);
2327				}
2328			}, 200);
2329
2330			$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
2331				if ($(val).closest('.uncode-slider').length) {
2332					$(val).removeClass('start_animation');
2333				}
2334			});
2335
2336			$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
2337				if ($(val).closest('.uncode-slider').length) {
2338					$(val).removeClass('already-animated');
2339				}
2340			});
2341
2342			$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
2343				if ($(val).closest('.uncode-slider').length) {
2344					$(val).removeAttr('data-animated');
2345				}
2346			});
2347
2348			$.each($('.owl-item:not(.active)', event.currentTarget), function(index, val) {
2349				if ($(val).attr('data-index') != currentIndex) {
2350					$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
2351					$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
2352				}
2353				if ($(val).attr('data-index') != currentIndex) {
2354					$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
2355				}
2356				if ($(val).attr('data-index') == currentIndex) {
2357					$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
2358				}
2359			});
2360
2361			if (UNCODE.isMobile) {
2362				$(event.currentTarget).removeClass('owl-translating');
2363			}
2364
2365			setIndexActive(event);
2366		});
2367
2368		if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
2369
2370		/** Init carousel */
2371		$elSelector.not('.showControls').owlCarousel({
2372			items: values['items'],
2373			animateIn: (values['fade'] == true) ? 'fadeIn' : null,
2374			animateOut: (values['fade'] == true) ? 'fadeOut' : null,
2375			nav: values['nav'],
2376			dots: values['dots'],
2377			loop: values['loop'],
2378			stagePadding: values['stagepadding'],
2379			margin: 0,
2380			video: true,
2381			autoWidth: false,
2382			autoplay: false,
2383			autoplayTimeout: values['timeout'],
2384			autoplaySpeed: values['navspeed'],
2385			autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true,
2386			autoHeight: ( $(this).hasClass('owl-height-equal') ? false : ( $(this).hasClass('owl-height-auto') ? true : values['autoheight'] ) ),
2387			rtl: $('body').hasClass('rtl') ? true : false,
2388			fluidSpeed: true,
2389			navSpeed: values['navspeed'],
2390			dotsSpeed: values['navspeed'] / values['items'],
2391			navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
2392			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>'],
2393			navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
2394			responsiveClass: true,
2395			responsiveBaseElement: '.box-container',
2396			responsive: {
2397				0: {
2398					items: values['sm'],
2399					nav: values['navmobile'],
2400					dots: values['dotsmobile'],
2401					dotsSpeed: values['navspeed'] / values['sm'],
2402				},
2403				480: {
2404					items: values['sm'],
2405					nav: values['navmobile'],
2406					dots: values['dotsmobile'],
2407					dotsSpeed: values['navspeed'] / values['sm'],
2408				},
2409				570: {
2410					items: values['md'],
2411					nav: values['navmobile'],
2412					dots: values['dotsmobile'],
2413					dotsSpeed: values['navspeed'] / values['md'],
2414				},
2415				960: {
2416					items: values['lg'],
2417					dotsSpeed: values['navspeed'] / values['lg'],
2418				}
2419			}
2420		});
2421
2422		var transDuration = parseFloat(values['navspeed']) * 0.3;
2423		var transDuration2 = parseFloat(values['navspeed']) * 0.8;
2424
2425		$('.owl-item .tmb', $elSelector).css({
2426			'-webkit-transition-delay': transDuration + 'ms',
2427			'-moz-transition-delay': transDuration + 'ms',
2428			'-o-transition-delay': transDuration + 'ms',
2429			'transition-delay': transDuration + 'ms',
2430			'-webkit-transition-duration': transDuration2 + 'ms',
2431			'-moz-transition-duration': transDuration2 + 'ms',
2432			'-o-transition-duration': transDuration2 + 'ms',
2433			'transition-duration': transDuration2 + 'ms',
2434		});
2435
2436		requestTimeout(function() {
2437			for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
2438				UNCODE.setRowHeight($owlInsideEqual[i]);
2439			};
2440		}, 300);
2441
2442		$(window).on('load', function(){
2443			var $elCarousel = $elSelector.data('owl.carousel');
2444			if ( typeof $elCarousel !== 'undefined' ) {
2445				$elCarousel.trigger('refreshed');
2446				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
2447					UNCODE.setRowHeight($owlInsideEqual[i]);
2448				};
2449			}
2450		});
2451
2452		$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
2453			if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
2454				$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
2455				$('#' + carousel_id).find('.owl-item').each( function() {
2456					var $item = $(this),
2457						index = ( $item.index() + 1 );
2458					$item.attr('data-index', index);
2459				});
2460			}
2461		});
2462
2463		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2464			window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
2465				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
2466					$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
2467					$('#' + carousel_id).find('.owl-item').each( function() {
2468						var $item = $(this),
2469							index = ( $item.index() + 1 );
2470						$item.attr('data-index', index);
2471					});
2472				}
2473			});
2474		}
2475
2476	});
2477
2478	function firstLoaded(el, event) {
2479		var el = $(el),
2480		uncode_slider = el.find('.uncode-slider');
2481		el.find('.owl-carousel').css('opacity', 1);
2482		uncode_slider.addClass('slider-loaded');
2483		window.uncode_textfill(el.find('.owl-item.active'));
2484		//if (!UNCODE.isMobile) {
2485			requestTimeout(function() {
2486				var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
2487				var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
2488				if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
2489					if (lastDelayElems == undefined) lastDelayElems = 0;
2490					if (lastDelayThumb == undefined) lastDelayThumb = 0;
2491					var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
2492					$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
2493					requestTimeout(function() {
2494						$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
2495					}, maxDelay);
2496				}
2497			}, 500);
2498
2499		//}
2500	}
2501
2502	function navHover(el) {
2503		var $owlCont = el,
2504			$owlPrev = $owlCont.find('.owl-prev'),
2505			$owlNext = $owlCont.find('.owl-next'),
2506			$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
2507			$owlPagination = $owlCont.next(),
2508			owlPrevW = $owlPrev.outerWidth(),
2509			owlNextW = $owlNext.outerWidth(),
2510			owlDotsH = $owlDots.innerHeight(),
2511			owlTime = 400,
2512			owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
2513		if ( $('body').hasClass('rtl') ) {
2514			$owlPrev.css("margin-right", -owlPrevW);
2515			$owlNext.css("margin-left", -owlNextW);
2516		} else {
2517			$owlPrev.css("margin-left", -owlPrevW);
2518			$owlNext.css("margin-right", -owlNextW);
2519		}
2520		if (!owlNested) $owlDots.css("bottom", -owlDotsH);
2521		$owlCont.mouseenter(function() {
2522			owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
2523			$owlPrev.add($owlNext).css({
2524				marginLeft: 0,
2525				marginRight: 0
2526			});
2527			if (!owlNested) {
2528				$owlDots.css({
2529					opacity: 1,
2530					bottom: 0
2531				});
2532			}
2533		}).mouseleave(function() {
2534			owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
2535			if ( $('body').hasClass('rtl') ) {
2536				$owlPrev.css("margin-right", -owlPrevW);
2537				$owlNext.css("margin-left", -owlNextW);
2538			} else {
2539				$owlPrev.css("margin-left", -owlPrevW);
2540				$owlNext.css("margin-right", -owlNextW);
2541			}
2542			if (!owlNested) {
2543				$owlDots.css({
2544					opacity: 1,
2545					bottom: -owlDotsH
2546				});
2547			}
2548		});
2549	};
2550
2551	function animate_elems($this) {
2552		var lastDelay;
2553		$.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) {
2554			var element = $(val),
2555				delayAttr = element.attr('data-delay'),
2556				$first_item = element.closest('.owl-item[data-index="1"]');
2557
2558			if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
2559				return false;
2560			}
2561
2562			if (delayAttr == undefined) delayAttr = 0;
2563			requestTimeout(function() {
2564				element.addClass('start_animation');
2565			}, delayAttr);
2566			lastDelay = delayAttr;
2567		});
2568		return lastDelay;
2569	}
2570
2571	function animate_thumb(items, event) {
2572		var lastDelay,
2573			itemIndex,
2574			tempIndex = ($(event.currentTarget).data('tempIndex') == undefined) ? $('.owl-item.active', event.currentTarget).first().index() : $(event.currentTarget).data('tempIndex'),
2575			numActives = $('.owl-item.active', event.currentTarget).length,
2576			stagePadding = $(event.currentTarget).data('stagepadding');
2577
2578		stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
2579
2580		$(event.currentTarget).data('tempIndex', event.item.index);
2581			$.each(items, function(index, val) {
2582				var parent = $(val).closest('.owl-item');
2583				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
2584					return;
2585				}
2586				if (!$(val).hasClass('start_animation')) {
2587					if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
2588						var thumbInView = new Waypoint.Inview({
2589						  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
2590						  element: val,
2591						  enter: function(direction) {
2592							var element = $(this.element),
2593									delayAttr = parseInt(element.attr('data-delay')),
2594									itemIndex = element.closest('.owl-item').index() + 1,
2595									diffItem = Math.abs(itemIndex - tempIndex) - 1;
2596								if (itemIndex > tempIndex) {
2597									$(event.currentTarget).data('tempIndex', itemIndex);
2598								}
2599								if (isNaN(delayAttr)) delayAttr = 100;
2600								if (stagePadding) {
2601									var objTimeout = requestTimeout(function() {
2602										element.addClass('start_animation');
2603									}, index * delayAttr);
2604									lastDelay = index * delayAttr;
2605								} else {
2606									$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', event.currentTarget).addClass('start_animation');
2607									var objTimeout = requestTimeout(function() {
2608										element.addClass('start_animation');
2609									}, diffItem * delayAttr);
2610									lastDelay = diffItem * delayAttr;
2611								}
2612								parent.data('objTimeout', objTimeout);
2613								if (!UNCODE.isUnmodalOpen) {
2614									this.destroy();
2615								}
2616							}
2617						});
2618					}
2619				}
2620			});
2621			return lastDelay;
2622		}
2623
2624	function setItemsHeight(item) {
2625		$.each($('.owl-item', item), function(index, val) {
2626			var availableThumbHeight = $('.t-inside', $(val)).height(),
2627			innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
2628			difference = availableThumbHeight - innerThumbHeight;
2629			if ($('.tmb-content-under', val).length) {
2630				var visualPart = $('.t-entry-visual', val);
2631				if (visualPart.length) {
2632					difference -= $('.t-entry-visual', val).height();
2633				}
2634			}
2635			if (! $('.tmb-content-lateral', val).length)
2636				$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
2637		});
2638	}
2639
2640	function setItemsRelHeight(item) {
2641		$.each($('.owl-item', item), function(index, val) {
2642			var $rowContainer = $(item).parents('.row-parent').eq(0),
2643				paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
2644				$colContainer = $(item).parents('.uncell').eq(0),
2645				paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
2646				winHeight = UNCODE.wheight,
2647				multiplier_h = parseInt($(item).attr('data-vp-height')),
2648				data_viewport_h,
2649				consider_menu = $(item).data('vp-menu');
2650
2651			if ( consider_menu ) {
2652				winHeight = winHeight - UNCODE.menuHeight;
2653			}
2654
2655			data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
2656			$('.t-inside', val).css( 'height', data_viewport_h );
2657		});
2658	}
2659
2660	function pauseOnHover(slider) {
2661		$('.owl-dots, .owl-prev, .owl-next', slider).on({
2662		mouseenter: function () {
2663			$(slider).addClass('owl-mouseenter');
2664			$(slider).trigger('stop.owl.autoplay');
2665		},
2666		mouseleave: function () {
2667			$(slider).removeClass('owl-mouseenter')
2668		  $(slider).trigger('play.owl.autoplay');
2669		}
2670		});
2671	}
2672};
2673
2674UNCODE.owlPlayVideo = function(carousel) {
2675	var player, iframe;
2676	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
2677		var content = $(val).html();
2678		if (content == '') {
2679			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
2680			$(val).append(getCloned);
2681		}
2682		if ($(this).attr('data-provider') == 'vimeo') {
2683			iframe = $(this).find('iframe');
2684			player = $f(iframe[0]);
2685			player.api('play');
2686		} else if ($(this).attr('data-provider') == 'youtube') {
2687			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
2688		} else {
2689			var player = $(this).find('video');
2690			if (player.length) {
2691				$(this).find('video')[0].volume = 0;
2692				$(this).find('video')[0].play();
2693				$(val).css('opacity', 1);
2694			}
2695		}
2696	});
2697};
2698
2699UNCODE.owlStopVideo = function(carousel) {
2700	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
2701		var player, iframe;
2702		if ($(this).attr('data-provider') == 'vimeo') {
2703			iframe = $(this).find('iframe');
2704			player = $f(iframe[0]);
2705			player.api('pause');
2706		} else if ($(this).attr('data-provider') == 'youtube') {
2707			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
2708		} else {
2709			var player = $(this).find('video');
2710			if (player.length) {
2711				$(this).find('video')[0].volume = 0;
2712				$(this).find('video')[0].play();
2713			}
2714		}
2715	});
2716};
2717
2718UNCODE.animations = function() {
2719
2720	var runWaypoints_TO,
2721		highlightComplexFunc = function($wrap){
2722
2723		var $lines = $('.heading-line-wrap', $wrap),
2724			not_animate = false;
2725
2726		if ( $wrap.data('animate') === true ) {
2727			not_animate = true;
2728		}
2729		$lines.each(function(_key, _value){
2730			var $line = $(_value),
2731				$inners = $('.split-word-inner', $line),
2732				$highlights = $('.heading-text-highlight-inner', $line);
2733
2734			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
2735				if ( not_animate ) {
2736					$highlights.each(function(h_key, high){
2737						var $highlight = $(high);
2738						$highlight.css({
2739							'-webkit-transition-duration': '0ms',
2740							'-moz-transition-duration': '0ms',
2741							'-o-transition-duration': '0ms',
2742							'transition-duration': '0ms',
2743						});
2744					});
2745					$highlights.removeAttr('data-animated');
2746				} else {
2747					$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
2748						var delay = 0;
2749						$highlights.each(function(h_key, high){
2750							var $highlight = $(high),
2751								$split = $highlight.closest('.split-word'),
2752								$nextSplit = $split.next(),
2753								$next = $('.heading-text-highlight-inner', $nextSplit),
2754								countCh = $split.text().length;
2755
2756							$highlight.css({
2757								'-webkit-transition-duration': (30 * countCh) + 'ms',
2758								'-moz-transition-duration': (30 * countCh) + 'ms',
2759								'-o-transition-duration': (30 * countCh) + 'ms',
2760								'transition-duration': (30 * countCh) + 'ms',
2761							});
2762
2763							delay += (30 * countCh);
2764
2765							$next.css({
2766								'-webkit-transition-delay': delay + 'ms',
2767								'-moz-transition-delay': delay + 'ms',
2768								'-o-transition-delay': delay + 'ms',
2769								'transition-delay': delay + 'ms',
2770							});
2771						});
2772						$highlights.removeAttr('data-animated');
2773						if ( _key+1 === $lines.length ) {
2774							$wrap.data('animate', true);
2775						}
2776					});
2777				}
2778			}
2779		});
2780	};
2781
2782	$.each($('.header-content-inner'), function(index, val) {
2783		var element = $(val),
2784			transition = '';
2785		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
2786		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
2787		if (element.hasClass('left-t-right')) transition = 'left-t-right';
2788		if (element.hasClass('right-t-left')) transition = 'right-t-left';
2789		if (element.hasClass('zoom-in')) transition = 'zoom-in';
2790		if (element.hasClass('zoom-out')) transition = 'zoom-out';
2791		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
2792		if (transition != '') {
2793			$(val).removeClass(transition);
2794			var container = element,
2795				containerDelay = container.attr('data-delay'),
2796				containerSpeed = container.attr('data-speed'),
2797				items = $('.header-title > *, .post-info', container);
2798			$.each(items, function(index, val) {
2799				var element = $(val),
2800					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
2801					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
2802				if (!element.hasClass('animate_when_almost_visible')) {
2803					delayAttr = Number(delayAttr) + (400 * index);
2804					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
2805					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
2806				}
2807			});
2808			container.css('opacity', 1);
2809		}
2810	});
2811
2812	window.waypoint_animation = function() {
2813		$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside), .tmb-media .animate_when_almost_visible:not(.start_animation)'), function(index, val) {
2814			if ( $(val).hasClass('el-text-split') ) {
2815				return true;
2816			}
2817			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
2818				return;
2819			}
2820			var run = true,
2821				$carousel = $(val).closest('.owl-carousel'),
2822				$first_item = $(val).closest('.owl-item[data-index="1"]'),
2823				$all_first = $('.owl-item[data-index="1"]', $carousel);
2824			if ( $carousel.length && ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) ) {
2825				run = false;
2826			}
2827			if (run) {
2828				new Waypoint({
2829					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
2830					element: val,
2831					handler: function() {
2832						var element = $(this.element),
2833							index = element.index(),
2834							delayAttr = element.attr('data-delay');
2835						if (delayAttr == undefined) delayAttr = 0;
2836						requestTimeout(function() {
2837							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
2838								$all_first.attr('data-already-reached', 'true');
2839							}
2840							element.addClass('start_animation');
2841						}, delayAttr);
2842						if (!UNCODE.isUnmodalOpen) {
2843							this.destroy();
2844						}
2845					},
2846					offset: UNCODE.isFullPage ? '100%' : '90%'
2847				});
2848			}
2849		});
2850		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
2851			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
2852				return;
2853			}
2854			var run = true,
2855				$carousel = $(val).closest('.owl-carousel'),
2856				$first_item = $(val).closest('.owl-item[data-index="1"]'),
2857				$all_first = $('.owl-item[data-index="1"]', $carousel);
2858			if ( $carousel.length && ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $first_item.attr('data-front-edited') !== 'true' ) ) {
2859				run = false;
2860			}
2861			if (run) {
2862				new Waypoint({
2863					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
2864					element: val,
2865					handler: function() {
2866						var $element = $(this.element),
2867							$childs = $('.animate_when_parent_almost_visible', $element);
2868						$childs.each(function(key,el){
2869							var $child = $(el),
2870								delaySpeed = $child.attr('data-speed'),
2871								delayAttr = $child.attr('data-delay'),
2872								intervalAttr = $child.attr('data-interval');
2873							if (delayAttr == undefined) {
2874								delayAttr = 50*key;
2875							}
2876							requestTimeout(function() {
2877								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
2878									$all_first.attr('data-already-reached', 'true');
2879								}
2880								$child.addClass('start_animation');
2881								if ( $child.hasClass('anim-line-checker') ) {
2882									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
2883										var $line = $child.closest('.heading-line-wrap');
2884									});
2885								}
2886								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
2887								highlightComplexFunc($wrapText);
2888								if ( $child.hasClass('anim-tot-checker') ) {
2889									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
2890										if ( $child.hasClass('anim-tot-checker') ) {
2891											$wrapText.addClass('already-animated');
2892										}
2893									});
2894								}
2895							}, delayAttr );
2896						});
2897						$element.addClass('start_animation');
2898						if (!UNCODE.isUnmodalOpen) {
2899							this.destroy();
2900						}
2901					},
2902					offset: UNCODE.isFullPage ? '100%' : '90%'
2903				});
2904			}
2905		});
2906	}
2907
2908	var runWaypoints = function(){
2909		clearRequestTimeout(runWaypoints_TO);
2910		runWaypoints_TO = requestTimeout(function() {
2911			window.waypoint_animation();
2912		}, 400);
2913	};
2914	runWaypoints();
2915	$( document.body ).on( 'uncode_waypoints', runWaypoints );
2916	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2917		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
2918	}
2919
2920	// var tmbImgAnimMove = function(){
2921
2922	// 	var $wraps = $('.tmb.tmb-image-anim-move .t-inside').has('.t-background-cover, img:not(.avatar)');
2923	// 	$wraps.each(function(){
2924	// 		var $wrap = $(this),
2925	// 			$pushed = $('.t-entry-visual', $wrap),
2926	// 			$img = $('.t-background-cover, .t-entry-visual img:not(.avatar)', $wrap),
2927	// 			$tmb = $wrap.closest('.tmb'),
2928	// 			parentOffset,
2929	// 			wrapW,
2930	// 			wrapH;
2931	// 		$pushed.on('mousemove', function(e){
2932	// 			parentOffset = $pushed.offset();
2933	// 			wrapW = $pushed.width();
2934	// 			wrapH = $pushed.height();
2935
2936	// 	        var pageX = ( ( e.pageX - parentOffset.left ) / wrapW ) * 100 + '% ';
2937	// 	        var pageY = ( ( e.pageY - parentOffset.top ) / wrapH ) * 100 + '%';
2938
2939	// 	        $img.css({
2940	// 	        	'transform-origin': pageX + pageY
2941	// 	        });
2942	// 	    });
2943	// 	    $wrap.on('mouseover', function(e){
2944	// 			$img.css({
2945	// 				'transform': 'scale(1.05)',
2946	// 			});
2947	// 	    }).on('mouseleave', function(e){
2948	// 	        $img.css({
2949	// 	        	'transform': 'scale(1)',
2950	// 	        });
2951	// 	    });
2952	// 	});
2953
2954	// };
2955
2956	// tmbImgAnimMove();
2957	// $( document.body ).on( 'isotope-shortcodeView-updated', tmbImgAnimMove );
2958};
2959
2960UNCODE.tapHover = function() {
2961
2962	var $el = $('html.touch .tmb:not(.tmb-no-double-tap) .t-entry-visual-cont > a'), //.length //html.touch a.btn
2963		elClass = "hover";
2964
2965	$(window).on('click', function() {
2966		$el.removeClass(elClass);
2967	});
2968
2969	$el.on("click", function(e) { // cambia click con touch start 'touchstart'
2970		e.stopPropagation();
2971		var link = $(this);
2972		if ( ! link.hasClass(elClass)) {
2973			e.preventDefault();
2974			link.addClass("hover");
2975			$el.not(this).removeClass(elClass);
2976			return false;
2977		}
2978	});
2979};
2980
2981UNCODE.onePage = function(isMobile) {
2982	var current = 0,
2983		last = 0,
2984		lastScrollTop = 0,
2985		forceScroll = false,
2986		lastScrolled = 0,
2987		isSectionscroller = ($('.main-onepage').length) ? true : false,
2988		isOnePage = false,
2989		getOffset = function () {
2990			var calculateOffset = (($('.menu-sticky .menu-container:not(.menu-hide)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide)').outerHeight() : 0);
2991			return calculateOffset;
2992		}
2993
2994	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
2995	// 	return false;
2996
2997	function init_onepage() {
2998		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
2999			$("<ul class='onepage-pagination'></ul>").prependTo("body");
3000		}
3001		last = $('.onepage-pagination li').last().find('a').data('index');
3002		$.each($('div[data-parent=true]'), function(index, val) {
3003			$(this).attr('data-section', index);
3004			if (isMobile) return;
3005			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3006				return;
3007			}
3008			var sectionDown = new Waypoint({
3009				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3010				element: val,
3011				handler: function(direction) {
3012					if (direction == 'down') {
3013						changeMenuActive(this.element, index);
3014					}
3015				},
3016				offset: function() {
3017					return 5 + getOffset()
3018				}
3019			});
3020			var sectionUp = new Waypoint({
3021				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3022				element: val,
3023				handler: function(direction) {
3024					if (direction == 'up') {
3025						changeMenuActive(this.element, index);
3026					}
3027				},
3028				offset: function() {
3029					return -5 - getOffset()
3030				}
3031			});
3032
3033			if (isSectionscroller) {
3034				var label;
3035				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
3036				else label = '';
3037				var getName = $(this).attr('data-name');
3038				if (getName == undefined) getName = index;
3039				if (label != '') {
3040					isOnePage = true;
3041					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
3042					$('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>");
3043				}
3044			}
3045		});
3046
3047		if (isSectionscroller) {
3048			$.each($('ul.onepage-pagination li'), function(index, val) {
3049				var $this = $(val);
3050				$this.on('click', function(evt) {
3051					if ( $('body').hasClass('uncode-scroll-no-history') )
3052						evt.preventDefault();
3053					Waypoint.refreshAll();
3054					var el = $('a', evt.currentTarget);
3055					current = lastScrolled = parseInt(el.attr('data-index'));
3056					lastScrolled += 1;
3057					scrollBody(current);
3058				});
3059			});
3060		}
3061
3062		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
3063		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
3064			goToSection = String(window.location.hash).replace(/^#/, "");
3065			goToSection = Number($('[data-name=' + goToSection + ']').attr('data-section'));
3066		}
3067
3068		if (typeof goToSection === 'number' && !isNaN(goToSection)) {
3069			current = lastScrolled = goToSection;
3070			$(window).on('load', function(){
3071				scrollBody(goToSection);
3072			});
3073		}
3074
3075	}
3076
3077	function changeMenuActive(section, index) {
3078		current = lastScrolled = parseInt($(section).attr('data-section'));
3079		if (isOnePage) {
3080			var newSection = $('.onepage-pagination li a[data-index=' + index + ']');
3081			if (newSection.length) {
3082				$('ul.onepage-pagination li a').removeClass('is-selected');
3083				newSection.addClass('is-selected');
3084			}
3085			var getName = $('[data-section=' + index + ']').attr('data-name');
3086			if (getName != undefined && getName !== '') {
3087				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
3088					var get_href = $(val).attr('href');
3089					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
3090						$(val).closest('.menu-smart').find('.active').removeClass('active');
3091						$(val).parent().addClass('active');
3092					}
3093				});
3094			}
3095		}
3096	}
3097
3098	if (isOnePage) {
3099		$(window).on('scroll', function() {
3100			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
3101			if (bodyTop == 0) {
3102				$('ul.onepage-pagination li a').removeClass('is-selected');
3103				$('.onepage-pagination li a[data-index=0]').addClass('is-selected');
3104				var getName = $('[data-section=0]').attr('data-name');
3105				if (getName != undefined && getName !== '') {
3106					$.each($('.menu-container .menu-item > a'), function(i, val) {
3107						var get_href = $(val).attr('href');
3108						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
3109							$(val).closest('ul').find('.active').removeClass('active');
3110							$(val).parent().addClass('active');
3111						}
3112					});
3113				}
3114			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
3115				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
3116				if (lastSection.length) {
3117					$('ul.onepage-pagination li a').removeClass('is-selected');
3118					lastSection.addClass('is-selected');
3119				}
3120			}
3121		});
3122	}
3123
3124	var scrollBody = function(index) {
3125		$('ul.onepage-pagination li a').removeClass('is-selected');
3126		$('.onepage-pagination li a[data-index=' + index + ']').addClass('is-selected');
3127
3128		var getSection = $('[data-section=' + index + ']'),
3129			scrollTo;
3130
3131		if (getSection == undefined) return;
3132
3133		var body = $("html, body"),
3134		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3135		delta = bodyTop - ($('[data-section=' + index + ']').length ? $('[data-section=' + index + ']').offset().top : 0),
3136		getOffset = UNCODE.get_scroll_offset(index);
3137		if ( typeof getSection.offset() === 'undefined' )
3138			return;
3139		scrollTo = getSection.offset().top;
3140
3141
3142
3143		var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
3144		if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
3145			scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
3146		}
3147
3148		if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) {
3149			if ( index === 0 ) {
3150				scrollTo = 0;
3151			} else {
3152				scrollTo -= $('.menu-sticky .menu-container').outerHeight();
3153			}
3154		} else {
3155			scrollTo -= getOffset;
3156		}
3157
3158		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
3159		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3160
3161		if (index != 0) {
3162			UNCODE.scrolling = true;
3163		}
3164
3165		if (scrollSpeed == 0) {
3166			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
3167			UNCODE.scrolling = false;
3168		} else {
3169			body.animate({
3170				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
3171			}, scrollSpeed, 'easeInOutQuad', function() {
3172				requestTimeout(function(){
3173					UNCODE.scrolling = false;
3174					if (getOffset != UNCODE.get_scroll_offset(index)) {
3175						scrollBody(index);
3176					}
3177				}, 100);
3178			});
3179		}
3180
3181	};
3182
3183	init_onepage();
3184};
3185
3186UNCODE.stickyElements = function() {
3187	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
3188	if (!isMobile_wide) {
3189
3190		var calculateOffset = function(el) {
3191			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
3192				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
3193				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0;
3194
3195			sideOffset += UNCODE.bodyBorder;
3196
3197			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
3198			if ($('.menu-sticky .menu-container:not(.menu-hide)').length) {
3199				if ($('.menu-shrink').length) {
3200					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
3201				} else sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
3202			}
3203
3204			return sideOffset;
3205
3206		},
3207
3208		initStickyElement = function() {
3209			$.each($('.sticky-element'), function(index, element) {
3210				$(element).stick_in_parent({
3211					sticky_class: 'is_stucked',
3212					offset_top: calculateOffset(element),
3213					bottoming: true,
3214					inner_scrolling: SiteParameters.sticky_elements === 'on'
3215				});
3216			});
3217		};
3218
3219		requestTimeout(function() {
3220			if ($('.sticky-element').length) {
3221
3222				if ($(window).width() > UNCODE.mediaQuery) {
3223					initStickyElement();
3224				}
3225
3226				$(window).on('resize', function(event) {
3227					if ($(window).width() > UNCODE.mediaQuery) {
3228						initStickyElement();
3229					} else {
3230						$(".sticky-element").trigger("sticky_kit:detach");
3231					}
3232				});
3233			}
3234		}, 1000);
3235
3236		var $panels = $('.panel-collapse');
3237		if ( $panels.length ) {
3238			$panels.each(function(){
3239				var $panel = $(this);
3240				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
3241					$(document.body).trigger("sticky_kit:recalc");
3242				});
3243			});
3244		}
3245	}
3246};
3247
3248UNCODE.twentytwenty = function() {
3249
3250  if (!$('.twentytwenty-container').length) return;
3251
3252  // jquery.event.move
3253  //
3254  // 1.3.6
3255  //
3256  // Stephen Band
3257  //
3258  // Triggers 'movestart', 'move' and 'moveend' events after
3259  // mousemoves following a mousedown cross a distance threshold,
3260  // similar to the native 'dragstart', 'drag' and 'dragend' events.
3261  // Move events are throttled to animation frames. Move event objects
3262  // have the properties:
3263  //
3264  // pageX:
3265  // pageY:   Page coordinates of pointer.
3266  // startX:
3267  // startY:  Page coordinates of pointer at movestart.
3268  // distX:
3269  // distY:  Distance the pointer has moved since movestart.
3270  // deltaX:
3271  // deltaY:  Distance the finger has moved since last event.
3272  // velocityX:
3273  // velocityY:  Average velocity over last few events.
3274
3275
3276  (function (module) {
3277    if (typeof define === 'function' && define.amd) {
3278      // AMD. Register as an anonymous module.
3279      define(['jquery'], module);
3280    } else {
3281      // Browser globals
3282      module(jQuery);
3283    }
3284  })(function(jQuery, undefined){
3285
3286    var // Number of pixels a pressed pointer travels before movestart
3287        // event is fired.
3288        threshold = 6,
3289
3290        add = jQuery.event.add,
3291
3292        remove = jQuery.event.remove,
3293
3294        // Just sugar, so we can have arguments in the same order as
3295        // add and remove.
3296        trigger = function(node, type, data) {
3297          jQuery.event.trigger(type, data, node);
3298        },
3299
3300        // Shim for requestAnimationFrame, falling back to timer. See:
3301        // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
3302        requestFrame = (function(){
3303          return (
3304            window.requestAnimationFrame ||
3305            window.webkitRequestAnimationFrame ||
3306            window.mozRequestAnimationFrame ||
3307            window.oRequestAnimationFrame ||
3308            window.msRequestAnimationFrame ||
3309            function(fn, element){
3310              return window.setTimeout(function(){
3311                fn();
3312              }, 25);
3313            }
3314          );
3315        })(),
3316
3317        ignoreTags = {
3318          textarea: true,
3319          input: true,
3320          select: true,
3321          button: true
3322        },
3323
3324        mouseevents = {
3325          move: 'mousemove',
3326          cancel: 'mouseup dragstart',
3327          end: 'mouseup'
3328        },
3329
3330        touchevents = {
3331          move: 'touchmove',
3332          cancel: 'touchend',
3333          end: 'touchend'
3334        };
3335
3336
3337    // Constructors
3338
3339    function Timer(fn){
3340      var callback = fn,
3341          active = false,
3342          running = false;
3343
3344      function trigger(time) {
3345        if (active){
3346          callback();
3347          requestFrame(trigger);
3348          running = true;
3349          active = false;
3350        }
3351        else {
3352          running = false;
3353        }
3354      }
3355
3356      this.kick = function(fn) {
3357        active = true;
3358        if (!running) { trigger(); }
3359      };
3360
3361      this.end = function(fn) {
3362        var cb = callback;
3363
3364        if (!fn) { return; }
3365
3366        // If the timer is not running, simply call the end callback.
3367        if (!running) {
3368          fn();
3369        }
3370        // If the timer is running, and has been kicked lately, then
3371        // queue up the current callback and the end callback, otherwise
3372        // just the end callback.
3373        else {
3374          callback = active ?
3375            function(){ cb(); fn(); } :
3376            fn ;
3377
3378          active = true;
3379        }
3380      };
3381    }
3382
3383
3384    // Functions
3385
3386    function returnTrue() {
3387      return true;
3388    }
3389
3390    function returnFalse() {
3391      return false;
3392    }
3393
3394    function preventDefault(e) {
3395      e.preventDefault();
3396    }
3397
3398    function preventIgnoreTags(e) {
3399      // Don't prevent interaction with form elements.
3400      if (ignoreTags[ e.target.tagName.toLowerCase() ]) { return; }
3401
3402      e.preventDefault();
3403    }
3404
3405    function isLeftButton(e) {
3406      // Ignore mousedowns on any button other than the left (or primary)
3407      // mouse button, or when a modifier key is pressed.
3408      return (e.which === 1 && !e.ctrlKey && !e.altKey);
3409    }
3410
3411    function identifiedTouch(touchList, id) {
3412      var i, l;
3413
3414      if (touchList.identifiedTouch) {
3415        return touchList.identifiedTouch(id);
3416      }
3417
3418      // touchList.identifiedTouch() does not exist in
3419      // webkit yet… we must do the search ourselves...
3420
3421      i = -1;
3422      l = touchList.length;
3423
3424      while (++i < l) {
3425        if (touchList[i].identifier === id) {
3426          return touchList[i];
3427        }
3428      }
3429    }
3430
3431    function changedTouch(e, event) {
3432      var touch = identifiedTouch(e.changedTouches, event.identifier);
3433
3434      // This isn't the touch you're looking for.
3435      if (!touch) { return; }
3436
3437      // Chrome Android (at least) includes touches that have not
3438      // changed in e.changedTouches. That's a bit annoying. Check
3439      // that this touch has changed.
3440      if (touch.pageX === event.pageX && touch.pageY === event.pageY) { return; }
3441
3442      return touch;
3443    }
3444
3445
3446    // Handlers that decide when the first movestart is triggered
3447
3448    function mousedown(e){
3449      var data;
3450
3451      if (!isLeftButton(e)) { return; }
3452
3453      data = {
3454        target: e.target,
3455        startX: e.pageX,
3456        startY: e.pageY,
3457        timeStamp: e.timeStamp
3458      };
3459
3460      add(document, mouseevents.move, mousemove, data);
3461      add(document, mouseevents.cancel, mouseend, data);
3462    }
3463
3464    function mousemove(e){
3465      var data = e.data;
3466
3467      checkThreshold(e, data, e, removeMouse);
3468    }
3469
3470    function mouseend(e) {
3471      removeMouse();
3472    }
3473
3474    function removeMouse() {
3475      remove(document, mouseevents.move, mousemove);
3476      remove(document, mouseevents.cancel, mouseend);
3477    }
3478
3479    function touchstart(e) {
3480      var touch, template;
3481
3482      // Don't get in the way of interaction with form elements.
3483      if (ignoreTags[ e.target.tagName.toLowerCase() ]) { return; }
3484
3485      touch = e.changedTouches[0];
3486
3487      // iOS live updates the touch objects whereas Android gives us copies.
3488      // That means we can't trust the touchstart object to stay the same,
3489      // so we must copy the data. This object acts as a template for
3490      // movestart, move and moveend event objects.
3491      template = {
3492        target: touch.target,
3493        startX: touch.pageX,
3494        startY: touch.pageY,
3495        timeStamp: e.timeStamp,
3496        identifier: touch.identifier
3497      };
3498
3499      // Use the touch identifier as a namespace, so that we can later
3500      // remove handlers pertaining only to this touch.
3501      add(document, touchevents.move + '.' + touch.identifier, touchmove, template);
3502      add(document, touchevents.cancel + '.' + touch.identifier, touchend, template);
3503    }
3504
3505    function touchmove(e){
3506      var data = e.data,
3507          touch = changedTouch(e, data);
3508
3509      if (!touch) { return; }
3510
3511      checkThreshold(e, data, touch, removeTouch);
3512    }
3513
3514    function touchend(e) {
3515      var template = e.data,
3516          touch = identifiedTouch(e.changedTouches, template.identifier);
3517
3518      if (!touch) { return; }
3519
3520      removeTouch(template.identifier);
3521    }
3522
3523    function removeTouch(identifier) {
3524      remove(document, '.' + identifier, touchmove);
3525      remove(document, '.' + identifier, touchend);
3526    }
3527
3528
3529    // Logic for deciding when to trigger a movestart.
3530
3531    function checkThreshold(e, template, touch, fn) {
3532      var distX = touch.pageX - template.startX,
3533          distY = touch.pageY - template.startY;
3534
3535      // Do nothing if the threshold has not been crossed.
3536      if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
3537
3538      triggerStart(e, template, touch, distX, distY, fn);
3539    }
3540
3541    function handled() {
3542      // this._handled should return false once, and after return true.
3543      this._handled = returnTrue;
3544      return false;
3545    }
3546
3547    function flagAsHandled(e) {
3548      e._handled();
3549    }
3550
3551    function triggerStart(e, template, touch, distX, distY, fn) {
3552      var node = template.target,
3553          touches, time;
3554
3555      touches = e.targetTouches;
3556      time = e.timeStamp - template.timeStamp;
3557
3558      // Create a movestart object with some special properties that
3559      // are passed only to the movestart handlers.
3560      template.type = 'movestart';
3561      template.distX = distX;
3562      template.distY = distY;
3563      template.deltaX = distX;
3564      template.deltaY = distY;
3565      template.pageX = touch.pageX;
3566      template.pageY = touch.pageY;
3567      template.velocityX = distX / time;
3568      template.velocityY = distY / time;
3569      template.targetTouches = touches;
3570      template.finger = touches ?
3571        touches.length :
3572        1 ;
3573
3574      // The _handled method is fired to tell the default movestart
3575      // handler that one of the move events is bound.
3576      template._handled = handled;
3577
3578      // Pass the touchmove event so it can be prevented if or when
3579      // movestart is handled.
3580      template._preventTouchmoveDefault = function() {
3581        e.preventDefault();
3582      };
3583
3584      // Trigger the movestart event.
3585      trigger(template.target, template);
3586
3587      // Unbind handlers that tracked the touch or mouse up till now.
3588      fn(template.identifier);
3589    }
3590
3591
3592    // Handlers that control what happens following a movestart
3593
3594    function activeMousemove(e) {
3595      var timer = e.data.timer;
3596
3597      e.data.touch = e;
3598      e.data.timeStamp = e.timeStamp;
3599      timer.kick();
3600    }
3601
3602    function activeMouseend(e) {
3603      var event = e.data.event,
3604          timer = e.data.timer;
3605
3606      removeActiveMouse();
3607
3608      endEvent(event, timer, function() {
3609        // Unbind the click suppressor, waiting until after mouseup
3610        // has been handled.
3611        setTimeout(function(){
3612          remove(event.target, 'click', returnFalse);
3613        }, 0);
3614      });
3615    }
3616
3617    function removeActiveMouse(event) {
3618      remove(document, mouseevents.move, activeMousemove);
3619      remove(document, mouseevents.end, activeMouseend);
3620    }
3621
3622    function activeTouchmove(e) {
3623      var event = e.data.event,
3624          timer = e.data.timer,
3625          touch = changedTouch(e, event);
3626
3627      if (!touch) { return; }
3628
3629      // Stop the interface from gesturing
3630      e.preventDefault();
3631
3632      event.targetTouches = e.targetTouches;
3633      e.data.touch = touch;
3634      e.data.timeStamp = e.timeStamp;
3635      timer.kick();
3636    }
3637
3638    function activeTouchend(e) {
3639      var event = e.data.event,
3640          timer = e.data.timer,
3641          touch = identifiedTouch(e.changedTouches, event.identifier);
3642
3643      // This isn't the touch you're looking for.
3644      if (!touch) { return; }
3645
3646      removeActiveTouch(event);
3647      endEvent(event, timer);
3648    }
3649
3650    function removeActiveTouch(event) {
3651      remove(document, '.' + event.identifier, activeTouchmove);
3652      remove(document, '.' + event.identifier, activeTouchend);
3653    }
3654
3655
3656    // Logic for triggering move and moveend events
3657
3658    function updateEvent(event, touch, timeStamp, timer) {
3659      var time = timeStamp - event.timeStamp;
3660
3661      event.type = 'move';
3662      event.distX =  touch.pageX - event.startX;
3663      event.distY =  touch.pageY - event.startY;
3664      event.deltaX = touch.pageX - event.pageX;
3665      event.deltaY = touch.pageY - event.pageY;
3666
3667      // Average the velocity of the last few events using a decay
3668      // curve to even out spurious jumps in values.
3669      event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
3670      event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
3671      event.pageX =  touch.pageX;
3672      event.pageY =  touch.pageY;
3673    }
3674
3675    function endEvent(event, timer, fn) {
3676      timer.end(function(){
3677        event.type = 'moveend';
3678
3679        trigger(event.target, event);
3680
3681        return fn && fn();
3682      });
3683    }
3684
3685
3686    // jQuery special event definition
3687
3688    function setup(data, namespaces, eventHandle) {
3689      // Stop the node from being dragged
3690      //add(this, 'dragstart.move drag.move', preventDefault);
3691
3692      // Prevent text selection and touch interface scrolling
3693      //add(this, 'mousedown.move', preventIgnoreTags);
3694
3695      // Tell movestart default handler that we've handled this
3696      add(this, 'movestart.move', flagAsHandled);
3697
3698      // Don't bind to the DOM. For speed.
3699      return true;
3700    }
3701
3702    function teardown(namespaces) {
3703      remove(this, 'dragstart drag', preventDefault);
3704      remove(this, 'mousedown touchstart', preventIgnoreTags);
3705      remove(this, 'movestart', flagAsHandled);
3706
3707      // Don't bind to the DOM. For speed.
3708      return true;
3709    }
3710
3711    function addMethod(handleObj) {
3712      // We're not interested in preventing defaults for handlers that
3713      // come from internal move or moveend bindings
3714      if (handleObj.namespace === "move" || handleObj.namespace === "moveend") {
3715        return;
3716      }
3717
3718      // Stop the node from being dragged
3719      add(this, 'dragstart.' + handleObj.guid + ' drag.' + handleObj.guid, preventDefault, undefined, handleObj.selector);
3720
3721      // Prevent text selection and touch interface scrolling
3722      add(this, 'mousedown.' + handleObj.guid, preventIgnoreTags, undefined, handleObj.selector);
3723    }
3724
3725    function removeMethod(handleObj) {
3726      if (handleObj.namespace === "move" || handleObj.namespace === "moveend") {
3727        return;
3728      }
3729
3730      remove(this, 'dragstart.' + handleObj.guid + ' drag.' + handleObj.guid);
3731      remove(this, 'mousedown.' + handleObj.guid);
3732    }
3733
3734    jQuery.event.special.movestart = {
3735      setup: setup,
3736      teardown: teardown,
3737      add: addMethod,
3738      remove: removeMethod,
3739
3740      _default: function(e) {
3741        var event, data;
3742
3743        // If no move events were bound to any ancestors of this
3744        // target, high tail it out of here.
3745        if (!e._handled()) { return; }
3746
3747        function update(time) {
3748          updateEvent(event, data.touch, data.timeStamp);
3749          trigger(e.target, event);
3750        }
3751
3752        event = {
3753          target: e.target,
3754          startX: e.startX,
3755          startY: e.startY,
3756          pageX: e.pageX,
3757          pageY: e.pageY,
3758          distX: e.distX,
3759          distY: e.distY,
3760          deltaX: e.deltaX,
3761          deltaY: e.deltaY,
3762          velocityX: e.velocityX,
3763          velocityY: e.velocityY,
3764          timeStamp: e.timeStamp,
3765          identifier: e.identifier,
3766          targetTouches: e.targetTouches,
3767          finger: e.finger
3768        };
3769
3770        data = {
3771          event: event,
3772          timer: new Timer(update),
3773          touch: undefined,
3774          timeStamp: undefined
3775        };
3776
3777        if (e.identifier === undefined) {
3778          // We're dealing with a mouse
3779          // Stop clicks from propagating during a move
3780          add(e.target, 'click', returnFalse);
3781          add(document, mouseevents.move, activeMousemove, data);
3782          add(document, mouseevents.end, activeMouseend, data);
3783        }
3784        else {
3785          // We're dealing with a touch. Stop touchmove doing
3786          // anything defaulty.
3787          e._preventTouchmoveDefault();
3788          add(document, touchevents.move + '.' + e.identifier, activeTouchmove, data);
3789          add(document, touchevents.end + '.' + e.identifier, activeTouchend, data);
3790        }
3791      }
3792    };
3793
3794    jQuery.event.special.move = {
3795      setup: function() {
3796        // Bind a noop to movestart. Why? It's the movestart
3797        // setup that decides whether other move events are fired.
3798        add(this, 'movestart.move', jQuery.noop);
3799      },
3800
3801      teardown: function() {
3802        remove(this, 'movestart.move', jQuery.noop);
3803      }
3804    };
3805
3806    jQuery.event.special.moveend = {
3807      setup: function() {
3808        // Bind a noop to movestart. Why? It's the movestart
3809        // setup that decides whether other move events are fired.
3810        add(this, 'movestart.moveend', jQuery.noop);
3811      },
3812
3813      teardown: function() {
3814        remove(this, 'movestart.moveend', jQuery.noop);
3815      }
3816    };
3817
3818    add(document, 'mousedown.move', mousedown);
3819    add(document, 'touchstart.move', touchstart);
3820
3821    // Make jQuery copy touch event properties over to the jQuery event
3822    // object, if they are not already listed. But only do the ones we
3823    // really need. IE7/8 do not have Array#indexOf(), but nor do they
3824    // have touch events, so let's assume we can ignore them.
3825    if (typeof Array.prototype.indexOf === 'function') {
3826      (function(jQuery, undefined){
3827        var props = ["changedTouches", "targetTouches"],
3828            l = props.length;
3829
3830        while (l--) {
3831          if (jQuery.event.props.indexOf(props[l]) === -1) {
3832            jQuery.event.props.push(props[l]);
3833          }
3834        }
3835      })(jQuery);
3836    };
3837  });
3838
3839  $.fn.twentytwenty = function(options) {
3840    var options = $.extend({default_offset_pct: 0.5, orientation: 'horizontal'}, options);
3841    return this.each(function() {
3842
3843      var sliderPct = options.default_offset_pct;
3844      var container = $(this);
3845      var sliderOrientation = options.orientation;
3846      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
3847      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
3848
3849      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
3850      container.append("<div class='twentytwenty-overlay'></div>");
3851      var beforeImg = container.find("img:first");
3852      var afterImg = container.find("img:last");
3853      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
3854      var slider = container.find(".twentytwenty-handle");
3855      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
3856      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
3857      container.addClass("twentytwenty-container");
3858      beforeImg.addClass("twentytwenty-before");
3859      afterImg.addClass("twentytwenty-after");
3860
3861      var overlay = container.find(".twentytwenty-overlay");
3862      overlay.append("<div class='twentytwenty-before-label'></div>");
3863      overlay.append("<div class='twentytwenty-after-label'></div>");
3864
3865      var calcOffset = function(dimensionPct) {
3866        var w = beforeImg.width();
3867        var h = beforeImg.height();
3868        return {
3869          w: w+"px",
3870          h: h+"px",
3871          cw: (dimensionPct*w)+"px",
3872          ch: (dimensionPct*h)+"px"
3873        };
3874      };
3875
3876      var adjustContainer = function(offset) {
3877      	if (sliderOrientation === 'vertical') {
3878      	  beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
3879      	}
3880      	else {
3881          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
3882    	}
3883        container.css("height", offset.h);
3884      };
3885
3886      var adjustSlider = function(pct) {
3887        var offset = calcOffset(pct);
3888        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
3889        adjustContainer(offset);
3890      }
3891
3892      $(window).on("resize.twentytwenty", function(e) {
3893        adjustSlider(sliderPct);
3894      });
3895
3896      var offsetX = 0,
3897      offsetY = 0,
3898      imgWidth = 0,
3899      imgHeight = 0;
3900
3901      slider.on("movestart", function(e) {
3902        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
3903          e.preventDefault();
3904        }
3905        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
3906          e.preventDefault();
3907        }
3908        container.addClass("active");
3909        offsetX = container.offset().left;
3910        offsetY = container.offset().top;
3911        imgWidth = beforeImg.width();
3912        imgHeight = beforeImg.height();
3913      });
3914
3915      slider.on("moveend", function(e) {
3916        container.removeClass("active");
3917      });
3918
3919      slider.on("move", function(e) {
3920        if (container.hasClass("active")) {
3921          sliderPct = (sliderOrientation === 'vertical') ? (e.pageY-offsetY)/imgHeight : (e.pageX-offsetX)/imgWidth;
3922          if (sliderPct < 0) {
3923            sliderPct = 0;
3924          }
3925          if (sliderPct > 1) {
3926            sliderPct = 1;
3927          }
3928          adjustSlider(sliderPct);
3929        }
3930      });
3931
3932      container.find("img").on("mousedown", function(event) {
3933        event.preventDefault();
3934      });
3935
3936      $(window).trigger("resize.twentytwenty");
3937    });
3938  };
3939
3940  $('.twentytwenty-container').twentytwenty();
3941
3942}
3943
3944UNCODE.justifiedGallery = function() {
3945
3946	var breakPointMe = function( val ) {
3947		val = parseInt( val );
3948		if ( isNaN(val) ) {
3949			return false;
3950		}
3951		if ( val >= 1500 ) {
3952			return 1;
3953		} else if ( val < 1500 && val >= 960 ) {
3954			return 2;
3955		} else if ( val < 960 && val >= 570 ) {
3956			return 3;
3957		} else if ( val < 570 ) {
3958			return 4;
3959		}
3960	}
3961
3962	var gutterByBreakpoint = function( bp, gutter ) {
3963		var ret;
3964		switch(gutter) {
3965		    case 'no-gutter':
3966		    	ret = 0;
3967		        break;
3968		    case 'px-gutter':
3969		    	ret = 1;
3970		        break;
3971		    case 'half-gutter':
3972		    	ret = 18;
3973		        break;
3974		    case 'double-gutter':
3975				switch(bp) {
3976				    case 3:
3977				    case 4:
3978				    	ret = 36;
3979				        break;
3980				    default:
3981				    	ret = 72;
3982				        break;
3983				}
3984		        break;
3985		    case 'triple-gutter':
3986				switch(bp) {
3987				    case 3:
3988				    case 4:
3989				    	ret = 36;
3990				        break;
3991				    default:
3992				    	ret = 108;
3993				        break;
3994				}
3995		        break;
3996		    case 'quad-gutter':
3997				switch(bp) {
3998				    case 2:
3999				    	ret = 108;
4000				        break;
4001				    case 3:
4002				    	ret = 72;
4003				        break;
4004				    case 4:
4005				    	ret = 36;
4006				        break;
4007				    default:
4008				    	ret = 144;
4009				        break;
4010				}
4011		        break;
4012		    default:
4013		    	ret = 36;//single-gutter
4014		}
4015		return ret;
4016	}
4017
4018	if ($('.justified-layout').length > 0) {
4019		var justifiedContainersArray = [],
4020			typeGridArray = [],
4021			layoutGridArray = [],
4022			transitionDuration = [],
4023			$filterItems = [],
4024			$filters = $('.justified-system .isotope-filters'),
4025			$itemSelector = '.tmb',
4026			$items,
4027			itemMargin,
4028			correctionFactor = 0,
4029			firstLoad = true,
4030			isOriginLeft = $('body').hasClass('rtl') ? false : true,
4031			prevW = breakPointMe(UNCODE.wwidth);
4032		$('[class*="justified-container"]').each(function() {
4033			var isoData = $(this).data();
4034			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
4035			if (isoData.type == 'metro') typeGridArray.push(true);
4036			else typeGridArray.push(false);
4037			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
4038			else layoutGridArray.push('justified');
4039			justifiedContainersArray.push($(this));
4040		});
4041		var init_justifiedGallery = function() {
4042			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
4043				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
4044					justifiedId = justifiedSystem.attr('id'),
4045					$layoutMode = layoutGridArray[i],
4046					gutter = $(justifiedContainersArray[i]).data('gutter'),
4047					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
4048					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
4049					lastRow = $(justifiedContainersArray[i]).data('last-row'),
4050					margins;
4051
4052				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
4053				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
4054				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
4055
4056				margins = gutterByBreakpoint(prevW, gutter);
4057
4058				$(justifiedContainersArray[i]).justifiedGallery({
4059					rowHeight: rowHeight,
4060					maxRowHeight: maxRowHeight,
4061					margins: margins,
4062					cssAnimation: true,
4063					lastRow: lastRow,
4064					waitThumbnailsLoad: false
4065				}).one('jg.complete', function(){ onLayout($(this), 0); } );
4066			}
4067		},
4068		onLayout = function(justifiedObj, startIndex) {
4069			justifiedObj.css('opacity', 1);
4070			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
4071			$('.tmb', justifiedObj).addClass('justified-object-loaded');
4072
4073			requestTimeout(function() {
4074				window.dispatchEvent(UNCODE.boxEvent);
4075				UNCODE.adaptive();
4076				$(justifiedObj).find('audio,video').each(function() {
4077					$(this).mediaelementplayer({
4078							pauseOtherPlayers: false,
4079					});
4080				});
4081				if ($(justifiedObj).find('.nested-carousel').length) {
4082					UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
4083					requestTimeout(function() {
4084						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
4085						justifiedObj.addClass('justified-gallery-finished')
4086						Waypoint.refreshAll();
4087					}, 200);
4088				} else {
4089					requestTimeout(function() {
4090						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
4091						justifiedObj.addClass('justified-gallery-finished')
4092						Waypoint.refreshAll();
4093					}, 300);
4094				}
4095			}, 100);
4096
4097		},
4098		boxAnimation = function(items, startIndex, sequential, container) {
4099			var $allItems = items.length - startIndex,
4100				showed = 0,
4101				index = 0;
4102			if (container.closest('.owl-item').length == 1) return false;
4103			$.each(items, function(index, val) {
4104				var elInner = $('> .t-inside', val);
4105				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4106					return;
4107				}
4108				if (val[0]) val = val[0];
4109				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
4110					new Waypoint({
4111						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4112						element: val,
4113						handler: function() {
4114							var element = $('> .t-inside', this.element),
4115								parent = $(this.element),
4116								currentIndex = parent.index();
4117							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
4118								delayAttr = parseInt(element.attr('data-delay'));
4119							if (isNaN(delayAttr)) delayAttr = 100;
4120							delay -= showed;
4121							var objTimeout = requestTimeout(function() {
4122								element.removeClass('zoom-reverse').addClass('start_animation');
4123								showed = parent.index();
4124							}, delay * delayAttr);
4125							parent.data('objTimeout', objTimeout);
4126							if (!UNCODE.isUnmodalOpen) {
4127								this.destroy();
4128							}
4129						},
4130						offset: '100%'
4131					})
4132				} else {
4133					elInner.removeClass('animate_when_almost_visible');
4134					$(val).addClass('no-waypoint-animation');
4135					/*if (elInner.hasClass('force-anim')) {
4136						elInner.addClass('start_animation');
4137					} else {
4138						elInner.css('opacity', 1);
4139					}*/
4140				}
4141				index++;
4142			});
4143		};
4144		$filters.on('click', 'a[data-filter]', function(evt) {
4145			var $filter = $(this),
4146				filterContainer = $filter.closest('.isotope-filters'),
4147				filterValue = $filter.attr('data-filter'),
4148				container = $filter.closest('.justified-system').find($('.justified-layout')),
4149				lastRow = container.data('last-row'),
4150				transitionDuration = 0,
4151				delay = 300,
4152				filterItems = [];
4153
4154			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
4155
4156			if (!$filter.hasClass('active')) {
4157				/** Scroll top with filtering */
4158				if (filterContainer.hasClass('filter-scroll')) {
4159                    var calc_scroll = container.closest('.uncol').offset().top,
4160                    getFilterSpanPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span', filterContainer).css("padding-bottom") : 0,
4161                    getFilterPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span a', filterContainer).css("padding-bottom") : 0,
4162                    filterOffset = (getFilterSpanPadding != undefined && getFilterSpanPadding != 0) ? parseInt(getFilterSpanPadding.replace("px", "")) : 0;
4163                    filterOffset += (getFilterPadding != undefined && getFilterPadding != 0) ? parseInt(getFilterPadding.replace("px", "")) : 0;
4164
4165                    calc_scroll -= filterOffset - 1;
4166                    calc_scroll -= UNCODE.get_scroll_offset();
4167
4168					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
4169						delta = bodyTop - calc_scroll,
4170						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
4171					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
4172
4173					if ( !UNCODE.isFullPage ) {
4174						if (scrollSpeed == 0) {
4175							$('html, body').scrollTop(calc_scroll);
4176							UNCODE.scrolling = false;
4177						} else {
4178							$('html, body').animate({
4179								scrollTop: calc_scroll
4180							},{
4181								easing: 'easeInOutQuad',
4182								duration: scrollSpeed,
4183								complete: function(){
4184									UNCODE.scrolling = false;
4185								}
4186							});
4187						}
4188					}
4189				}
4190				if (filterValue !== undefined) {
4191					$.each($('> .tmb > .t-inside', container), function(index, val) {
4192						var parent = $(val).parent(),
4193							objTimeout = parent.data('objTimeout');
4194						if (objTimeout) {
4195							$(val).removeClass('zoom-reverse');
4196							clearRequestTimeout(objTimeout);
4197						}
4198						if (transitionDuration == 0) {
4199							if ($(val).hasClass('animate_when_almost_visible')) {
4200								$(val).addClass('zoom-reverse').removeClass('start_animation');
4201							} else {
4202								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
4203							}
4204						}
4205					});
4206
4207					requestTimeout(function() {
4208						var $block,
4209							selector,
4210							lightboxElements,
4211							$boxes;
4212
4213						if ( filterValue !== '' && filterValue !== '*' ) {
4214							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
4215							selector = '.' + filterValue;
4216							$.each($(selector, container), function(index, block) {
4217								lightboxElements = $('[data-lbox^=ilightbox]', block);
4218								if (lightboxElements.length) {
4219									lightboxElements.removeClass('lb-disabled');
4220									container.data('lbox', $(lightboxElements[0]).data('lbox'));
4221								}
4222								filterItems.push(block);
4223							});
4224							container.justifiedGallery({
4225								filter: selector,
4226								lastRow: 'nojustify'
4227							});
4228						} else {
4229							container.justifiedGallery({
4230								filter: false,
4231								lastRow: lastRow
4232							});
4233							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
4234							filterItems = $('> .tmb', container);
4235						}
4236
4237						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
4238
4239						var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
4240						if (typeof getLightbox === 'object') getLightbox.refresh();
4241
4242						if (transitionDuration == 0) {
4243							requestTimeout(function() {
4244								boxAnimation(filterItems, 0, false, container);
4245							}, 100);
4246						}
4247						requestTimeout(function() {
4248							Waypoint.refreshAll();
4249						}, 2000);
4250
4251					}, delay);
4252				} else {
4253					$.each($('> .tmb > .t-inside', container), function(index, val) {
4254						var parent = $(val).parent(),
4255							objTimeout = parent.data('objTimeout');
4256						if (objTimeout) {
4257							$(val).removeClass('zoom-reverse').removeClass('start_animation')
4258							clearRequestTimeout(objTimeout);
4259						}
4260						if (transitionDuration == 0) {
4261							if ($(val).hasClass('animate_when_almost_visible')) {
4262								$(val).addClass('zoom-reverse').removeClass('start_animation');
4263							} else {
4264								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
4265							}
4266						}
4267					});
4268					container.parent().addClass('justified-loading');
4269				}
4270			}
4271			evt.preventDefault();
4272		});
4273
4274		$filters.each(function(i, buttonGroup) {
4275			var $buttonGroup = $(buttonGroup);
4276			$buttonGroup.on('click', 'a', function() {
4277				$buttonGroup.find('.active').removeClass('active');
4278				$(this).addClass('active');
4279			});
4280		});
4281		window.addEventListener('boxResized', function(e) {
4282			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
4283				prevW = breakPointMe(UNCODE.wwidth);
4284				$.each($('.justified-layout'), function(index, val) {
4285					var gutter = $(this).data('gutter'),
4286						margins = gutterByBreakpoint( prevW, gutter);
4287					$(this).justifiedGallery({
4288						margins: margins
4289					});
4290					$(this).find('.mejs-video,.mejs-audio').each(function() {
4291						$(this).trigger('resize');
4292					});
4293				});
4294			}
4295		}, false);
4296
4297		init_justifiedGallery();
4298	};
4299};
4300
4301UNCODE.preventDoubleTransition = function() {
4302	$('.sticky-element .animate_when_almost_visible').each(function(){
4303		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
4304			$el.addClass('do_not_reanimate');
4305		});
4306	});
4307};
4308UNCODE.checkScrollForTabs = function(){
4309	var goToSection = window.location.hash.replace('#', ''),
4310		$index;
4311
4312	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
4313	goToSection = encodeURIComponent(goToSection);
4314	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs');
4315
4316	$index.attr('data-parent', 'parent-' + goToSection);
4317
4318	if (window.location.hash != undefined && window.location.hash != '') {
4319		requestTimeout(function() {
4320			scrollBody('parent-' + goToSection);
4321		}, 500);
4322	}
4323
4324	$('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
4325		var hash = (e.currentTarget).hash,
4326			index = (e.currentTarget).closest('.uncode-tabs');
4327		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
4328			$('a[href="' + hash + '"][data-tab-history]').click();
4329			scrollBody(index);
4330		}
4331	});
4332
4333	var scrollBody = function(index) {
4334
4335		var getSection = $('a[href="' + index + '"][data-tab-history]'),
4336			scrollTo;
4337
4338		if ( ! getSection.length ) {
4339			getSection = $('div[data-parent="' + index + '"]');
4340		}
4341
4342		if (typeof getSection === 'undefined' || ! getSection.length ) {
4343			return;
4344		}
4345
4346		var body = $("html, body"),
4347		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
4348		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
4349		getOffset = UNCODE.get_scroll_offset();
4350		if ( typeof getSection.offset() === 'undefined' )
4351			return;
4352		scrollTo = getSection.offset().top - 27;
4353		scrollTo -= getOffset;
4354
4355		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
4356		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
4357
4358		if (index != 0) {
4359			UNCODE.scrolling = true;
4360		}
4361
4362		if (scrollSpeed == 0) {
4363			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
4364			UNCODE.scrolling = false;
4365		} else {
4366			body.animate({
4367				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
4368			}, scrollSpeed, 'easeInOutQuad', function() {
4369				requestTimeout(function() {
4370					UNCODE.scrolling = false;
4371					if (getOffset != UNCODE.get_scroll_offset()) {
4372						scrollBody(index);
4373					}
4374				}, 100);
4375			});
4376		}
4377
4378	};
4379};
4380
4381UNCODE.printScreen = function() {
4382	var inlineMediaStyle = null,
4383		setResize;
4384
4385    function changeMediaStyle() {
4386		clearRequestTimeout(setResize);
4387		setResize = requestTimeout(function(){
4388	        var $head = document.getElementsByTagName('head')[0],
4389	        	$newStyle = document.createElement('style'),
4390	        	winW = window.innerWidth,
4391	        	printH = window.innerHeight;
4392
4393	        $newStyle.setAttribute('type', 'text/css');
4394	        $newStyle.setAttribute('media', 'print');
4395	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
4396
4397	        if (inlineMediaStyle != null) {
4398	            $head.replaceChild($newStyle, inlineMediaStyle)
4399	        } else {
4400	            $head.appendChild($newStyle);
4401	        }
4402	        inlineMediaStyle = $newStyle;
4403	    }, 1000);
4404    }
4405
4406    changeMediaStyle();
4407    window.addEventListener('resize', changeMediaStyle);
4408};
4409
4410UNCODE.fullPage = function() {
4411	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
4412		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
4413		return false;
4414	} else {
4415		requestTimeout(function() {
4416			window.scrollTo(0, 0);
4417		}, 10);
4418	}
4419
4420	var $masthead = $('#masthead'),
4421		$logo = $('#logo-container-mobile'),
4422		$logolink = $('[data-minheight]', $logo),
4423		logoMinScale = $logolink.data('minheight'),
4424		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
4425		$mainWrapper = $('.main-wrapper')[0],
4426		$container = $('.main-container .post-content'),
4427		$mobileMenuWrapper = $('.menu-wrapper'),
4428		mobMenuPos,
4429		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
4430		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
4431		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
4432		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
4433		headerWithOpacity = $('.header-scroll-opacity', $header).length,
4434		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
4435		menuHeight = $masthead.hasClass('menu-transparent') || menuHidden ? 0 : UNCODE.menuHeight,
4436		footerAdd = ( $('body').hasClass('hmenu') && $('body').hasClass('uncode-fp-menu-shrink') && !$masthead.hasClass('menu-transparent') ) ? -18 : 0,
4437		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
4438		$scrollTop = $('.scroll-top'),
4439		scrollBar = true,
4440		effect,
4441		animationEndTimeOut,
4442		fp_anim_time = 900,
4443		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
4444		is_scrolling = false,
4445		dataNames = [],
4446		is_first = true,
4447		no_history = $('body').hasClass('uncode-scroll-no-history'),
4448		theres_footer = true;
4449
4450	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
4451		$('> div', $footer).each(function(index, el){
4452			if ( $(el).outerHeight() < 2 )
4453				theres_footer = false;
4454			else
4455				theres_footer = true;
4456		});
4457	}
4458
4459	if ( !$footer.length )
4460		theres_footer = false;
4461
4462	if ( !UNCODE.isFullPageSnap ) {
4463		/*if ( theres_footer )
4464			$footer.css({ marginTop: ( menuHeight + footerAdd + UNCODE.bodyBorder ) * -1 })*/
4465
4466		if ( $('body').hasClass('uncode-fullpage-zoom') )
4467			effect = 'scaleDown';
4468		else if ( $('body').hasClass('uncode-fullpage-parallax') )
4469			effect = 'moveparallax';
4470		else
4471			effect = 'movecurtain';
4472	}
4473
4474	if ( $('body').hasClass('uncode-fullpage-trid') )
4475		fp_anim_time = fp_anim_time*2;
4476
4477	if ( $header.length ) {
4478		if ( headerName !== '' )
4479			$header.attr('data-name', headerName);
4480		if ( headerLabel !== '' )
4481			$header.attr('data-label', headerLabel);
4482		$container.prepend($header);
4483	}
4484	if ( theres_footer ) {
4485		$container.append($footer);
4486		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
4487		$('aside.widget ul', $footer).addClass('no-list');
4488	}
4489
4490	var $all = $rows.add($header);
4491
4492	if ( theres_footer )
4493		$all = $all.add($footer);
4494
4495	$all.each(function(index, row) {
4496		if( index === 0 )
4497			$(row).addClass('uncode-scroll-active');
4498	});
4499
4500	if ( !UNCODE.isMobile && !$('body').hasClass('uncode-scroll-no-dots') )
4501		$("<ul class='onepage-pagination'></ul>").prependTo("body");
4502
4503	$all.each(function(index, val) {
4504		var getName = $(val).data('name'),
4505			label;
4506
4507		if (typeof getName == 'undefined' || getName == 'undefined')
4508			getName = SiteParameters.slide_name + '-' + index;
4509
4510		//if ( dataNames.includes(getName) ) {
4511		if ( dataNames.indexOf(getName) > 0 ) {
4512			getName += '_' + index;
4513			$(val).data('name', getName);
4514		}
4515
4516		dataNames.push(getName);
4517
4518		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
4519
4520		if (typeof $(val).attr('data-label') !== 'undefined')
4521			label = $(val).attr('data-label');
4522		else label = '';
4523
4524		if ( $(val).is($footer) )
4525			return;
4526
4527		if (label != '' ) {
4528			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
4529			$('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>");
4530		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
4531			$('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>");
4532		}
4533
4534	});
4535
4536	var checkVisible = function( el, off ) {
4537		if (typeof jQuery === "function" && el instanceof jQuery) {
4538			el = el[0];
4539		}
4540
4541		off = typeof off=='undefined' ? 50 : off;
4542
4543		var rect = el.getBoundingClientRect();
4544
4545		return (
4546			(
4547				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
4548				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
4549				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
4550			)
4551		);
4552	};
4553
4554	var animationEndAction = function( index, nextIndex ) {
4555		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
4556			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
4557			player, iframe;
4558
4559		if ( !$nextSlide.is($footer) ) {
4560			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
4561		}
4562
4563		if ( !UNCODE.isFullPageSnap ) {
4564			activateKBurns( nextIndex );
4565		}
4566
4567		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
4568			if ($(this).attr('data-provider') == 'vimeo') {
4569				iframe = $(this).find('iframe');
4570				player = $f(iframe[0]);
4571				player.api('pause');
4572			} else if ($(this).attr('data-provider') == 'youtube') {
4573				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
4574			} else {
4575				if ($(this).is('video')) {
4576					$(this)[0].volume = 0;
4577					$(this)[0].pause();
4578				}
4579			}
4580		});
4581
4582		if ( ! UNCODE.isMobile && headerWithOpacity ) {
4583			if ( $nextSlide.is($header) )
4584				$header.removeClass('header-scrolled');
4585		}
4586
4587		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
4588		$otherEl.each(function(){
4589			var $otherThis = $(this),
4590				$bgwrapperOther = $('.background-inner', $otherThis);
4591			if ( !checkVisible($otherThis) )
4592				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
4593
4594		});
4595
4596		if ( !checkVisible($currentSlide) ) {
4597			$currentSlide.removeClass('uncode-scroll-visible');
4598			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
4599			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
4600				currentScroll.scrollTo(0, 0, 0);
4601		}
4602
4603		clearRequestTimeout(animationEndTimeOut);
4604		animationEndTimeOut = requestTimeout(function(){
4605			Waypoint.refreshAll();
4606			$( document.body ).trigger('uncode_waypoints');
4607			var eventFP = new CustomEvent('fp-slide-changed');
4608			window.dispatchEvent(eventFP);
4609			is_scrolling = false;
4610
4611			if ( is_first ) {
4612				$('ul.onepage-pagination a').removeClass('is-selected');
4613				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
4614				is_first = false;
4615			}
4616
4617		}, 500);
4618	};
4619
4620	var postLeaveActions = function( nextIndex ){
4621		if ( menuHidden && ! UNCODE.isMobile )
4622			return false;
4623
4624		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
4625			$cols = $('.uncol', $el),
4626			anchor = $el.data('anchor');
4627
4628		if ( ! UNCODE.isFullPageSnap ) {
4629			$.each($cols, function(index, val){
4630				if ( $(val).hasClass('style-light') ){
4631					$masthead.removeClass('style-dark-override').addClass('style-light-override');
4632					return false;
4633				} else if ( $(val).hasClass('style-dark') ) {
4634					$masthead.removeClass('style-light-override').addClass('style-dark-override');
4635					return false;
4636				}
4637			});
4638		}
4639
4640		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
4641			$('.menu-item' ).removeClass('active');
4642			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
4643		}
4644
4645		if ( !UNCODE.isFullPageSnap ) {
4646			activateBackWash( nextIndex );
4647		}
4648	};
4649
4650	var activateBackWash = function( nextIndex ){
4651		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
4652			$bgwrapper;
4653
4654		if ( $el.length ) {
4655			if ( $el.hasClass('with-zoomout') ) {
4656				$bgwrapper = $('.background-inner:nth-child(1)', $el);
4657			} else if ( $('.with-zoomout', $el).length ) {
4658				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
4659			} else {
4660				return false;
4661			}
4662		} else {
4663			return false;
4664		}
4665
4666		$bgwrapper.addClass('uncode-zoomout');
4667
4668	};
4669
4670	var activateKBurns = function( nextIndex ){
4671		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
4672			$bgwrapper;
4673
4674		if ( $el.length ) {
4675			if ( $el.hasClass('with-kburns') ) {
4676				$bgwrapper = $('.background-inner:nth-child(1)', $el);
4677			} else if ( $('.with-kburns', $el).length ) {
4678				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
4679			} else {
4680				return false;
4681			}
4682		} else {
4683			return false;
4684		}
4685
4686		$bgwrapper.addClass('uncode-kburns');
4687
4688	};
4689
4690	var activateParallax = function( nextIndex, direction ){
4691
4692		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
4693			$cell = $('.fp-tableCell', $el),
4694			animationEnd = 'webkitAnimationEnd animationend',
4695			cellAnim;
4696
4697		switch( direction ) {
4698			case 'up':
4699				cellAnim = 'moveFromTopInner';
4700				break;
4701			default:
4702				cellAnim = 'moveFromBottomInner';
4703		}
4704
4705		$cell.css({
4706			'animation-name': cellAnim,
4707			'animation-duration': fp_anim_time + 'ms',
4708			'animation-delay': '',
4709			'animation-timing-function': fp_easing,
4710			'animation-fill-mode': 'both',
4711		}).off(animationEnd)
4712		.on(animationEnd, function(event) {
4713			if ( event.originalEvent.animationName === cellAnim ) {
4714				$cell
4715					.css({
4716						'animation-name': '',
4717						'animation-duration': '',
4718						'animation-delay': '',
4719						'animation-timing-function': '',
4720						'animation-fill-mode': '',
4721					});
4722			}
4723		});
4724	};
4725
4726	var scrollHashes = function(){
4727		var hash = window.location.hash.replace('#', '').split('/'),
4728			hashInd;
4729		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
4730			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
4731				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
4732				$.fn.fullpage.moveTo(hashInd+1);
4733			}
4734		} else if( hash[0] === '' ) {
4735			$.fn.fullpage.moveTo(1);
4736		}
4737	};
4738
4739	var hideMenu = function( index, nextIndex ){
4740		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
4741			return false;
4742
4743		var hMenu = UNCODE.menuHeight,
4744			transTime = hMenu * 2;
4745
4746		if ( index === 1 && nextIndex > 1 ) {
4747			hMenu = hMenu * -1;
4748		} else if  ( index !== 1 && nextIndex === 1 ) {
4749			hMenu = 0;
4750		} else {
4751			return false;
4752		}
4753
4754		$masthead.css({
4755			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
4756			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
4757			'-webkit-transition': 'transform 0.5s ease-in-out',
4758			'transition': 'transform 0.5s ease-in-out'
4759		});
4760	};
4761
4762	var shrinkMenu = function( index, nextIndex ){
4763		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
4764			return false;
4765
4766		if ( index === 1 && nextIndex > 1 ) {
4767			$logo.addClass('shrinked');
4768			$('div', $logo).each(function(index, val){
4769				$(val).css({
4770					'height': logoMinScale,
4771					'line-height': logoMinScale
4772				});
4773				if ($(val).hasClass('text-logo')) {
4774					$(val).css({
4775						'font-size': logoMinScale + 'px'
4776					});
4777				}
4778			});
4779			requestTimeout(function() {
4780				UNCODE.menuMobileHeight = $masthead.outerHeight();
4781			}, 300);
4782		} else if ( index !== 1 && nextIndex === 1 ) {
4783			$logo.removeClass('shrinked');
4784			$('div', $logo).each(function(index, val){
4785				$(val).css({
4786					'height': logoMaxScale,
4787					'line-height': logoMaxScale
4788				});
4789				if ($(val).hasClass('text-logo')) {
4790					$(val).css({
4791						'font-size': logoMaxScale + 'px'
4792					});
4793				}
4794			});
4795			requestTimeout(function() {
4796				UNCODE.menuMobileHeight = $masthead.outerHeight();
4797			}, 300);
4798		} else {
4799			return false;
4800		}
4801
4802	};
4803
4804	var anchorLink = function(){
4805
4806		$container.add('.menu-item').find('a[href*="#"]').click(function(e) {
4807			var $this = $(e.currentTarget),
4808				hash = e.currentTarget.href.split('#'),
4809				current = window.location.href.split('#'),
4810				ind,
4811				currentMenuOpened = UNCODE.menuOpened,
4812				go = false;
4813
4814			var hash_url = hash[0].replace(/\/?$/, '/'),
4815				current_url = current[0].replace(/\/?$/, '/');
4816
4817			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
4818				hash = '#'+hash[1];
4819				e.preventDefault();
4820				go = true;
4821			}
4822
4823			if ( go ) {
4824
4825				if ( $(hash).length ) {
4826					ind = $(hash).closest('.fp-section').index();
4827				} else {
4828					hash = hash.slice(1);
4829					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
4830				}
4831
4832				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
4833					ind = $this.closest('.fp-section').index();
4834
4835				UNCODE.menuOpened = false;
4836
4837				$.fn.fullpage.moveTo(ind+1);
4838
4839				UNCODE.menuOpened = currentMenuOpened;
4840				if (UNCODE.menuOpened) {
4841					if (UNCODE.wwidth < UNCODE.mediaQuery) window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
4842					else $('.mmb-container-overlay .overlay-close').trigger('click');
4843				}
4844
4845			}
4846
4847		});
4848
4849		$('.header-scrolldown').on('click', function(event) {
4850			event.preventDefault();
4851			var scrollDown = $(this),
4852				ind = scrollDown.closest('.fp-section').index();
4853
4854			$.fn.fullpage.moveTo(ind+2);
4855		});
4856
4857		var anchor = $('.fp-section.active').data('anchor');
4858
4859		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
4860			$('.menu-item').removeClass('active');
4861			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
4862		}
4863
4864	};
4865
4866	var slideLeave = function( index, nextIndex, direction ) {
4867		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
4868			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
4869			animationEnd = 'webkitAnimationEnd animationend',
4870			transitionEnd = 'webkitTransitionEnd transitionend',
4871			animOut = effect != 'scaleDown' ? effect + direction : effect,
4872			animIn,
4873			animInDelay = effect == 'scaleDown' ? 0 : 0,
4874			isFooter = false,
4875			isFooterNext = false,
4876			isHeader = false,
4877			isHeaderNext = false,
4878			containerOff = $container.offset().top,
4879			footerH = $footer.outerHeight(),
4880			timeout,
4881			dataHash = $nextSlide.attr('data-anchor'),
4882			player, iframe,
4883			footerCoeff;
4884		switch( direction ) {
4885			case 'up':
4886				animIn = 'moveFromTop';
4887				break;
4888			default:
4889				animIn = 'moveFromBottom';
4890		}
4891
4892		if ( $('body').hasClass('uncode-fullpage-trid') ) {
4893			animOut = animIn + 'trid';
4894			animIn = animOut + 'In';
4895		} else if ( UNCODE.isFullPageSnap ) {
4896			animIn = animOut = 'none';
4897		}
4898
4899		hideMenu(index, nextIndex);
4900		shrinkMenu(index, nextIndex);
4901
4902		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
4903			if ($(this).attr('data-provider') == 'vimeo') {
4904				iframe = $(this).find('iframe');
4905				player = $f(iframe[0]);
4906				player.api('pause');
4907			} else if ($(this).attr('data-provider') == 'youtube') {
4908				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
4909			} else {
4910				if ($(this).is('video')) {
4911					$(this)[0].volume = 0;
4912					$(this)[0].pause();
4913				}
4914			}
4915		});
4916
4917		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
4918			if ($(this).attr('data-provider') == 'vimeo') {
4919				iframe = $(this).find('iframe');
4920				player = $f(iframe[0]);
4921				player.api('play');
4922			} else if ($(this).attr('data-provider') == 'youtube') {
4923				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
4924			} else {
4925				if ($(this).is('video')) {
4926					$(this)[0].volume = 0;
4927					$(this)[0].play();
4928				}
4929			}
4930		});
4931
4932		if ( $currentSlide.is($footer) )
4933			isFooter = true;
4934
4935		if ( $nextSlide.is($footer) )
4936			isFooterNext = true;
4937
4938		// if ( typeof dataHash && dataHash && !no_history && dataHash != SiteParameters.slide_footer )
4939		// 	window.location.hash = '#' + dataHash;
4940
4941		if ( ! UNCODE.isMobile && headerWithOpacity ) {
4942			if ( $currentSlide.is($header) )
4943				$header.addClass('header-scrolled');
4944		}
4945
4946		footerCoeff = footerH;
4947
4948		if ( UNCODE.isFullPageSnap ) {
4949			postLeaveActions( nextIndex );
4950			activateBackWash( nextIndex );
4951			activateKBurns( nextIndex );
4952			requestTimeout(function(){
4953				animationEndAction( index, nextIndex );
4954			}, fp_anim_time+150);
4955		} else {
4956			if ( isFooterNext ) {
4957
4958				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
4959				$iscrollWrapper.addClass('no-scrolloverflow');
4960
4961				$nextSlide
4962				.add($currentSlide)
4963				.addClass('uncode-scroll-front')
4964				.addClass('uncode-scroll-active')
4965				.addClass('uncode-scroll-visible');
4966				$container.css({
4967					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
4968					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
4969					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
4970					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
4971				}).off(transitionEnd)
4972				.one(transitionEnd, function(){
4973					animationEndAction( index, nextIndex );
4974				});
4975
4976			} else if ( isFooter ) {
4977
4978				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
4979				.add($currentSlide)
4980				.addClass('uncode-scroll-front')
4981				.addClass('uncode-scroll-active')
4982				.addClass('uncode-scroll-visible');
4983				$container.css({
4984					'-webkit-transform': 'translate3d(0, 0, 0)',
4985					'transform': 'translate3d(0, 0, 0)',
4986					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
4987					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
4988				})
4989				.one(transitionEnd, function(){
4990					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
4991						clearRequestTimeout(timeout);
4992						timeout = requestTimeout(function(){
4993							$.fn.fullpage.moveTo(nextIndex);
4994							slideLeave( index-1, nextIndex, 'up' );
4995							$container.off(transitionEnd);
4996						}, 50);
4997					}
4998					animationEndAction( index, nextIndex );
4999				});
5000
5001			} else {
5002
5003				postLeaveActions( nextIndex );
5004
5005				if ( !$('body').hasClass('uncode-fullpage-trid') )
5006					activateParallax( nextIndex, direction );
5007
5008				var $outBg = $('.background-wrapper', $currentSlide);
5009
5010				$nextSlide
5011				.addClass('uncode-scroll-front')
5012				.addClass('uncode-scroll-active')
5013				.addClass('uncode-scroll-visible')
5014				.addClass('uncode-scroll-animating-in')
5015				.css({
5016					'z-index':4,
5017					'animation-name': animIn,
5018					'animation-duration': fp_anim_time + 'ms',
5019					'animation-delay': '',
5020					'animation-timing-function': fp_easing,
5021					'animation-fill-mode': 'both',
5022					'transition': 'initial',
5023				}).off(animationEnd)
5024				.on(animationEnd, function(event) {
5025					if ( event.originalEvent.animationName === animIn ) {
5026						$(this)
5027							.addClass('uncode-scroll-already')
5028							.removeClass('uncode-scroll-front')
5029							.removeClass('uncode-scroll-animating-in')
5030							.css({
5031								'animation-name': '',
5032								'animation-duration': '',
5033								'animation-delay': '',
5034								'animation-timing-function': '',
5035								'animation-fill-mode': '',
5036								'transition': 'initial',
5037							});
5038
5039						$currentSlide
5040							.removeClass('uncode-scroll-active')
5041							.add($outBg)
5042							.css({
5043								'animation-name': '',
5044								'animation-duration': '',
5045								'animation-delay': '',
5046								'animation-timing-function': '',
5047								'animation-fill-mode': '',
5048								'transition': 'initial',
5049							});
5050
5051						animationEndAction( index, nextIndex );
5052
5053					}
5054
5055					if ( nextIndex > 1 )
5056						$('body').addClass('window-scrolled');
5057					else
5058						$('body').removeClass('window-scrolled');
5059				});
5060
5061				$currentSlide
5062					.addClass('uncode-scroll-animating-out')
5063					.removeClass('uncode-scroll-front')
5064					.css({
5065						'z-index':'1',
5066						'animation-name': animOut,
5067						'animation-duration': fp_anim_time + 'ms',
5068						'animation-delay': '',
5069						'animation-timing-function': fp_easing,
5070						'animation-fill-mode': 'both',
5071						'transition': 'initial',
5072						'will-change': 'auto'
5073					}).off(animationEnd)
5074					.on(animationEnd, function(event) {
5075						if ( event.originalEvent.animationName === animOut ) {
5076							$currentSlide.removeClass('uncode-scroll-animating-out');
5077						}
5078					});
5079
5080				if ( $('body').hasClass('uncode-fp-opacity') ) {
5081					$currentSlide.find('> div').css({
5082						'animation-name': 'opacityout',
5083						'animation-duration': fp_anim_time + 'ms',
5084						'animation-delay': '',
5085						'animation-timing-function': fp_easing,
5086						'animation-fill-mode': 'both',
5087						'transition': 'initial',
5088					}).off(animationEnd)
5089					.on(animationEnd, function(event) {
5090						if ( event.originalEvent.animationName === 'opacityout' ) {
5091							$(event.currentTarget).css({
5092								'animation-name': '',
5093								'animation-duration': '',
5094								'animation-delay': '',
5095								'animation-timing-function': '',
5096								'animation-fill-mode': '',
5097								'transition': '',
5098							});
5099						}
5100					});
5101				}
5102			}
5103		}
5104
5105		$('.scroll-top').on('click', function(e){
5106			$.fn.fullpage.moveTo(1);
5107			return false;
5108		});
5109
5110	};
5111
5112	var init_fullPage = function(mode){
5113
5114		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
5115		// 	scrollBar = false;
5116		// }
5117
5118		var checkFPeffects;
5119
5120		$container.fullpage({
5121			sectionSelector: '.uncode-scroll-lock',
5122			scrollOverflow: true,
5123			scrollOverflowOptions: {
5124				click: false,
5125				preventDefaultException: { tagName:/.*/ }
5126			},
5127			navigation: false,
5128			scrollBar: scrollBar,
5129			scrollingSpeed: fp_anim_time,
5130			verticalCentered: true,
5131			anchors: no_history ? false : dataNames,
5132			recordHistory: !no_history,
5133			afterRender: function(){
5134				$('body').removeClass('fp-waiting');
5135				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
5136					var $invisible = $(this).addClass('hidden-scroll');//,
5137				});
5138				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
5139					var $visible = $(this).addClass('uncode-scroll-visible'),
5140						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
5141					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
5142				});
5143
5144				$('ul.onepage-pagination a').on('click', function(e){
5145					e.preventDefault();
5146					var $a = $(this),
5147						toIndex = $a.data('index');
5148
5149					$.fn.fullpage.moveTo(toIndex+1);
5150				});
5151
5152				requestTimeout(function(){
5153					scrollHashes();
5154				}, 1000);
5155
5156				$(window).on('hashchange', function(e){
5157					requestTimeout(function(){
5158						scrollHashes();
5159					}, 500);
5160				});
5161
5162				anchorLink();
5163
5164				if ( $('body').hasClass('uncode-fp-opacity') ) {
5165					$all.each(function(index, row) {
5166						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
5167							classBg;
5168
5169						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
5170							classBg = testmatch[0];
5171							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
5172						}
5173					});
5174				}
5175
5176				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
5177					$(window).on('menuOpen gdprOpen', function(){
5178						$.fn.fullpage.setAutoScrolling(false);
5179					}).on('menuClose gdprClose', function(){
5180						$.fn.fullpage.setAutoScrolling(true);
5181					});
5182				}
5183
5184				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
5185					requestTimeout(function(){
5186						$.fn.fullpage.setAutoScrolling(false);
5187					}, 1000);
5188				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
5189					$.fn.fullpage.setAutoScrolling(true);
5190				});
5191
5192				if ( !UNCODE.isFullPageSnap ) {
5193					clearRequestTimeout(checkFPeffects);
5194					checkFPeffects = requestTimeout(function(){
5195						activateBackWash( 1 );
5196						activateKBurns( 1 );
5197					}, 100);
5198				}
5199
5200			},
5201			onLeave: function( index, nextIndex, direction ){
5202
5203				if ( UNCODE.menuOpened || is_scrolling )
5204					return false;
5205
5206				is_scrolling = true;
5207
5208				var event = new CustomEvent('fp-slide-leave');
5209				window.dispatchEvent(event);
5210
5211				slideLeave( index, nextIndex, direction );
5212
5213				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
5214					if ( direction === 'up' ) {
5215						$.fn.fullpage.moveTo(nextIndex-1);
5216					} else {
5217						$.fn.fullpage.moveTo(nextIndex+1);
5218					}
5219					return false;
5220				}
5221
5222				$('ul.onepage-pagination a').removeClass('is-selected');
5223				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
5224
5225			}
5226		});
5227	};
5228
5229	init_fullPage();
5230	$(window).on('load', function(){
5231		requestTimeout(function(){
5232			$.fn.fullpage.reBuild();
5233		}, 3000);
5234	});
5235
5236	var addScrollingClass,
5237		removeScrollingClass;
5238
5239	window.addEventListener("fp-slide-scroll", function(){
5240		addScrollingClass = requestTimeout( function(){
5241			$('body').addClass('fp-slide-scrolling');
5242		}, 10 );
5243
5244		clearRequestTimeout(removeScrollingClass);
5245		removeScrollingClass = requestTimeout( function(){
5246			$('body').removeClass('fp-slide-scrolling');
5247		}, 150 );
5248
5249		Waypoint.refreshAll();
5250	}, false);
5251
5252	var setFPheight = function(){
5253		var $body = document.body,
5254			$footer = document.getElementById('colophon'),
5255			$maincontainer = document.querySelector('.main-wrapper'),
5256			rect = $maincontainer.getBoundingClientRect();
5257		$body.style.height = UNCODE.wheight + 'px';
5258		if ( theres_footer )
5259			$footer.style.top = rect.height + 'px';
5260	};
5261
5262	setFPheight();
5263
5264	window.addEventListener('resize', setFPheight, false);
5265	window.addEventListener('orientationchange', setFPheight, false);
5266
5267};
5268
5269UNCODE.particles = function() {
5270	$(".vc-particles-background").each(function() {
5271		var $particle = $(this);
5272		var $parent = $particle.closest('[data-parent]');
5273
5274		$parent.prepend($particle);
5275		$(window).trigger('resize');
5276	})
5277};
5278
5279UNCODE.filters = function() {
5280	var $isotopes = $('.isotope-system');
5281
5282	$isotopes.each(function(index, val){
5283		var $isotope = $(this),
5284			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $isotope),
5285			$widgets = $('.widgetized-cb-wrapper', $isotope),
5286			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $isotope),
5287			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $isotope),
5288			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $isotope),
5289			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $isotope);
5290
5291		if ($isotope.hasClass('isotope-processed')) {
5292			return;
5293		}
5294
5295		$cats_trigger.on('click', function(e) {
5296			if ( ! $('html').hasClass('screen-sm') ) {
5297				// $widgets.add($sorting_dd).slideUp(400);
5298				e.preventDefault();
5299				$widgets.slideUp(200, 'easeInOutCirc');
5300			}
5301		});
5302
5303		$('.filters-toggle-trigger', $isotope).on('click', function(e) {
5304			e.preventDefault();
5305			var $filters = $('.isotope-filters .menu-horizontal', $isotope);
5306			$filters.slideToggle(200);
5307			$widgets.add($cats_filters).slideUp(200);
5308		});
5309
5310		$widget_trgr.on('click', function(e) {
5311			e.preventDefault();
5312			$widgets.slideToggle(200);
5313			if (!$('html').hasClass('screen-sm')) {
5314				$cats_filters.slideUp(200);
5315			}
5316			window.dispatchEvent(new CustomEvent('boxResized'));
5317		});
5318
5319		$sorting_trgr.on('click', function(e) {
5320			e.preventDefault();
5321			if (!$('html').hasClass('screen-sm')) {
5322				$widgets.add($cats_filters).slideUp(200);
5323			}
5324		});
5325
5326		$isotope.addClass('isotope-processed');
5327	})
5328
5329};
5330
5331UNCODE.widgets = function() {
5332	var widget_titles = $('.widget-mobile-collapse').find('.widget-title');
5333	var widgets = widget_titles.closest('.widget');
5334
5335	widgets.each(function() {
5336		var _this = $(this);
5337		var content = _this.children().not('.widget-title');
5338
5339		if (_this.hasClass('widget-mobile-done')) {
5340			return;
5341		}
5342
5343		content.wrapAll( '<div class="widget-collapse-content"></div> ');
5344		_this.removeClass('collapse-init');
5345		_this.addClass('widget-mobile-done');
5346	});
5347
5348	var widgets_without_title = $('.collapse-init');
5349
5350	widgets_without_title.removeClass('collapse-init');
5351
5352	widget_titles.on('click', function() {
5353		var _this = $(this);
5354		var content = _this.closest('.widget').find('.widget-collapse-content');
5355
5356		// Get content of :after element (+ icon) to check the visibility
5357		var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
5358
5359		if (icon_content === 'none') {
5360			return false;
5361		}
5362
5363		_this.toggleClass('open');
5364		content.slideToggle(400, 'easeInOutCirc');
5365
5366		return false;
5367	});
5368};
5369
5370UNCODE.unmodal = function() {
5371	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
5372		$('.unmodal-overlay').fadeIn();
5373		$('.unmodal-overlay').addClass('loading');
5374		$('body').addClass('uncode-unmodal-overlay-visible');
5375		$(window).trigger('unmodal-open');
5376	});
5377
5378	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
5379		$('.unmodal-overlay').fadeOut();
5380		$('.unmodal').fadeOut();
5381		$('body').removeClass('uncode-unmodal-overlay-visible');
5382		$('body').removeClass('uncode-unmodal-open');
5383		$('html').removeClass('uncode-unmodal-body-disable-scroll');
5384		$(document).trigger('unmodal-close');
5385		UNCODE.isUnmodalOpen = false;
5386	});
5387
5388	$(document).on('uncode-unmodal-show-content', function() {
5389		$('.unmodal-overlay').removeClass('loading');
5390		$('.unmodal').show();
5391		$('.unmodal').addClass('show-unmodal-with-animation');
5392		$('.unmodal-content')[0].scrollTop = 0;
5393		$('body').addClass('uncode-unmodal-open');
5394		UNCODE.isUnmodalOpen = true;
5395
5396		if ($('body').hasClass('qw-body-scroll-disabled')) {
5397			$('html').addClass('uncode-unmodal-body-disable-scroll');
5398		}
5399
5400		if ($('.unmodal').hasClass('auto-height')) {
5401			set_modal_height();
5402		}
5403	});
5404
5405	var set_modal_height = function() {
5406		var modal = $('.unmodal');
5407		var window_height = $(window).outerHeight();
5408		var modal_height = modal.outerHeight();
5409
5410		modal.css('height', 'auto');
5411
5412		if (modal_height > window_height) {
5413			modal.outerHeight(window_height);
5414		}
5415	}
5416
5417	if ($('.unmodal').hasClass('auto-height')) {
5418		var setCTA;
5419
5420		$(window).on('resize', function() {
5421			clearRequestTimeout(setCTA);
5422			setCTA = requestTimeout(function() {
5423				set_modal_height();
5424			}, 100);
5425		});
5426	}
5427};
5428
5429	UNCODE.init = function() {
5430		var wfl_check = false, wfl_request, waypoint_request;
5431		UNCODE.preventDoubleTransition();
5432		UNCODE.utils();
5433		UNCODE.menuSystem();
5434		UNCODE.okvideo();
5435		UNCODE.tapHover();
5436		UNCODE.isotopeLayout();
5437		UNCODE.justifiedGallery();
5438		UNCODE.lightbox();
5439		UNCODE.carousel($('body'));
5440		UNCODE.lettering();
5441		UNCODE.animations();
5442		UNCODE.stickyElements();
5443		UNCODE.twentytwenty();
5444		UNCODE.disableHoverScroll();
5445		UNCODE.printScreen();
5446		UNCODE.particles();
5447		UNCODE.filters();
5448		UNCODE.widgets();
5449		UNCODE.unmodal();
5450		if ( !UNCODE.isFullPage ) {
5451			UNCODE.checkScrollForTabs();
5452		}
5453		UNCODE.onePage(UNCODE.isMobile);
5454		$(document).ready(function(){
5455			UNCODE.fullPage();
5456		});
5457		$(window).on('load',function(){
5458			clearRequestTimeout(waypoint_request);
5459			waypoint_request = requestTimeout( function(){
5460				Waypoint.refreshAll();
5461			}, 1000);
5462		});
5463	}
5464
5465	if ( ! SiteParameters.is_frontend_editor ) {
5466		UNCODE.init();
5467	}
5468
5469
5470})(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.