PageSourceSearch

https://www.trinityliquidwaste.com/wp-content/themes/uncode/library/js/app.js?ver=1572777937

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

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.