PageSourceSearch

https://quartapareteroma.it/wp-content/themes/quartapareteroma/library/js/app.js?ver=1498131139

js quartapareteroma.it collected 2026-09-25 00:49:50 UTC 172,798 bytes, 5,253 lines download raw bytes

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

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.