PageSourceSearch

https://www.alsuoposto.it/wp-content/themes/uncode/library/js/app.js?ver=2124107289

js alsuoposto.it collected 2026-09-24 15:04:28 UTC 115,080 bytes, 3,521 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
12UNCODE.utils = function() {
13	$('.btn-tooltip').tooltip();
14	$('a').hover(function() {
15		$(this).attr('data-title', $(this).attr('title'));
16		$(this).removeAttr('title');
17	}, function() {
18		$(this).attr('title', $(this).attr('data-title'));
19	});
20	$('.counter').counterUp({
21		delay: 10,
22		time: 1500
23	});
24	$('[data-countdown]').each(function() {
25		var $this = $(this),
26			finalDate = $(this).data('countdown');
27		$this.countdown(finalDate, function(event) {
28			$this.html(event.strftime('%D <small>' + SiteParameters.days + '</small> %H <small>' + SiteParameters.hours + '</small> %M <small>' + SiteParameters.minutes + '</small> %S <small>' + SiteParameters.seconds + '</small>'));
29		});
30	});
31	var share_button_top = new Share(".share-button", {
32		ui: {
33			flyout: "top center",
34			button_font: false,
35			button_text: '',
36			icon_font: false
37		},
38	});
39	$(document).on('click', '.uncode-dot-irecommendthis', function() {
40		var link = $(this),
41			linkCounter = link.find('span.likes-counter');
42		if (link.hasClass('active')) return false;
43		var id = $(this).attr('id'),
44			suffix = link.find('.dot-irecommendthis-suffix').text();
45		$.post(dot_irecommendthis.ajaxurl, {
46			action: 'uncode-dot-irecommendthis',
47			recommend_id: id,
48			suffix: suffix
49		}, function(data) {
50			var counter = $(data).text();
51			linkCounter.html(counter);
52			link.addClass('active').attr('title', 'You already recommended this');
53		});
54		return false;
55	});
56
57	this.get_scroll_offset = function() {
58
59		var scroll_offset = 0;
60
61		if ($('.menu-hide').length || $('.menu-hide-vertical').length) {
62			if (UNCODE.bodyTop > UNCODE.wheight / 2) {
63				UNCODE.hideMenu(100);
64			}
65		}
66
67		UNCODE.scrolling = true;
68
69		if (($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length)) {
70			scroll_offset += UNCODE.menuMobileHeight;
71		}
72
73		scroll_offset += UNCODE.bodyBorder;
74
75		return scroll_offset;
76	}
77
78	$('a[href*="#"]').click(function(e) {
79
80		var hash = (e.currentTarget).hash,
81		is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false,
82		anchor = '';
83		if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return;
84		if ($(e.currentTarget).hasClass('woocommerce-review-link')) {
85			e.preventDefault();
86			if (!$('#tab-reviews').is(':visible')) {
87				$('a[href="#tab-reviews"]').trigger('click');
88			}
89			var calc_scroll = $('.wootabs .tab-content').offset().top;
90			calc_scroll -= UNCODE.get_scroll_offset();
91
92			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
93				delta = bodyTop - calc_scroll,
94				scrollSpeed = Math.abs(delta) / 2;
95			if (scrollSpeed < 1000) scrollSpeed = 1000;
96
97			setTimeout(function(){
98				$('html, body').animate({
99						scrollTop: calc_scroll
100					}, scrollSpeed, 'easeInOutCubic', function() {
101						UNCODE.scrolling = false;
102					}
103				);
104			}, 200);
105			return;
106		}
107		if (hash != undefined) {
108			if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
109	      var anchor = $(hash);
110	      anchor = anchor.length ? anchor : this.hash.slice(1);
111	    }
112		}
113
114		if (is_scrolltop || anchor != '') {
115			if (is_scrolltop) {
116				e.preventDefault();
117				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
118				scrollSpeed = Math.abs(bodyTop) / 2;
119				if (scrollSpeed < 1000) scrollSpeed = 1000;
120				$('html, body').animate({
121					scrollTop: 0
122				}, scrollSpeed, 'easeInOutCubic', function() {
123					UNCODE.scrolling = false;
124				});
125			} else {
126				var scrollSection = (typeof anchor === 'string') ? $('[data-name=' + anchor + ']') : anchor;
127				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) {
128					var get_href = $(val).attr('href');
129					if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active');
130					else $(val).parent().removeClass('active');
131				});
132				if (scrollSection.length) {
133					e.preventDefault();
134
135					if (UNCODE.menuOpened) {
136						if (UNCODE.wwidth < UNCODE.mediaQuery) window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
137						else $('.overlay-close').trigger('click');
138					}
139
140					var calc_scroll = scrollSection.offset().top;
141					calc_scroll -= UNCODE.get_scroll_offset();
142
143					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
144						delta = bodyTop - calc_scroll,
145						scrollSpeed = Math.abs(delta) / 2;
146					if (scrollSpeed < 1000) scrollSpeed = 1000;
147
148					$('html, body').animate({
149						scrollTop: calc_scroll
150					}, scrollSpeed, 'easeInOutCubic', function() {
151						UNCODE.scrolling = false;
152					});
153				}
154			}
155		}
156	});
157	$('.header-scrolldown').on('click', function(event) {
158		event.preventDefault();
159		var pageHeader = $(event.target).closest('#page-header'),
160			pageHeaderTop = pageHeader.offset().top,
161			pageHeaderHeight = pageHeader.outerHeight(),
162			scrollSpeed = Math.abs(pageHeaderTop + pageHeaderHeight) / 2;
163		if (scrollSpeed < 1000) scrollSpeed = 1000;
164		var calc_scroll = pageHeaderTop + pageHeaderHeight;
165		calc_scroll -= UNCODE.get_scroll_offset();
166
167		$('html, body').animate({
168				scrollTop: calc_scroll
169			}, scrollSpeed, 'easeInOutCubic', function() {
170			UNCODE.scrolling = false;
171		});
172
173	});
174	// TAB DATA-API
175	// ============
176	$(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function(e) {
177		e.preventDefault()
178		$(this).tab('show');
179		setTimeout(function() {
180			window.dispatchEvent(UNCODE.boxEvent);
181		}, 300);
182	});
183	// COLLAPSE DATA-API
184	// =================
185	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
186		var $this = $(this),
187			href
188		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
189		var $target = $(target)
190		var data = $target.data('bs.collapse')
191		var option = data ? 'toggle' : $this.data()
192		var parent = $this.attr('data-parent')
193		var $parent = parent && $(parent)
194		var $title = $(this).parent()
195		if ($parent) {
196			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
197			if ($title.hasClass('active')) {
198				$title.removeClass('active');
199			} else {
200				$parent.find('.panel-title').removeClass('active')
201				$title[!$target.hasClass('in') ? 'addClass' : 'removeClass']('active')
202			}
203		}
204		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
205	});
206	// FitText
207	// =================
208	window.uncode_textfill = function(el, loaded) {
209		if (el == undefined) el = $('body');
210		$.each($('.bigtext', el), function(index, val) {
211			$(val).bigtext({
212				minfontsize: 24
213			});
214			if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
215				opacity: 1
216			});
217			setTimeout(function() {
218				if ($(val).find('.animate_when_almost_visible').length != 0) {
219					$(val).css({opacity: 1});
220				}
221			}, 400);
222		});
223	}
224	window.uncode_textfill();
225
226	// Colomun hover effect
227	// =================
228	$(document).on('mouseenter', '.col-link', function(e) {
229		var uncol = $(e.target).prev('.uncol'),
230		el = uncol.find('.column-background');
231		if (el) {
232			$('.btn-container .btn', uncol).toggleClass('active');
233			var elOverlay = $(el[0]).find('.block-bg-overlay');
234			if (elOverlay.length) {
235				var getOpacity = $(elOverlay).css('opacity');
236				if (getOpacity != 1) {
237					getOpacity = Math.round(getOpacity * 100) / 100;
238					var newOpacity = getOpacity + .1;
239					$(elOverlay).data('data-opacity', getOpacity);
240					$(elOverlay).css('opacity', newOpacity);
241				}
242			}
243		}
244	}).on('mouseleave', '.col-link', function(e) {
245		var uncol = $(e.target).prev('.uncol'),
246		el = uncol.find('.column-background');
247		$('.btn-container .btn', uncol).toggleClass('active');
248		if (el) {
249			var elOverlay = $(el[0]).find('.block-bg-overlay');
250			if (elOverlay.length) {
251				var getOpacity = $(elOverlay).data('data-opacity');
252				$(elOverlay).css('opacity', getOpacity);
253			}
254		}
255	});
256
257	// REVSLIDER API
258	// ============
259	$(window).on("load", function() {
260		$('.rev_slider_wrapper').each(function(){
261			var $this = jQuery(this),
262   		id_array = $this.attr("id").split("_"),
263   		id = id_array[2];
264   		if (id != undefined && id != '') {
265				$.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);}})');
266				$.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);}})');
267   		}
268		});
269	});
270	// Admin bar
271	// ============
272	$(window).resize(function() {
273		if ($('html').hasClass('admin-mode')) {
274			var getAdminBar = $('#wpadminbar');
275			if (getAdminBar.length) {
276				if (getAdminBar.css('position') !== 'hidden') {
277					var getAdminBarHeight = getAdminBar.height();
278					if (getAdminBar.css('position') === 'fixed') {
279						$('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'});
280						$('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'});
281					} else {
282						$('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'});
283						$('.body-borders .top-border').css({'margin-top':'0px'});
284					}
285				}
286			}
287		}
288	});
289	// Facebook
290	// ===========
291 	this.fb_timeout = undefined;
292	$(window).resize(function() {
293		$('.facebook-object').each(function(index, el) {
294			var el = $(el),
295			parentWidth = el.closest('.tmb').width();
296			el.width(parentWidth);
297		});
298		if (this.fb_timeout == undefined) {
299			if ($('.facebook-object').length) {
300				window.clearTimeout(this.fb_timeout);
301				this.fb_timeout = window.setTimeout(function(msg) {
302	      	window.dispatchEvent(UNCODE.boxEvent);
303	    	}, 1000);
304			}
305		}
306	});
307}
308
309UNCODE.menuSystem = function() {
310
311	function menuMobile() {
312		var $mobileToggleButton = $('.mobile-menu-button'),
313			$box,
314			$el,
315			elHeight,
316			check,
317			animating = false,
318			stickyMobile = false;
319		UNCODE.menuOpened = false;
320			//browserToolbar = 56;
321		$mobileToggleButton.on('click', function(event) {
322			var btn = this;
323			if ($(btn).hasClass('overlay-close')) return;
324			event.preventDefault();
325			if (UNCODE.wwidth < UNCODE.mediaQuery) {
326				$box = $(this).closest('.box-container').find('.main-menu-container'),
327					$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner');
328				if (UNCODE.isMobile && $('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only, .main-header .menu-sticky-vertical, .main-header .menu-hide-only-vertical').length) {
329					stickyMobile = true;
330					elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
331				} else {
332					elHeight = 0;
333					$.each($el, function(index, val) {
334						elHeight += $(val).outerHeight();
335					});
336				}
337				var open = function() {
338					if (!animating) {
339						animating = true;
340						UNCODE.menuOpened = true;
341						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky').length)) {
342							$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
343							$('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed'});
344						}
345						if ($('body.hmenu-center').length && ($('.menu-hide, .menu-sticky').length)) {
346							$('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
347						}
348						btn.classList.add('close');
349						$box.addClass('open-items');
350						$box.animate({
351							height: elHeight
352						}, 600, "easeInOutCirc", function() {
353							animating = false;
354							if (!stickyMobile) $box.css('height', 'auto');
355						});
356					}
357				};
358
359				var close = function() {
360					if (!animating) {
361						animating = true;
362						UNCODE.menuOpened = false;
363						btn.classList.remove('close');
364						btn.classList.add('closing');
365						$box.addClass('close');
366						setTimeout(function() {
367							$box.removeClass('close');
368							$box.removeClass('open-items');
369							btn.classList.remove('closing');
370						}, 500);
371						$box.animate({
372							height: 0
373						}, {
374							duration: 600,
375							easing: "easeInOutCirc",
376							complete: function(elements) {
377								$(elements).css('height', '');
378								animating = false;
379								if ($('body[class*="vmenu-"]').length) $('.main-header > .vmenu-container').css('position','relative');
380							}
381						});
382					}
383				};
384				check = (!UNCODE.menuOpened) ? open() : close();
385			}
386		});
387		window.addEventListener('menuMobileTrigged', function(e) {
388			$mobileToggleButton.trigger('click');
389		});
390		window.addEventListener("resize", function() {
391			if ($(window).width() < UNCODE.mediaQuery) {
392				if (UNCODE.isMobile) {
393					var $box = $('.box-container .main-menu-container'),
394						$el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner');
395					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto') {
396						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
397							elHeight = 0;
398							$.each($el, function(index, val) {
399								elHeight += $(val).outerHeight();
400							});
401							elHeight = window.innerHeight - $('.menu-wrapper.menu-sticky .menu-wrapper.menu-sticky .menu-container .row-menu-inner, .menu-wrapper.menu-hide-only .menu-wrapper.menu-sticky .menu-container .row-menu-inner').height() - (UNCODE.bodyBorder * 2) + 1;
402							$($box).css('height', elHeight + 'px');
403						}
404					}
405				}
406			} else {
407				$('.menu-hide-vertical').removeAttr('style');
408				$('.menu-container-mobile').removeAttr('style');
409				$('.vmenu-container.menu-container').removeAttr('style');
410			}
411		});
412	};
413
414	function menuOffCanvas() {
415		$('.menu-primary .menu-button-offcanvas').click(function(event) {
416			if ($(window).width() > UNCODE.mediaQuery) {
417				if ($(event.currentTarget).hasClass('close')) {
418					$(event.currentTarget).removeClass('close');
419					$(event.currentTarget).addClass('closing');
420					setTimeout(function() {
421						$(event.currentTarget).removeClass('closing');
422					}, 500);
423				} else $(event.currentTarget).addClass('close');
424			}
425			$('body').toggleClass('off-opened');
426		});
427	};
428	function menuSmart() {
429		if ($('[class*="menu-smart"]').length > 0) {
430			$('[class*="menu-smart"]').smartmenus({
431				subIndicators: false,
432				subIndicatorsPos: 'append',
433				subMenusMinWidth: '13em',
434				subIndicatorsText: '',
435				showTimeout: 50,
436				hideTimeout: 50,
437				showFunction: function($ul, complete) {
438					$ul.fadeIn(0, 'linear', complete);
439				},
440				hideFunction: function($ul, complete) {
441					var fixIE = $('html.ie').length;
442					if (fixIE) {
443						var $rowParent = $($ul).closest('.main-menu-container');
444						$rowParent.height('auto');
445					}
446					$ul.fadeOut(0, 'linear', complete);
447				},
448				collapsibleShowFunction: function($ul, complete) {
449					$ul.slideDown(400, 'easeInOutCirc', function() {
450				12});
451				},
452				collapsibleHideFunction: function($ul, complete) {
453					$ul.slideUp(200, 'easeInOutCirc', complete);
454				},
455				hideOnClick: true
456			});
457		}
458	};
459	function menuOverlay() {
460		if ($('.overlay-sequential, .menu-mobile-animated').length > 0) {
461			$('.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) {
462				var transDelay = (index / 20) + 0.1;
463				$(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');
464			});
465		}
466	};
467	//menuMobileButton();
468	menuMobile();
469	menuOffCanvas();
470	menuSmart();
471	menuOverlay();
472};
473
474UNCODE.okvideo = function() {
475	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
476	$.okvideo = function(options) {
477		// if the option var was just a string, turn it into an object
478		if (typeof options !== 'object') options = {
479			'video': options
480		};
481		var base = this;
482		// kick things off
483		base.init = function() {
484			base.options = $.extend({}, $.okvideo.options, options);
485			// support older versions of okvideo
486			if (base.options.video === null) base.options.video = base.options.source;
487			base.setOptions();
488			var target = base.options.target || $('body');
489			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
490			var zIndex = base.options.controls === 3 ? -999 : "auto";
491			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
492				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>';
493				if (OKEvents.utils.isMobile()) {
494					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>');
495				} else {
496					if (base.options.controls === 3) {
497						target.append(mask)
498					}
499					if (base.options.adproof === 1) {
500						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>');
501					} else {
502						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>');
503					}
504				}
505				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
506				if (base.options.playlist.list === null) {
507					if (base.options.video.provider === 'youtube') {
508						base.loadYouTubeAPI();
509					} else if (base.options.video.provider === 'vimeo') {
510						base.options.volume /= 100;
511						base.loadVimeoAPI();
512					}
513				} else {
514					base.loadYouTubeAPI();
515				}
516			}
517		};
518		// clean the options
519		base.setOptions = function() {
520			// exchange 'true' for '1' and 'false' for 3
521			for (var key in this.options) {
522				if (this.options[key] === true) this.options[key] = 1;
523				if (this.options[key] === false) this.options[key] = 3;
524			}
525			if (base.options.playlist.list === null) {
526				base.options.video = base.determineProvider();
527			}
528			// pass options to the window
529			$(window).data('okoptions-' + base.options.id, base.options);
530		};
531		// insert js into the head and exectue a callback function
532		base.insertJS = function(src, callback){
533      var tag = document.createElement('script');
534      if (callback){
535        if (tag.readyState){  //IE
536          tag.onreadystatechange = function(){
537            if (tag.readyState === "loaded" ||
538                tag.readyState === "complete"){
539              tag.onreadystatechange = null;
540              callback();
541            }
542          };
543        } else {
544          tag.onload = function() {
545            callback();
546          };
547        }
548      }
549      tag.src = src;
550      var firstScriptTag = document.getElementsByTagName('script')[0];
551      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
552    };
553		// load the youtube api
554		base.loadYouTubeAPI = function(callback) {
555			base.insertJS('https://www.youtube.com/player_api');
556		};
557		base.loadYouTubePlaylist = function() {
558			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
559		};
560		// load the vimeo api by replacing the div with an iframe and loading js
561		base.loadVimeoAPI = function() {
562			var source = '//player.vimeo.com/video/' + base.options.video.id + '?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,
563			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" />');
564			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
565			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
566			base.insertJS('//origin-assets.vimeo.com/js/froogaloop2.min.js', function() {
567				vimeoPlayerReady(base.options.id);
568			});
569		};
570		// is it from youtube or vimeo?
571		base.determineProvider = function() {
572			var a = document.createElement('a');
573			a.href = base.options.video;
574			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
575				var videoid = a.href.split('/')[3].toString();
576				var query = videoid.substring(videoid.indexOf('?') + 1);
577				if (query != '') {
578					var vars = query.split('&');
579					for (var i = 0; i < vars.length; i++) {
580						var pair = vars[i].split('=');
581						if (pair[0] == 'v') {
582							videoid = pair[1];
583						}
584					}
585				}
586				return {
587					"provider": "youtube",
588					"id": videoid
589				};
590			} else if (/vimeo.com/.test(base.options.video)) {
591				return {
592					"provider": "vimeo",
593					"id": (a.href.split('/')[3].toString()).split('#')[0],
594				};
595			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
596				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
597				if (id.length == 11) {
598					return {
599						"provider": "youtube",
600						"id": id.toString()
601					};
602				} else {
603					for (var i = 0; i < base.options.video.length; i++) {
604						if (typeof parseInt(base.options.video[i]) !== "number") {
605							throw 'not vimeo but thought it was for a sec';
606						}
607					}
608					return {
609						"provider": "vimeo",
610						"id": base.options.video
611					};
612				}
613			} else {
614				throw "OKVideo: Invalid video source";
615			}
616		};
617		base.init();
618	};
619	$.okvideo.options = {
620		id: null,
621		source: null, // Deprecate dis l8r
622		video: null,
623		playlist: { // eat ur heart out @brokyo
624			list: null,
625			index: 0,
626			startSeconds: 0,
627			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
628		},
629		disableKeyControl: 1,
630		captions: 0,
631		loop: 1,
632		hd: 1,
633		volume: 0,
634		adproof: false,
635		unstarted: null,
636		onFinished: null,
637		onReady: null,
638		onPlay: null,
639		onPause: null,
640		buffering: null,
641		controls: false,
642		autoplay: true,
643		annotations: true,
644		cued: null
645	};
646	$.fn.okvideo = function(options) {
647		options.target = this;
648		return this.each(function() {
649			(new $.okvideo(options));
650		});
651	};
652
653	$(".no-touch .uncode-video-container.video").each(function(index, el) {
654		var $this = $(this),
655			url = $this.attr('data-video'),
656			id = $this.attr('data-id'),
657			cloned = $this.closest('.owl-item');
658		if (!cloned.hasClass('cloned') || cloned.length == 0) {
659			$this.okvideo({
660				id: id,
661				source: url.split('#')[0],
662				time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
663				autoplay: 1,
664				controls: 0,
665				volume: 0,
666				adproof: 0,
667				caller: $this,
668				hd: 1,
669				onReady: function(player) {
670					var getPlayer = player.c || player,
671					getContainer = $(getPlayer).closest('.background-element');
672					if (getContainer.length) {
673						UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video');
674					}
675				}
676			});
677		}
678	});
679	$(".no-touch .background-video-shortcode").each(function(index, el) {
680		var video_id = $(this).attr('id');
681		if (typeof MediaElement === "function") {
682			new MediaElement(video_id, {
683				startVolume: 0,
684				loop: true,
685				success: function(mediaElement, domObject) {
686					domObject.volume = 0;
687					$(mediaElement).data('started', false);
688					mediaElement.addEventListener('timeupdate', function(e) {
689						if (!$(e.target).data('started')) {
690							$(mediaElement).data('started', true);
691							$(mediaElement).closest('.uncode-video-container').css('opacity', '1');
692						}
693					});
694					if (!UNCODE.isMobile) {
695						setTimeout(function() {
696							UNCODE.initVideoComponent(document.body, '.uncode-video-container.video, .uncode-video-container.self-video');
697						}, 100);
698					}
699					mediaElement.play();
700				},
701				// fires when a problem is detected
702				error: function() {}
703			});
704		}
705	});
706};
707
708UNCODE.disableHoverScroll = function() {
709
710    if (!UNCODE.isMobile) {
711        var body = document.body,
712        timer;
713
714        window.addEventListener('scroll', function() {
715            clearTimeout(timer);
716            if (body.classList)  {
717                if (!body.classList.contains('disable-hover')) {
718                    body.classList.add('disable-hover')
719                }
720
721                timer = setTimeout(function() {
722                    body.classList.remove('disable-hover')
723                }, 300);
724            }
725        }, false);
726    }
727};
728
729
730UNCODE.isotopeLayout = function() {
731	if ($('.isotope-layout').length > 0) {
732		var isotopeContainersArray = [],
733			typeGridArray = [],
734			layoutGridArray = [],
735			screenLgArray = [],
736			screenMdArray = [],
737			screenSmArray = [],
738			transitionDuration = [],
739			$filterItems = [],
740			$filters = $('.isotope-filters'),
741			$itemSelector = '.tmb',
742			$items,
743			itemMargin,
744			correctionFactor = 0,
745			firstLoad = true,
746			isOriginLeft = $('body').hasClass('rtl') ? false : true;
747		$('[class*="isotope-container"]').each(function() {
748			var isoData = $(this).data(),
749			$data_lg,
750			$data_md,
751			$data_sm;
752			if (isoData.lg !== undefined) $data_lg = $(this).attr('data-lg');
753			else $data_lg = '1000';
754			if (isoData.md !== undefined) $data_md = $(this).attr('data-md');
755			else $data_md = '600';
756			if (isoData.sm !== undefined) $data_sm = $(this).attr('data-sm');
757			else $data_sm = '480';
758			screenLgArray.push($data_lg);
759			screenMdArray.push($data_md);
760			screenSmArray.push($data_sm);
761			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
762			if (isoData.type == 'metro') typeGridArray.push(true);
763			else typeGridArray.push(false);
764			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
765			else layoutGridArray.push('masonry');
766			isotopeContainersArray.push($(this));
767		});
768		var colWidth = function(index) {
769				$(isotopeContainersArray[index]).width('');
770				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
771					widthAvailable = $(isotopeContainersArray[index]).width(),
772					columnNum = 12,
773					columnWidth = 0;
774
775				if (isPx) {
776					columnWidth = Math.ceil(widthAvailable / columnNum);
777					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
778				} else {
779					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
780				}
781				$items = $(isotopeContainersArray[index]).find('.tmb:not(.tmb-carousel)');
782				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
783				for (var i = 0, len = $items.length; i < len; i++) {
784					var $item = $($items[i]),
785						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
786						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,2})/);
787
788					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
789						if (multiplier_w != null && multiplier_w[1] !== undefined) {
790							switch (parseInt(multiplier_w[1])) {
791								case (5):
792								case (4):
793								case (3):
794									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
795									multiplier_w[1] = 6;
796									break;
797								case (2):
798								case (1):
799									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
800									multiplier_w[1] = 3;
801									break;
802								default:
803									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
804									multiplier_w[1] = 12;
805									break;
806							}
807						}
808					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
809						if (multiplier_w != null && multiplier_w[1] !== undefined) {
810							switch (parseInt(multiplier_w[1])) {
811								case (5):
812								case (4):
813								case (3):
814								case (2):
815								case (1):
816									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
817									multiplier_w[1] = 6;
818									break;
819								default:
820									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
821									multiplier_w[1] = 12;
822									break;
823							}
824						}
825					} else if (widthAvailable < screenSmArray[index]) {
826						if (multiplier_w != null && multiplier_w[1] !== undefined) {
827							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
828							multiplier_w[1] = 12;
829							if (typeGridArray[index]) multiplier_h[1] = 12;
830						}
831					}
832					var width = multiplier_w ? (columnWidth * multiplier_w[1]) : columnWidth,
833						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
834
835					if (width >= widthAvailable) {
836						$item.css({
837							width: widthAvailable
838						});
839						if (typeGridArray[index]) {
840							$item.children().add($item.find('.backimg')).css({
841								height: height
842							});
843						}
844					} else {
845						$item.css({
846							width: width
847						});
848						if (typeGridArray[index]) {
849							$item.children().add($item.find('.backimg')).css({
850								height: height
851							});
852						}
853					}
854				}
855				return columnWidth;
856			},
857			init_isotope = function() {
858				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
859					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
860						isotopeId = isotopeSystem.attr('id'),
861						$layoutMode = layoutGridArray[i];
862					$(isotopeContainersArray[i]).isotope({
863						//resizable: true,
864						itemSelector: $itemSelector,
865						layoutMode: $layoutMode,
866						transitionDuration: transitionDuration[i],
867						masonry: {
868							columnWidth: colWidth(i)
869						},
870						vertical: {
871							horizontalAlignment: 0.5,
872						},
873						sortBy: 'original-order',
874						isOriginLeft: isOriginLeft
875					}).on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0));
876					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite')) {
877						$(isotopeContainersArray[i]).infinitescroll({
878								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
879								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
880								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li', // selector for all items 
880you'll retrieve
881								animate: false,
882								behavior: 'local',
883								debug: false,
884								loading: {
885									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
886									speed: 0,
887									finished: undefined,
888									msg: $('#' + isotopeId + ' .loadmore-button'),
889								},
890								errorCallback: function() {
891									var isotope_system = $(this).closest('.isotope-system');
892									$('.loading-button', isotope_system).hide();
893									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
894								}
895							},
896							// append the new items to isotope on the infinitescroll callback function.
897							function(newElements, opts) {
898								var $isotope = $(this),
899									isotopeId = $isotope.closest('.isotope-system').attr('id'),
900									filters = new Array(),
901									$loading_button = $isotope.closest('.isotope-system').find('.loading-button'),
902									$infinite_button = $isotope.closest('.isotope-system').find('.loadmore-button'),
903									$numPages = $('a', $infinite_button).data('pages'),
904									delay = 300;
905								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
906								$infinite_button.show();
907								$loading_button.hide();
908								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
909								$('> li', $isotope).remove();
910								$.each($(newElements), function(index, val) {
911									if ($(val).is("li")) {
912										filters.push($(val)[0]);
913									}
914								});
915								newElements = newElements.filter(function(x) {
916									return filters.indexOf(x) < 0
917								});
918								$.each($(filters), function(index, val) {
919									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
920								});
921								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
922							});
923						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
924							var $infinite_isotope = $(isotopeContainersArray[i]),
925								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
926							$infinite_isotope.infinitescroll('pause');
927							$infinite_button.on('click', function(event) {
928								event.preventDefault();
929								var $infinite_system = $(event.target).closest('.isotope-system'),
930								$infinite_isotope = $infinite_system.find('.isotope-container'),
931								isotopeId = $infinite_system.attr('id');
932								$(event.currentTarget).html('Loading…');
933								$infinite_isotope.infinitescroll('resume');
934								$infinite_isotope.infinitescroll('retrieve');
935								$infinite_isotope.infinitescroll('pause');
936							});
937						}
938					}
939				}
940			},
941			onLayout = function(isotopeObj, startIndex) {
942				isotopeObj.css('opacity', 1);
943				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
944				setTimeout(function() {
945					window.dispatchEvent(UNCODE.boxEvent);
946					UNCODE.adaptive();
947					$(isotopeObj).find('audio,video').each(function() {
948						$(this).mediaelementplayer({
949 							pauseOtherPlayers: false,
950						});
951					});
952					if ($(isotopeObj).find('.nested-carousel').length) {
953						UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
954						setTimeout(function() {
955							boxAnimation($('.tmb', isotopeObj), startIndex, true, isotopeObj);
956						}, 200);
957					} else {
958						boxAnimation($('.tmb', isotopeObj), startIndex, true, isotopeObj);
959					}
960				}, 100);
961			},
962			boxAnimation = function(items, startIndex, sequential, container) {
963				var $allItems = items.length - startIndex,
964					showed = 0,
965					index = 0;
966				if (container.closest('.owl-item').length == 1) return false;
967				$.each(items, function(index, val) {
968					var elInner = $('> .t-inside', val);
969					if (val[0]) val = val[0];
970					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
971						new Waypoint({
972							element: val,
973							handler: function() {
974								var element = $('> .t-inside', this.element),
975									parent = $(this.element),
976									currentIndex = parent.index();
977								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
978									delayAttr = parseInt(element.attr('data-delay'));
979								if (isNaN(delayAttr)) delayAttr = 100;
980								delay -= showed;
981								var objTimeout = setTimeout(function() {
982									element.removeClass('zoom-reverse').addClass('start_animation');
983									showed = parent.index();
984								}, delay * delayAttr)
985								parent.data('objTimeout', objTimeout);
986								this.destroy();
987							},
988							offset: '100%'
989						})
990					} else {
991						if (elInner.hasClass('force-anim')) {
992							elInner.addClass('start_animation');
993						} else {
994							elInner.css('opacity', 1);
995						}
996					}
997					index++;
998				});
999			};
1000		if ($('.isotope-pagination').length > 0) {
1001			$('.isotope-system').on('click', '.pagination a', function(evt) {
1002				evt.preventDefault();
1003				var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
1004				container = $(this).closest('.isotope-system'),
1005				calc_scroll = container.closest('.uncol').offset().top - (!filterContainer.hasClass('with-bg') ? filterContainer.outerHeight(true) - $('.filter-show-all a', filterContainer).height() : 0);
1006				calc_scroll -= UNCODE.get_scroll_offset();
1007
1008				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
1009					delta = bodyTop - calc_scroll,
1010					scrollSpeed = Math.abs(delta) / 2;
1011				if (scrollSpeed < 1000) scrollSpeed = 1000;
1012
1013				$('html, body').animate({
1014					scrollTop: calc_scroll
1015				},{
1016					easing: 'easeInOutQuad',
1017					duration: scrollSpeed,
1018					complete: function(){
1019						UNCODE.scrolling = false;
1020					}
1021				});
1022				loadIsotope($(this));
1023				evt.preventDefault();
1024			});
1025		}
1026		$filters.on('click', 'a', function(evt) {
1027			var $filter = $(this),
1028				filterContainer = $filter.closest('.isotope-filters'),
1029				filterValue = $filter.attr('data-filter'),
1030				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
1031				transitionDuration = container.data().isotope.options.transitionDuration,
1032				delay = 300,
1033				filterItems = [];
1034			if (!$filter.hasClass('active')) {
1035				/** Scroll top with filtering */
1036				if (filterContainer.hasClass('filter-scroll')) {
1037					var calc_scroll = container.closest('.uncol').offset().top - (!filterContainer.hasClass('with-bg') ? filterContainer.outerHeight(true) - $('.filter-show-all a', filterContainer).height() : 0);
1038					calc_scroll -= UNCODE.get_scroll_offset();
1039
1040					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
1041						delta = bodyTop - calc_scroll,
1042						scrollSpeed = Math.abs(delta) / 2;
1043					if (scrollSpeed < 1000) scrollSpeed = 1000;
1044
1045					$('html, body').animate({
1046						scrollTop: calc_scroll
1047					}, scrollSpeed, 'easeInOutQuad');
1048				}
1049				if (filterValue !== undefined) {
1050					$.each($('> .tmb > .t-inside', container), function(index, val) {
1051						var parent = $(val).parent(),
1052							objTimeout = parent.data('objTimeout');
1053						if (objTimeout) {
1054							$(val).removeClass('zoom-reverse').removeClass('start_animation')
1055							clearTimeout(objTimeout);
1056						}
1057						if (transitionDuration == 0) {
1058							if ($(val).hasClass('animate_when_almost_visible')) {
1059								$(val).addClass('zoom-reverse').removeClass('start_animation');
1060							} else {
1061								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
1062							}
1063						}
1064					});
1065					setTimeout(function() {
1066						container.isotope({
1067							filter: function() {
1068								var block = $(this),
1069								filterable = (filterValue == '*') || block.hasClass(filterValue),
1070								lightboxElements = $('[data-lbox^=ilightbox]', block);
1071								if (filterable) {
1072									if (lightboxElements.length) {
1073										lightboxElements.removeClass('lb-disabled');
1074										container.data('lbox', $(lightboxElements[0]).data('lbox'));
1075									}
1076									filterItems.push(block);
1077								} else {
1078									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
1079								}
1080								return filterable;
1081							}
1082						});
1083						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
1084					}, delay);
1085					/** once filtered - start **/
1086					container.isotope('once', 'arrangeComplete', function() {
1087						var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
1088						if (typeof getLightbox === 'object') getLightbox.refresh();
1089						if (transitionDuration == 0) {
1090							setTimeout(function() {
1091								boxAnimation(filterItems, 0, false, container);
1092							}, 100);
1093						}
1094					});
1095					/** once filtered - end **/
1096				} else {
1097					$.each($('> .tmb > .t-inside', container), function(index, val) {
1098						var parent = $(val).parent(),
1099							objTimeout = parent.data('objTimeout');
1100						if (objTimeout) {
1101							$(val).removeClass('zoom-reverse').removeClass('start_animation')
1102							clearTimeout(objTimeout);
1103						}
1104						if (transitionDuration == 0) {
1105							if ($(val).hasClass('animate_when_almost_visible')) {
1106								$(val).addClass('zoom-reverse').removeClass('start_animation');
1107							} else {
1108								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
1109							}
1110						}
1111					});
1112					container.parent().addClass('isotope-loading');
1113					loadIsotope($filter);
1114				}
1115			}
1116			evt.preventDefault();
1117		});
1118		$(window).on("popstate", function(e) {
1119			if (e.originalEvent.state === null) return;
1120			var params = {};
1121			if (location.search) {
1122				var parts = location.search.substring(1).split('&');
1123				for (var i = 0; i < parts.length; i++) {
1124					var nv = parts[i].split('=');
1125					if (!nv[0]) continue;
1126					params[nv[0]] = nv[1] || true;
1127				}
1128			}
1129			if (params.id === undefined) {
1130				$.each($('.isotope-system'), function(index, val) {
1131					loadIsotope($(val));
1132				});
1133			} else loadIsotope($('#' + params.id));
1134		});
1135
1136		var loadIsotope = function($href) {
1137			var href = ($href.is("a") ? $href.attr('href') : location),
1138				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
1139				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
1140				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
1141				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
1142				isotopeId = isotopeSystem.attr('id');
1143			if ($href.is("a")) history.pushState({
1144				myIsotope: true
1145			}, document.title, href);
1146			$.ajax({
1147				url: href
1148			}).done(function(data) {
1149				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
1150					$resultPagination = $(data).find('#' + isotopeId + ' .pagination');
1151				isotopeWrapper.addClass('isotope-reloaded');
1152				setTimeout(function() {
1153					isotopeWrapper.removeClass('isotope-loading');
1154					isotopeWrapper.removeClass('isotope-reloaded');
1155				}, 500);
1156				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
1157					var parent = $(val).parent(),
1158						objTimeout = parent.data('objTimeout');
1159					if (objTimeout) {
1160						$(val).removeClass('zoom-reverse').removeClass('start_animation')
1161						clearTimeout(objTimeout);
1162					}
1163					if ($(val).hasClass('animate_when_almost_visible')) {
1164						$(val).addClass('zoom-reverse').removeClass('start_animation');
1165					} else {
1166						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
1167					}
1168				});
1169				setTimeout(function() {
1170					if (isotopeContainer.data('isotope')) {
1171						isotopeContainer.html($resultItems).isotope('reloadItems', onLayout(isotopeContainer, 0));
1172						UNCODE.adaptive();
1173						var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
1174						if (typeof getLightbox === 'object') getLightbox.refresh();
1175					}
1176				}, 300);
1177				$('.pagination', isotopeFooter).remove();
1178				isotopeFooter.append($resultPagination);
1179			});
1180		};
1181		$filters.each(function(i, buttonGroup) {
1182			var $buttonGroup = $(buttonGroup);
1183			$buttonGroup.on('click', 'a', function() {
1184				$buttonGroup.find('.active').removeClass('active');
1185				$(this).addClass('active');
1186			});
1187		});
1188		window.addEventListener('boxResized', function(e) {
1189			$.each($('.isotope-layout'), function(index, val) {
1190				var $layoutMode = ($(this).data('layout'));
1191				if ($layoutMode === undefined) $layoutMode = 'masonry';
1192				if ($(this).data('isotope')) {
1193					$(this).isotope({
1194						itemSelector: $itemSelector,
1195						layoutMode: $layoutMode,
1196						transitionDuration: transitionDuration[index],
1197						masonry: {
1198							columnWidth: colWidth(index)
1199						},
1200						vertical: {
1201							horizontalAlignment: 0.5,
1202						},
1203						sortBy: 'original-order',
1204						isOriginLeft: isOriginLeft
1205					});
1206					$(this).isotope('unbindResize');
1207				}
1208				$(this).find('.mejs-video,.mejs-audio').each(function() {
1209					$(this).trigger('resize');
1210				});
1211			});
1212		}, false);
1213		init_isotope();
1214	};
1215}
1216
1217UNCODE.lightbox = function() {
1218	UNCODE.lightboxArray = {};
1219	setTimeout(function() {
1220		var groupsArr = {};
1221		$('[data-lbox^=ilightbox]:not(.lb-disabled)').each(function() {
1222			var group = this.getAttribute("data-lbox"),
1223				values = $(this).data();
1224			groupsArr[group] = values;
1225		});
1226		for (var i in groupsArr) {
1227			var skin = groupsArr[i].skin || 'black',
1228				path = groupsArr[i].dir || 'horizontal',
1229				thumbs = !groupsArr[i].notmb || false,
1230				arrows = !groupsArr[i].noarr || false,
1231				social = groupsArr[i].social || false,
1232				deeplink = groupsArr[i].deep || false,
1233				counter = $('[data-lbox="' + i + '"]:not(.lb-disabled)').length;
1234			if (social) social = {
1235				facebook: true,
1236				twitter: true,
1237				googleplus: true,
1238				reddit: true,
1239				digg: true,
1240				delicious: true
1241			};
1242			UNCODE.lightboxArray[i] = $('[data-lbox="' + i + '"]:not(.lb-disabled)').iLightBox({
1243				skin: skin,
1244				path: path,
1245				linkId: deeplink,
1246				infinite: false,
1247				//fullViewPort: 'fit',
1248				smartRecognition: false,
1249				fullAlone: false,
1250				maxScale: 1,
1251				minScale: .02,
1252				//fullStretchTypes: 'flash, video',
1253				overlay: {
1254					opacity: .94
1255				},
1256				controls: {
1257					arrows: (counter > 1 ? arrows : false),
1258					fullscreen: true,
1259					thumbnail: thumbs,
1260					slideshow: (counter > 1 ? true : false)
1261				},
1262				show: {
1263					speed: 200
1264				},
1265				hide: {
1266					speed: 200
1267				},
1268				social: {
1269					start: false,
1270					buttons: social
1271				},
1272				caption: {
1273					start: false
1274				},
1275				styles: {
1276					nextOpacity: 1,
1277					nextScale: 1,
1278					prevOpacity: 1,
1279					prevScale: 1
1280				},
1281				effects: {
1282					switchSpeed: 400
1283				},
1284				slideshow: {
1285					pauseTime: 5000
1286				},
1287				thumbnails: {
1288					maxWidth: 60,
1289					maxHeight: 60,
1290					activeOpacity: .2
1291				},
1292				html5video: {
1293					preload: true
1294				}
1295			});
1296		};
1297	}, 100);
1298};
1299
1300UNCODE.backVideo = function() {
1301	$(function() {
1302		$.each($('.background-video-shortcode'), function() {
1303			var video_id = $(this).attr('id');
1304			if (typeof MediaElement === "function") {
1305				new MediaElement(video_id, {
1306					startVolume: 0,
1307					loop: true,
1308					success: function(mediaElement, domObject) {
1309						mediaElement.play();
1310						$(mediaElement).closest('.uncode-video-container').css('opacity','1');
1311						domObject.volume = 0;
1312					},
1313					// fires when a problem is detected
1314					error: function() {}
1315				});
1316			}
1317		});
1318	});
1319};
1320
1321UNCODE.carousel = function(container) {
1322	var $owlSelector = $('.owl-carousel-container > [class*="owl-carousel"]', container),
1323		values = {},
1324		tempTimeStamp,
1325		currentIndex,
1326		$owlInsideEqual = [];
1327	$owlSelector.each(function() {
1328		var itemID = $(this).attr('id'),
1329			$elSelector = $(('#' + itemID).toString());
1330		values['id'] = itemID;
1331		values['items'] = 1;
1332		values['columns'] = 3;
1333		values['fade'] = false;
1334		values['nav'] = false;
1335		values['navmobile'] = false;
1336		values['navskin'] = 'light';
1337		values['navspeed'] = 400;
1338		values['dots'] = false;
1339		values['dotsmobile'] = false;
1340		values['loop'] = false;
1341		values['autoplay'] = false;
1342		values['timeout'] = 3000;
1343		values['autoheight'] = false;
1344		values['margin'] = 0;
1345		values['lg'] = 1;
1346		values['md'] = 1;
1347		values['sm'] = 1;
1348		$.each($(this).data(), function(i, v) {
1349			values[i] = v;
1350		});
1351
1352		if ($(this).closest('.uncode-slider').length) {
1353			values['navskin'] = '';
1354			values['navmobile'] = false;
1355			values['dotsmobile'] = true;
1356		} else {
1357			values['navskin'] = ' style-'+values['navskin']+' style-override';
1358		}
1359
1360		/** Initialized */
1361		$elSelector.on('initialized.owl.carousel', function(event) {
1362
1363			var thiis = $(event.currentTarget),
1364				// get the time from the data method
1365				time = thiis.data("timer-id");
1366			if (time) {
1367				clearTimeout(time);
1368			}
1369			thiis.addClass('showControls');
1370			var new_time = setTimeout(function() {
1371				thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
1372				if (thiis.hasClass('owl-height-equal')) setItemsHeight(event.currentTarget);
1373				if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
1374				if (thiis.closest('.unequal, .unexpand').length) {
1375					var rowParent = thiis.closest('.row-parent');
1376					UNCODE.setRowHeight(rowParent[0], true);
1377				}
1378			}, 350);
1379			// save the new time
1380			thiis.data("timer-id", new_time);
1381
1382			var scrolltop = $(document).scrollTop();
1383			$(event.currentTarget).closest('.uncode-slider').find('video').removeAttr('poster');
1384
1385			//if (!UNCODE.isMobile) {
1386				/** fix autoplay when visible **/
1387				if ($(event.currentTarget).data('autoplay')) {
1388					$(event.currentTarget).trigger('stop.autoplay.owl');
1389				}
1390				var carouselInView = new Waypoint.Inview({
1391				  element: $(event.currentTarget)[0],
1392				  enter: function(direction) {
1393				    var el = $(this.element);
1394						if (el.data('autoplay')) {
1395							el.trigger('play.owl.autoplay');
1396							el.data('stopped','false');
1397						}
1398				  },
1399				  exited: function() {
1400				    if ($(this.element).data('autoplay')) {
1401							$(this.element).trigger('stop.owl.autoplay');
1402							$(this.element).data('stopped','true');
1403						}
1404				  }
1405				});
1406			//}
1407
1408			if (!$(event.currentTarget).closest('.isotope-system').length) {
1409				setTimeout(function() {
1410					animate_thumb($('.t-inside', el), event);
1411				}, 400);
1412			}
1413
1414			var currentItem = $(event.currentTarget).find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
1415			currentIndex = $(currentItem).attr('data-index');
1416
1417			$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
1418				if ($(val).closest('.uncode-slider').length) {
1419					$(val).removeClass('start_animation');
1420				}
1421			});
1422
1423			$.each($('.owl-item:not(.active)', event.currentTarget), function(index, val) {
1424				if ($(val).attr('data-index') != currentIndex) {
1425					$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
1426				}
1427				if ($(val).attr('data-index') == currentIndex) {
1428					$('.animate_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
1429				}
1430			});
1431
1432			if ($(event.currentTarget).closest('.uncode-slider').length) {
1433				var el = $(event.currentTarget).closest('.row-parent')[0];
1434				if ($(el).data('imgready')) {
1435					firstLoaded(el, event);
1436				} else {
1437					el.addEventListener("imgLoaded", function(el) {
1438						firstLoaded(el.target, event);
1439					}, false);
1440				}
1441				var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
1442				if (transHeight != null) {
1443					setTimeout(function() {
1444						$(event.currentTarget).closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
1445					}, 100);
1446				}
1447			} else {
1448				var el = $(event.currentTarget);
1449				el.closest('.uncode-slider').addClass('slider-loaded');
1450			}
1451
1452			setTimeout(function() {
1453				window.uncode_textfill(thiis);
1454				if ($(event.currentTarget).closest('.uncode-slider').length) {
1455					if ($(event.currentTarget).data('autoplay')) pauseOnHover(event.currentTarget);
1456				}
1457			}, 500);
1458
1459			if ($(event.currentTarget).closest('.unequal').length) {
1460				$owlInsideEqual.push($(event.currentTarget).closest('.row-parent'));
1461			}
1462
1463		});
1464
1465		/** Resizing */
1466		$elSelector.on('resized.owl.carousel', function(event) {
1467			if ($(this).closest('.nested-carousel').length) {
1468				setTimeout(function() {
1469					window.dispatchEvent(UNCODE.boxEvent);
1470				}, 200);
1471			}
1472			if ($(event.currentTarget).hasClass('owl-height-equal')) setItemsHeight(event.currentTarget);
1473		});
1474
1475		/** Change */
1476		$elSelector.on('change.owl.carousel', function(event) {
1477			if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
1478		});
1479
1480		/** Changed */
1481		$elSelector.on('changed.owl.carousel', function(event) {
1482			if (tempTimeStamp != event.timeStamp) {
1483				var scrolltop = $(document).scrollTop();
1484				var currentItem = $(event.currentTarget).find("> .owl-stage-outer > .owl-stage > .owl-item")[(event.item.index != null) ? event.item.index : 0];
1485				if ($(event.currentTarget).closest('.row-slider').length) {
1486					if (currentItem == undefined) {
1487						currentItem = $(event.currentTarget).children()[0];
1488					}
1489					if ($(currentItem).closest('#page-header').length) {
1490						if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
1491							UNCODE.switchColorsMenu(scrolltop, 'dark');
1492						} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
1493							UNCODE.switchColorsMenu(scrolltop, 'light');
1494						}
1495					}
1496				}
1497			}
1498			tempTimeStamp = event.timeStamp;
1499		});
1500
1501		$elSelector.on('translate.owl.carousel', function(event) {
1502			if (UNCODE.isMobile) {
1503				$(event.currentTarget).addClass('owl-translating');
1504			}
1505		});
1506
1507		/** Translated */
1508		$elSelector.on('translated.owl.carousel', function(event) {
1509
1510			var currentItem = $(event.currentTarget).find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
1511				currentIndex = $(currentItem).attr('data-index');
1512
1513			if (!UNCODE.isMobile) {
1514				UNCODE.owlPlayVideo(event.currentTarget);
1515			}
1516
1517			setTimeout(function() {
1518				var lastDelayElems = animate_elems($('.owl-item.active', event.currentTarget));
1519				var lastDelayThumb = animate_thumb($('.owl-item.active .t-inside', event.currentTarget), event);
1520				if ($(event.currentTarget).closest('.uncode-slider').length && $(event.currentTarget).data('autoplay')) {
1521					if (lastDelayElems == undefined) lastDelayElems = 0;
1522					if (lastDelayThumb == undefined) lastDelayThumb = 0;
1523					var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
1524					$(event.currentTarget).trigger('stop.owl.autoplay');
1525					setTimeout(function() {
1526						if (!$(event.currentTarget).hasClass('owl-mouseenter') && $(event.currentTarget).data('stopped') != 'true') $(event.currentTarget).trigger('play.owl.autoplay');
1527					}, maxDelay);
1528				}
1529			}, 200);
1530
1531			$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
1532				if ($(val).closest('.uncode-slider').length) {
1533					$(val).removeClass('start_animation');
1534				}
1535			});
1536
1537			$.each($('.owl-item:not(.active)', event.currentTarget), function(index, val) {
1538				if ($(val).attr('data-index') != currentIndex) {
1539					$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
1540				}
1541				if ($(val).attr('data-index') == currentIndex) {
1542					$('.animate_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
1543				}
1544			});
1545
1546			if (UNCODE.isMobile) {
1547				$(event.currentTarget).removeClass('owl-translating');
1548			}
1549
1550			// } else {
1551			// 	$(event.currentTarget).removeClass('owl-translating');
1552			// }
1553		});
1554
1555		/** Init carousel */
1556		$elSelector.owlCarousel({
1557			items: values['items'],
1558			animateOut: (values['fade'] == true) ? 'fadeOut' : null,
1559			nav: values['nav'],
1560			dots: values['dots'],
1561			loop: values['loop'],
1562			margin: 0,
1563			video: true,
1564			autoWidth: false,
1565			autoplay: false,
1566			autoplayTimeout: values['timeout'],
1567			autoplaySpeed: values['navspeed'],
1568			autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true,
1569			autoHeight: ($(this).hasClass('owl-height-equal') || $(this).hasClass('owl-height-auto')) ? true : values['autoheight'],
1570			rtl: $('body').hasClass('rtl') ? true : false,
1571			fluidSpeed: true,
1572			navSpeed: values['navspeed'],
1573			navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
1574			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>'],
1575			navContainer: values['nav'] ? $elSelector : false,
1576			responsiveClass: true,
1577			responsiveBaseElement: '.box-container',
1578			responsive: {
1579				0: {
1580					items: values['sm'],
1581					nav: values['navmobile'],
1582					dots: values['dotsmobile']
1583				},
1584				480: {
1585					items: values['sm'],
1586					nav: values['navmobile'],
1587					dots: values['dotsmobile']
1588				},
1589				570: {
1590					items: values['md'],
1591					nav: values['navmobile'],
1592					dots: values['dotsmobile']
1593				},
1594				960: {
1595					items: values['lg']
1596				}
1597			},
1598		});
1599
1600		setTimeout(function() {
1601			for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
1602				UNCODE.setRowHeight($owlInsideEqual[i]);
1603			};
1604		}, 300);
1605	});
1606
1607	function firstLoaded(el, event) {
1608		var el = $(el),
1609		uncode_slider = el.find('.uncode-slider');
1610		el.find('.owl-carousel').css('opacity', 1);
1611		uncode_slider.addClass('slider-loaded');
1612		window.uncode_textfill(el.find('.owl-item.active'));
1613		//if (!UNCODE.isMobile) {
1614			setTimeout(function() {
1615				var lastDelayElems = animate_elems(el.find('.owl-item.active'));
1616				var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
1617				if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
1618					if (lastDelayElems == undefined) lastDelayElems = 0;
1619					if (lastDelayThumb == undefined) lastDelayThumb = 0;
1620					var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
1621					$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
1622					setTimeout(function() {
1623						$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
1624					}, maxDelay);
1625				}
1626			}, 500);
1627		//}
1628	}
1629
1630	function navHover(el) {
1631		var $owlCont = el,
1632			$owlPrev = $owlCont.find('.owl-prev'),
1633			$owlNext = $owlCont.find('.owl-next'),
1634			$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
1635			$owlPagination = $owlCont.next(),
1636			owlPrevW = $owlPrev.outerWidth(),
1637			owlNextW = $owlNext.outerWidth(),
1638			owlDotsH = $owlDots.innerHeight(),
1639			owlTime = 400,
1640			owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
1641		$owlPrev.css("margin-left", -owlPrevW);
1642		$owlNext.css("margin-right", -owlNextW);
1643		if (!owlNested) $owlDots.css("bottom", -owlDotsH);
1644		$owlCont.mouseenter(function() {
1645			owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
1646			$owlPrev.css({
1647				marginLeft: 0
1648			});
1649			$owlNext.css({
1650				marginRight: 0
1651			});
1652			if (!owlNested) {
1653				$owlDots.css({
1654					opacity: 1,
1655					bottom: 0
1656				});
1657			}
1658		}).mouseleave(function() {
1659			owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
1660			$owlPrev.css({
1661				marginLeft: -owlPrevW
1662			});
1663			$owlNext.css({
1664				marginRight: -owlNextW
1665			});
1666			if (!owlNested) {
1667				$owlDots.css({
1668					opacity: 1,
1669					bottom: -owlDotsH
1670				});
1671			}
1672		});
1673	};
1674
1675	function animate_elems($this) {
1676		var lastDelay;
1677		$.each($('.animate_when_almost_visible:not(.t-inside)', $this), function(index, val) {
1678			var element = $(val),
1679				delayAttr = element.attr('data-delay');
1680			if (delayAttr == undefined) delayAttr = 0;
1681			setTimeout(function() {
1682				element.addClass('start_animation');
1683			}, delayAttr);
1684			lastDelay = delayAttr;
1685		});
1686		return lastDelay;
1687	}
1688
1689	function animate_thumb(items, event) {
1690		var lastDelay,
1691		itemIndex,
1692		tempIndex = ($(event.currentTarget).data('tempIndex') == undefined) ? $('.owl-item.active', event.currentTarget).first().index() : $(event.currentTarget).data('tempIndex'),
1693		numActives = $('.owl-item.active', event.currentTarget).length;
1694		$(event.currentTarget).data('tempIndex', event.item.index);
1695			$.each(items, function(index, val) {
1696				var parent = $(val).closest('.owl-item');
1697				if (!$(val).hasClass('start_animation')) {
1698					if (parent.hasClass('active')) {
1699						var thumbInView = new Waypoint.Inview({
1700						  element: val,
1701						  enter: function(direction) {
1702						    var element = $(this.element),
1703									delayAttr = parseInt(element.attr('data-delay')),
1704									itemIndex = element.closest('.owl-item').index() + 1,
1705									diffItem = Math.abs(itemIndex - tempIndex) - 1;
1706								if (itemIndex > tempIndex) {
1707									$(event.currentTarget).data('tempIndex', itemIndex);
1708								}
1709								if (isNaN(delayAttr)) delayAttr = 100;
1710								$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', event.currentTarget).addClass('start_animation');
1711								var objTimeout = setTimeout(function() {
1712									element.addClass('start_animation');
1713								}, diffItem * delayAttr);
1714								lastDelay = diffItem * delayAttr;
1715								parent.data('objTimeout', objTimeout);
1716								this.destroy();
1717						  }
1718						});
1719					}
1720				}
1721			});
1722			return lastDelay;
1723		}
1724
1725	function setItemsHeight(item) {
1726		$.each($('.owl-item', item), function(index, val) {
1727			var availableThumbHeight = $('.t-inside', $(val)).height(),
1728			innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
1729			difference = availableThumbHeight - innerThumbHeight;
1730			if ($('.tmb-content-under', val).length) {
1731				var visualPart = $('.t-entry-visual', val);
1732				if (visualPart.length) {
1733					difference -= $('.t-entry-visual', val).height();
1734				}
1735			}
1736			$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
1737		});
1738	}
1739
1740	function pauseOnHover(slider) {
1741		$('.owl-dots, .owl-prev, .owl-next', slider).on({
1742	    mouseenter: function () {
1743	    	$(slider).addClass('owl-mouseenter');
1744	    	$(slider).trigger('stop.owl.autoplay');
1745	    },
1746	    mouseleave: function () {
1747	    	$(slider).removeClass('owl-mouseenter')
1748	      $(slider).trigger('play.owl.autoplay');
1749	    }
1750		});
1751	}
1752};
1753
1754UNCODE.owlPlayVideo = function(carousel) {
1755	var player, iframe;
1756	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
1757		var content = $(val).html();
1758		if (content == '') {
1759			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
1760			$(val).append(getCloned);
1761		}
1762		if ($(this).attr('data-provider') == 'vimeo') {
1763			iframe = $(this).find('iframe');
1764			player = $f(iframe[0]);
1765			player.api('play');
1766		} else if ($(this).attr('data-provider') == 'youtube') {
1767			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
1768		} else {
1769			var player = $(this).find('video');
1770			if (player.length) {
1771				$(this).find('video')[0].volume = 0;
1772				$(this).find('video')[0].play();
1773				$(val).css('opacity', 1);
1774			}
1775		}
1776	});
1777};
1778
1779UNCODE.owlStopVideo = function(carousel) {
1780	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
1781		var player, iframe;
1782		if ($(this).attr('data-provider') == 'vimeo') {
1783			iframe = $(this).find('iframe');
1784			player = $f(iframe[0]);
1785			player.api('pause');
1786		} else if ($(this).attr('data-provider') == 'youtube') {
1787			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
1788		} else {
1789			var player = $(this).find('video');
1790			if (player.length) {
1791				$(this).find('video')[0].volume = 0;
1792				$(this).find('video')[0].play();
1793			}
1794		}
1795	});
1796};
1797
1798UNCODE.animations = function() {
1799	//if (!UNCODE.isMobile) {
1800		$.each($('.header-content-inner'), function(index, val) {
1801			var element = $(val),
1802				transition = '';
1803			if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
1804			if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
1805			if (element.hasClass('left-t-right')) transition = 'left-t-right';
1806			if (element.hasClass('right-t-left')) transition = 'right-t-left';
1807			if (element.hasClass('zoom-in')) transition = 'zoom-in';
1808			if (element.hasClass('zoom-out')) transition = 'zoom-out';
1809			if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
1810			if (transition != '') {
1811				$(val).removeClass(transition);
1812				var container = element,
1813					containerDelay = container.attr('data-delay'),
1814					containerSpeed = container.attr('data-speed'),
1815					items = $('.header-title > *, .post-info', container);
1816				$.each(items, function(index, val) {
1817					var element = $(val),
1818						//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
1819						delayAttr = (containerDelay != undefined) ? containerDelay : 400;
1820					if (!element.hasClass('animate_when_almost_visible')) {
1821						delayAttr = Number(delayAttr) + (400 * index);
1822						if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
1823						element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
1824					}
1825				});
1826				container.css('opacity', 1);
1827			}
1828		});
1829	//}
1830
1831	if (!window.waypoint_animation) {
1832		window.waypoint_animation = function() {
1833			$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside), .tmb-media .animate_when_almost_visible:not(.start_animation)'), function(index, val) {
1834				var run = true;
1835				if ($(val).closest('.owl-carousel').length > 0) run = false;
1836				if (run) {
1837					new Waypoint({
1838						element: val,
1839						handler: function() {
1840							var element = $(this.element),
1841								index = element.index(),
1842								delayAttr = element.attr('data-delay');
1843							if (delayAttr == undefined) delayAttr = 0;
1844							setTimeout(function() {
1845								element.addClass('start_animation');
1846							}, delayAttr);
1847							this.destroy();
1848						},
1849						offset: '90%'
1850					});
1851				}
1852			});
1853		}
1854	}
1855	setTimeout(function() {
1856		window.waypoint_animation();
1857	}, 100);
1858}
1859
1860UNCODE.tapHover = function() {
1861
1862    var $el = $('html.touch .tmb:not(.tmb-no-double-tap) .t-entry-v
1862isual-cont > a'), //.length //html.touch a.btn
1863        elClass = "hover";
1864
1865    $el.on("click", function(e) { // cambia click con touch start 'touchstart'
1866        var link = $(this);
1867        if (link.hasClass(elClass)) {
1868            return true;
1869        } else {
1870            link.addClass("hover");
1871            $el.not(this).removeClass(elClass);
1872            e.preventDefault();
1873            return false;
1874        }
1875    });
1876};
1877
1878
1879UNCODE.onePage = function(isMobile) {
1880	var current = 0,
1881		last = 0,
1882		lastScrollTop = 0,
1883		forceScroll = false,
1884		lastScrolled = 0,
1885		isSectionscroller = ($('.main-onepage').length) ? true : false,
1886		getOffset = (($('.menu-sticky .menu-container:not(.menu-hide)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide)').outerHeight() : 0);
1887
1888	function init_onepage() {
1889		if (isSectionscroller && !isMobile) {
1890			$("<ul class='onepage-pagination'></ul>").prependTo("body");
1891		}
1892		last = $('.onepage-section').length - 1;
1893		$.each($('div[data-parent=true]'), function(index, val) {
1894			$(this).attr('data-section', index);
1895			if (isMobile) return;
1896			var sectionDown = new Waypoint({
1897				element: val,
1898				handler: function(direction) {
1899					if (direction == 'down') {
1900						changeMenuActive(this.element, index);
1901					}
1902				},
1903				offset: 1 + getOffset
1904			});
1905			var sectionUp = new Waypoint({
1906				element: val,
1907				handler: function(direction) {
1908					if (direction == 'up') {
1909						changeMenuActive(this.element, index);
1910					}
1911				},
1912				offset: -1 + getOffset
1913			});
1914
1915			if (isSectionscroller) {
1916				var label;
1917				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
1918				else label = '';
1919				var getName = $(this).attr('data-name');
1920				if (getName == undefined) getName = index;
1921				if (label != '') {
1922					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
1923					$('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>");
1924				}
1925			}
1926		});
1927
1928		if (isSectionscroller) {
1929			$.each($('ul.onepage-pagination li'), function(index, val) {
1930				var $this = $(val);
1931				$this.on('click', function(evt) {
1932					var el = $('a', evt.currentTarget);
1933					current = lastScrolled = parseInt(el.attr('data-index'));
1934					lastScrolled += 1;
1935					scrollBody(current);
1936				});
1937			});
1938			var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
1939			if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '') {
1940				goToSection = String(window.location.hash).replace(/^#/, "");
1941				goToSection = Number($('[data-name=' + goToSection + ']').attr('data-section'));
1942			}
1943
1944			if (typeof goToSection === 'number' && !isNaN(goToSection)) {
1945				current = lastScrolled = goToSection;
1946				setTimeout(function() {
1947					scrollBody(goToSection);
1948				}, 500);
1949			}
1950		}
1951
1952	}
1953
1954	function changeMenuActive(section, index) {
1955		current = lastScrolled = parseInt($(section).attr('data-section'));
1956		if (isSectionscroller) {
1957			var newSection = $('.onepage-pagination li a[data-index=' + index + ']');
1958			if (newSection.length) {
1959				$('ul.onepage-pagination li a').removeClass('is-selected');
1960				newSection.addClass('is-selected');
1961			}
1962		}
1963		var getName = $('[data-section=' + index + ']').attr('data-name');
1964		if (getName != undefined) {
1965			$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
1966				var get_href = $(val).attr('href');
1967				if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
1968					$(val).closest('ul').find('.active').removeClass('active');
1969					$(val).parent().addClass('active');
1970				}
1971			});
1972		}
1973	}
1974
1975	if (isSectionscroller) {
1976		$(window).on('scroll', function() {
1977			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
1978			if (bodyTop == 0) {
1979				$('ul.onepage-pagination li a').removeClass('is-selected');
1980				$('.onepage-pagination li a[data-index=0]').addClass('is-selected');
1981				var getName = $('[data-section=0]').attr('data-name');
1982				if (getName != undefined) {
1983					$.each($('.menu-container .menu-item > a'), function(i, val) {
1984						var get_href = $(val).attr('href');
1985						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
1986							$(val).closest('ul').find('.active').removeClass('active');
1987							$(val).parent().addClass('active');
1988						}
1989					});
1990				}
1991			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
1992				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
1993				if (lastSection.length) {
1994					$('ul.onepage-pagination li a').removeClass('is-selected');
1995					lastSection.addClass('is-selected');
1996				}
1997			}
1998		});
1999
2000		var scrollBody = function(index) {
2001			$('ul.onepage-pagination li a').removeClass('is-selected');
2002			$('.onepage-pagination li a[data-index=' + index + ']').addClass('is-selected');
2003			var body = $("html, body"),
2004			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
2005			delta = bodyTop - $('[data-section=' + index + ']').offset().top,
2006			scrollTo = $('[data-section=' + index + ']').offset().top;
2007			scrollTo -= UNCODE.get_scroll_offset();
2008			if (index != 0) {
2009				UNCODE.scrolling = true;
2010			}
2011			body.animate({
2012				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
2013			}, Math.abs(delta) / 2, 'easeInOutQuad', function() {
2014				setTimeout(function(){
2015					UNCODE.scrolling = false;
2016				}, 100);
2017			});
2018		};
2019	}
2020
2021	init_onepage();
2022};
2023
2024UNCODE.stickyElements = function() {
2025	if (!UNCODE.isMobile) {
2026		setTimeout(function() {
2027			if ($('.sticky-element').length) {
2028				var getRowPadding = $('.sticky-element.sticky-sidebar').closest('.row-parent').css("padding-top"),
2029					sideOffset = (getRowPadding != undefined) ? parseInt(getRowPadding.replace("px", "")) : 0;
2030				sideOffset += UNCODE.bodyBorder;
2031				if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
2032				if ($('.menu-sticky .menu-container:not(.menu-hide)').length) {
2033					if ($('.menu-shrink').length) {
2034						sideOffset += $('.navbar-brand').data('minheight') + 36;
2035					} else sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
2036				}
2037				if ($(window).width() > UNCODE.mediaQuery) {
2038					$(".sticky-element").stick_in_parent({
2039						sticky_class: 'is_stucked',
2040						offset_top: sideOffset,
2041						bottoming: true,
2042						inner_scrolling: false
2043					});
2044				}
2045				$(window).on('resize', function(event) {
2046					if ($(window).width() > UNCODE.mediaQuery) {
2047						$(".sticky-element").stick_in_parent({
2048							sticky_class: 'is_stucked',
2049							offset_top: sideOffset,
2050							bottoming: true,
2051							inner_scrolling: false
2052						});
2053					} else {
2054						$(".sticky-element").trigger("sticky_kit:detach");
2055					}
2056				});
2057			}
2058		}, 1000);
2059	}
2060};
2061
2062UNCODE.scrollEnance = function() {
2063  //
2064  // SmoothScroll for websites v1.4.4 (Balazs Galambosi)
2065  // http://www.smoothscroll.net/
2066  //
2067  // Licensed under the terms of the MIT license.
2068  //
2069  // You may use it in your theme if you credit me.
2070  // It is also free to use on any individual website.
2071  //
2072  // Exception:
2073  // The only restriction is to not publish any
2074  // extension for browsers or native application
2075  // without getting a written permission first.
2076  //
2077  UNCODE.navigating = false;
2078  (function () {
2079
2080  // Scroll Variables (tweakable)
2081  var defaultOptions = {
2082
2083      // Scrolling Core
2084      frameRate        : 150, // [Hz]
2085      animationTime    : 500, // [ms]
2086      stepSize         : 100, // [px]
2087
2088      // Pulse (less tweakable)
2089      // ratio of "tail" to "acceleration"
2090      pulseAlgorithm   : true,
2091      pulseScale       : 4,
2092      pulseNormalize   : 1,
2093
2094      // Acceleration
2095      accelerationDelta : 50,  // 50
2096      accelerationMax   : 3,   // 3
2097
2098      // Keyboard Settings
2099      keyboardSupport   : true,  // option
2100      arrowScroll       : 50,    // [px]
2101
2102      // Other
2103      touchpadSupport   : false, // ignore touchpad by default
2104      fixedBackground   : true,
2105      excluded          : ''
2106  };
2107
2108  var options = defaultOptions;
2109
2110
2111  // Other Variables
2112  var isExcluded = false;
2113  var isFrame = false;
2114  var direction = { x: 0, y: 0 };
2115  var initDone  = false;
2116  var root = document.documentElement;
2117  var activeElement;
2118  var observer;
2119  var refreshSize;
2120  var deltaBuffer = [];
2121  var isMac = /^Mac/.test(navigator.platform);
2122
2123  var key = { left: 37, up: 38, right: 39, down: 40, spacebar: 32,
2124              pageup: 33, pagedown: 34, end: 35, home: 36 };
2125  var arrowKeys = { 37: 1, 38: 1, 39: 1, 40: 1 };
2126
2127  /***********************************************
2128   * INITIALIZE
2129   ***********************************************/
2130
2131  /**
2132   * Tests if smooth scrolling is allowed. Shuts down everything if not.
2133   */
2134  function initTest() {
2135      if (options.keyboardSupport) {
2136          addEvent('keydown', keydown);
2137      }
2138  }
2139
2140  /**
2141   * Sets up scrolls array, determines if frames are involved.
2142   */
2143  function init() {
2144
2145      if (initDone || !document.body) return;
2146
2147      initDone = true;
2148
2149      var body = document.body;
2150      var html = document.documentElement;
2151      var windowHeight = window.innerHeight;
2152      var scrollHeight = body.scrollHeight;
2153
2154      // check compat mode for root element
2155      root = (document.compatMode.indexOf('CSS') >= 0) ? html : body;
2156      activeElement = body;
2157
2158      initTest();
2159
2160      // Checks if this script is running in a frame
2161      if (top != self) {
2162          isFrame = true;
2163      }
2164
2165      /**
2166       * Please duplicate this radar for a Safari fix!
2167       * rdar://22376037
2168       * https://openradar.appspot.com/radar?id=4965070979203072
2169       *
2170       * Only applies to Safari now, Chrome fixed it in v45:
2171       * This fixes a bug where the areas left and right to
2172       * the content does not trigger the onmousewheel event
2173       * on some pages. e.g.: html, body { height: 100% }
2174       */
2175      else if (scrollHeight > windowHeight &&
2176              (body.offsetHeight <= windowHeight ||
2177               html.offsetHeight <= windowHeight)) {
2178
2179          var fullPageElem = document.createElement('div');
2180          fullPageElem.style.cssText = 'position:absolute; z-index:-10000; ' +
2181                                       'top:0; left:0; right:0; height:' +
2182                                        root.scrollHeight + 'px';
2183          document.body.appendChild(fullPageElem);
2184
2185          // DOM changed (throttled) to fix height
2186          var pendingRefresh;
2187          refreshSize = function () {
2188              if (pendingRefresh) return; // could also be: clearTimeout(pendingRefresh);
2189              pendingRefresh = setTimeout(function () {
2190                  if (isExcluded) return; // could be running after cleanup
2191                  fullPageElem.style.height = '0';
2192                  fullPageElem.style.height = root.scrollHeight + 'px';
2193                  pendingRefresh = null;
2194              }, 500); // act rarely to stay fast
2195          };
2196
2197          setTimeout(refreshSize, 10);
2198
2199          addEvent('resize', refreshSize);
2200
2201          // TODO: attributeFilter?
2202          var config = {
2203              attributes: true,
2204              childList: true,
2205              characterData: false
2206              // subtree: true
2207          };
2208
2209          observer = new MutationObserver(refreshSize);
2210          observer.observe(body, config);
2211
2212          if (root.offsetHeight <= windowHeight) {
2213              var clearfix = document.createElement('div');
2214              clearfix.style.clear = 'both';
2215              body.appendChild(clearfix);
2216          }
2217      }
2218
2219      // disable fixed background
2220      if (!options.fixedBackground && !isExcluded) {
2221          body.style.backgroundAttachment = 'scroll';
2222          html.style.backgroundAttachment = 'scroll';
2223      }
2224  }
2225
2226  /**
2227   * Removes event listeners and other traces left on the page.
2228   */
2229  function cleanup() {
2230      observer && observer.disconnect();
2231      removeEvent(wheelEvent, wheel);
2232      removeEvent('mousedown', mousedown);
2233      removeEvent('keydown', keydown);
2234      removeEvent('resize', refreshSize);
2235      removeEvent('load', init);
2236  }
2237
2238
2239  /************************************************
2240   * SCROLLING
2241   ************************************************/
2242
2243  var que = [];
2244  var pending = false;
2245  var lastScroll = Date.now();
2246
2247  /**
2248   * Pushes scroll actions to the scrolling queue.
2249   */
2250  function scrollArray(elem, left, top) {
2251
2252      directionCheck(left, top);
2253
2254      if (options.accelerationMax != 1) {
2255          var now = Date.now();
2256          var elapsed = now - lastScroll;
2257          if (elapsed < options.accelerationDelta) {
2258              var factor = (1 + (50 / elapsed)) / 2;
2259              if (factor > 1) {
2260                  factor = Math.min(factor, options.accelerationMax);
2261                  left *= factor;
2262                  top  *= factor;
2263              }
2264          }
2265          lastScroll = Date.now();
2266      }
2267
2268      // push a scroll command
2269      que.push({
2270          x: left,
2271          y: top,
2272          lastX: (left < 0) ? 0.99 : -0.99,
2273          lastY: (top  < 0) ? 0.99 : -0.99,
2274          start: Date.now()
2275      });
2276
2277      // don't act if there's a pending queue
2278      if (pending) {
2279          return;
2280      }
2281
2282      var scrollWindow = (elem === document.body);
2283
2284      var step = function (time) {
2285
2286          var now = Date.now();
2287          var scrollX = 0;
2288          var scrollY = 0;
2289
2290          for (var i = 0; i < que.length; i++) {
2291
2292              var item = que[i];
2293              var elapsed  = now - item.start;
2294              var finished = (elapsed >= options.animationTime);
2295
2296              // scroll position: [0, 1]
2297              var position = (finished) ? 1 : elapsed / options.animationTime;
2298
2299              // easing [optional]
2300              if (options.pulseAlgorithm) {
2301                  position = pulse(position);
2302              }
2303
2304              // only need the difference
2305              var x = (item.x * position - item.lastX) >> 0;
2306              var y = (item.y * position - item.lastY) >> 0;
2307
2308              // add this to the total scrolling
2309              scrollX += x;
2310              scrollY += y;
2311
2312              // update last values
2313              item.lastX += x;
2314              item.lastY += y;
2315
2316              // delete and step back if it's over
2317              if (finished) {
2318                  que.splice(i, 1); i--;
2319              }
2320          }
2321
2322          // scroll left and top
2323          if (scrollWindow) {
2324              window.scrollBy(scrollX, scrollY);
2325          }
2326          else {
2327              if (scrollX) elem.scrollLeft += scrollX;
2328              if (scrollY) elem.scrollTop  += scrollY;
2329          }
2330
2331          // clean up if there's nothing left to do
2332          if (!left && !top) {
2333              que = [];
2334          }
2335
2336          if (que.length) {
2337              requestFrame(step, elem, (1000 / options.frameRate + 1));
2338          } else {
2339              pending = false;
2340          }
2341      };
2342
2343      // start a new queue of actions
2344      requestFrame(step, elem, 0);
2345      pending = true;
2346  }
2347
2348
2349  /***********************************************
2350   * EVENTS
2351   ***********************************************/
2352
2353  /**
2354   * Mouse wheel handler.
2355   * @param {Object} event
2356   */
2357  function wheel(event) {
2358
2359      if (!initDone) {
2360          init();
2361      }
2362
2363      var target = event.target;
2364      var overflowing = overflowingAncestor(target);
2365
2366      // use default if there's no overflowing
2367      // element or default action is prevented
2368      // or it's a zooming event with CTRL
2369      if (!overflowing || event.defaultPrevented || event.ctrlKey) {
2370          return true;
2371      }
2372
2373      // leave embedded content alone (flash & pdf)
2374      if (isNodeName(activeElement, 'embed') ||
2375         (isNodeName(target, 'embed') && /\.pdf/i.test(target.src)) ||
2376          isNodeName(activeElement, 'object') ||
2377          target.shadowRoot) {
2378          return true;
2379      }
2380
2381      var deltaX = -event.wheelDeltaX || event.deltaX || 0;
2382      var deltaY = -event.wheelDeltaY || event.deltaY || 0;
2383
2384      if (isMac) {
2385          if (event.wheelDeltaX && isDivisible(event.wheelDeltaX, 120)) {
2386              deltaX = -120 * (event.wheelDeltaX / Math.abs(event.wheelDeltaX));
2387          }
2388          if (event.wheelDeltaY && isDivisible(event.wheelDeltaY, 120)) {
2389              deltaY = -120 * (event.wheelDeltaY / Math.abs(event.wheelDeltaY));
2390          }
2391      }
2392
2393      // use wheelDelta if deltaX/Y is not available
2394      if (!deltaX && !deltaY) {
2395          deltaY = -event.wheelDelta || 0;
2396      }
2397
2398      // line based scrolling (Firefox mostly)
2399      if (event.deltaMode === 1) {
2400          deltaX *= 40;
2401          deltaY *= 40;
2402      }
2403
2404      // check if it's a touchpad scroll that should be ignored
2405      if (!options.touchpadSupport && isTouchpad(deltaY)) {
2406          return true;
2407      }
2408
2409      // scale by step size
2410      // delta is 120 most of the time
2411      // synaptics seems to send 1 sometimes
2412      if (Math.abs(deltaX) > 1.2) {
2413          deltaX *= options.stepSize / 120;
2414      }
2415      if (Math.abs(deltaY) > 1.2) {
2416          deltaY *= options.stepSize / 120;
2417      }
2418
2419      scrollArray(overflowing, deltaX, deltaY);
2420
2421      if (Math.abs(deltaX) > 10 && !UNCODE.navigating) {
2422        if (deltaX > 0) {
2423          UNCODE.navigating = true;
2424          window.history.forward();
2425        } else {
2426          UNCODE.navigating = true;
2427          window.history.back();
2428        }
2429      } else event.preventDefault();
2430      scheduleClearCache();
2431  }
2432
2433  /**
2434   * Keydown event handler.
2435   * @param {Object} event
2436   */
2437  function keydown(event) {
2438
2439      var target   = event.target;
2440      var modifier = event.ctrlKey || event.altKey || event.metaKey ||
2441                    (event.shiftKey && event.keyCode !== key.spacebar);
2442
2443      // our own tracked active element could've been removed from the DOM
2444      if (!document.body.contains(activeElement)) {
2445          activeElement = document.activeElement;
2446      }
2447
2448      // do nothing if user is editing text
2449      // or using a modifier key (except shift)
2450      // or in a dropdown
2451      // or inside interactive elements
2452      var inputNodeNames = /^(textarea|select|embed|object)$/i;
2453      var buttonTypes = /^(button|submit|radio|checkbox|file|color|image)$/i;
2454      if ( event.defaultPrevented ||
2455           inputNodeNames.test(target.nodeName) ||
2456           isNodeName(target, 'input') && !buttonTypes.test(target.type) ||
2457           isNodeName(activeElement, 'video') ||
2458           isInsideYoutubeVideo(event) ||
2459           target.isContentEditable ||
2460           modifier ) {
2461        return true;
2462      }
2463
2464      // [spacebar] should trigger button press, leave it alone
2465      if ((isNodeName(target, 'button') ||
2466           isNodeName(target, 'input') && buttonTypes.test(target.type)) &&
2467          event.keyCode === key.spacebar) {
2468        return true;
2469      }
2470
2471      // [arrwow keys] on radio buttons should be left alone
2472      if (isNodeName(target, 'input') && target.type == 'radio' &&
2473          arrowKeys[event.keyCode])  {
2474        return true;
2475      }
2476
2477      var shift, x = 0, y = 0;
2478      var elem = overflowingAncestor(activeElement);
2479      var clientHeight = elem.clientHeight;
2480
2481      if (elem == document.body) {
2482          clientHeight = window.innerHeight;
2483      }
2484
2485      switch (event.keyCode) {
2486          case key.up:
2487              y = -options.arrowScroll;
2488              break;
2489          case key.down:
2490              y = options.arrowScroll;
2491              break;
2492          case key.spacebar: // (+ shift)
2493              shift = event.shiftKey ? 1 : -1;
2494              y = -shift * clientHeight * 0.9;
2495              break;
2496          case key.pageup:
2497              y = -clientHeight * 0.9;
2498              break;
2499          case key.pagedown:
2500              y = clientHeight * 0.9;
2501              break;
2502          case key.home:
2503              y = -elem.scrollTop;
2504              break;
2505          case key.end:
2506              var damt = elem.scrollHeight - elem.scrollTop - clientHeight;
2507              y = (damt > 0) ? damt+10 : 0;
2508              break;
2509          case key.left:
2510              x = -options.arrowScroll;
2511              break;
2512          case key.right:
2513              x = options.arrowScroll;
2514              break;
2515          default:
2516              return true; // a key we don't care about
2517      }
2518
2519      scrollArray(elem, x, y);
2520      event.preventDefault();
2521      scheduleClearCache();
2522  }
2523
2524  /**
2525   * Mousedown event only for updating activeElement
2526   */
2527  function mousedown(event) {
2528      activeElement = event.target;
2529  }
2530
2531
2532  /***********************************************
2533   * OVERFLOW
2534   ***********************************************/
2535
2536  var uniqueID = (function () {
2537      var i = 0;
2538      return function (el) {
2539          return el.uniqueID || (el.uniqueID = i++);
2540      };
2541  })();
2542
2543  var cache = {}; // cleared out after a scrolling session
2544  var clearCacheTimer;
2545
2546  //setInterval(function () { cache = {}; }, 10 * 1000);
2547
2548  function scheduleClearCache() {
2549      clearTimeout(clearCacheTimer);
2550      clearCacheTimer = setInterval(function () { cache = {}; }, 1*1000);
2551  }
2552
2553  function setCache(elems, overflowing) {
2554      for (var i = elems.length; i--;)
2555          cache[uniqueID(elems[i])] = overflowing;
2556      return overflowing;
2557  }
2558
2559  //  (body)                (root)
2560  //         | hidden | visible | scroll |  auto  |
2561  // hidden  |   no   |    no   |   YES  |   YES  |
2562  // visible |   no   |   YES   |   YES  |   YES  |
2563  // scroll  |   no   |   YES   |   YES  |   YES  |
2564  // auto    |   no   |   YES   |   YES  |   YES  |
2565
2566  function overflowingAncestor(el) {
2567      var elems = [];
2568      var body = document.body;
2569      var rootScrollHeight = root.scrollHeight;
2570      do {
2571          var cached = cache[uniqueID(el)];
2572          if (cached) {
2573              return setCache(elems, cached);
2574          }
2575          elems.push(el);
2576          if (rootScrollHeight === el.scrollHeight) {
2577              var topOverflowsNotHidden = overflowNotHidden(root) && overflowNotHidden(body);
2578              var isOverflowCSS = topOverflowsNotHidden || overflowAutoOrScroll(root);
2579              if (isFrame && isContentOverflowing(root) ||
2580                 !isFrame && isOverflowCSS) {
2581                  return setCache(elems, getScrollRoot());
2582              }
2583          } else if (isContentOverflowing(el) && overflowAutoOrScroll(el)) {
2584              return setCache(elems, el);
2585          }
2586      } while (el = el.parentElement);
2587  }
2588
2589  function isContentOverflowing(el) {
2590      return (el.clientHeight + 10 < el.scrollHeight);
2591  }
2592
2593  // typically for <body> and <html>
2594  function overflowNotHidden(el) {
2595      var overflow = getComputedStyle(el, '').getPropertyValue('overflow-y');
2596      return (overflow !== 'hidden');
2597  }
2598
2599  // for all other elements
2600  function overflowAutoOrScroll(el) {
2601      var overflow = getComputedStyle(el, '').getPropertyValue('overflow-y');
2602      return (overflow === 'scroll' || overflow === 'auto');
2603  }
2604
2605
2606  /***********************************************
2607   * HELPERS
2608   ***********************************************/
2609
2610  function addEvent(type, fn) {
2611      window.addEventListener(type, fn, false);
2612  }
2613
2614  function removeEvent(type, fn) {
2615      window.removeEventListener(type, fn, false);
2616  }
2617
2618  function isNodeName(el, tag) {
2619      return (el.nodeName||'').toLowerCase() === tag.toLowerCase();
2620  }
2621
2622  function directionCheck(x, y) {
2623      x = (x > 0) ? 1 : -1;
2624      y = (y > 0) ? 1 : -1;
2625      if (direction.x !== x || direction.y !== y) {
2626          direction.x = x;
2627          direction.y = y;
2628          que = [];
2629          lastScroll = 0;
2630      }
2631  }
2632
2633  var deltaBufferTimer;
2634
2635  if (window.localStorage && localStorage.SS_deltaBuffer) {
2636      deltaBuffer = localStorage.SS_deltaBuffer.split(',');
2637  }
2638
2639  function isTouchpad(deltaY) {
2640      if (!deltaY) return;
2641      if (!deltaBuffer.length) {
2642          deltaBuffer = [deltaY, deltaY, deltaY];
2643      }
2644      deltaY = Math.abs(deltaY);
2645      deltaBuffer.push(deltaY);
2646      deltaBuffer.shift();
2647      clearTimeout(deltaBufferTimer);
2648      deltaBufferTimer = setTimeout(function () {
2649          if (window.localStorage) {
2650              localStorage.SS_deltaBuffer = deltaBuffer.join(',');
2651          }
2652      }, 1000);
2653      return !allDeltasDivisableBy(120) && !allDeltasDivisableBy(100);
2654  }
2655
2656  function isDivisible(n, divisor) {
2657      return (Math.floor(n / divisor) == n / divisor);
2658  }
2659
2660  function allDeltasDivisableBy(divisor) {
2661      return (isDivisible(deltaBuffer[0], divisor) &&
2662              isDivisible(deltaBuffer[1], divisor) &&
2663              isDivisible(deltaBuffer[2], divisor));
2664  }
2665
2666  function isInsideYoutubeVideo(event) {
2667      var elem = event.target;
2668      var isControl = false;
2669      if (document.URL.indexOf ('www.youtube.com/watch') != -1) {
2670          do {
2671              isControl = (elem.classList &&
2672                           elem.classList.contains('html5-video-controls'));
2673              if (isControl) break;
2674          } while (elem = elem.parentNode);
2675      }
2676      return isControl;
2677  }
2678
2679  var requestFrame = (function () {
2680        return (window.requestAnimationFrame       ||
2681                window.webkitRequestAnimationFrame ||
2682                window.mozRequestAnimationFrame    ||
2683                function (callback, element, delay) {
2684                   window.setTimeout(callback, delay || (1000/60));
2685               });
2686  })();
2687
2688  var MutationObserver = (window.MutationObserver ||
2689                          window.WebKitMutationObserver ||
2690                          window.MozMutationObserver);
2691
2692  var getScrollRoot = (function() {
2693    var SCROLL_ROOT;
2694    return function() {
2695      if (!SCROLL_ROOT) {
2696        var dummy = document.createElement('div');
2697        dummy.style.cssText = 'height:10000px;width:1px;';
2698        document.body.appendChild(dummy);
2699        var bodyScrollTop  = document.body.scrollTop;
2700        var docElScrollTop = document.documentElement.scrollTop;
2701        window.scrollBy(0, 3);
2702        if (document.body.scrollTop != bodyScrollTop)
2703          (SCROLL_ROOT = document.body);
2704        else
2705          (SCROLL_ROOT = document.documentElement);
2706        window.scrollBy(0, -3);
2707        document.body.removeChild(dummy);
2708      }
2709      return SCROLL_ROOT;
2710    };
2711  })();
2712
2713
2714  /***********************************************
2715   * PULSE (by Michael Herf)
2716   ***********************************************/
2717
2718  /**
2719   * Viscous fluid with a pulse for part and decay for the rest.
2720   * - Applies a fixed force over an interval (a damped acceleration), and
2721   * - Lets the exponential bleed away the velocity over a longer interval
2722   * - Michael Herf, http://stereopsis.com/stopping/
2723   */
2724  function pulse_(x) {
2725      var val, start, expx;
2726      // test
2727      x = x * options.pulseScale;
2728      if (x < 1) { // acceleartion
2729          val = x - (1 - Math.exp(-x));
2730      } else {     // tail
2731          // the previous animation ended here:
2732          start = Math.exp(-1);
2733          // simple viscous drag
2734          x -= 1;
2735          expx = 1 - Math.exp(-x);
2736          val = start + (expx * (1 - start));
2737      }
2738      return val * options.pulseNormalize;
2739  }
2740
2741  function pulse(x) {
2742      if (x >= 1) return 1;
2743      if (x <= 0) return 0;
2744
2745      if (options.pulseNormalize == 1) {
2746          options.pulseNormalize /= pulse_(1);
2747      }
2748      return pulse_(x);
2749  }
2750
2751
2752  /***********************************************
2753   * FIRST RUN
2754   ***********************************************/
2755
2756  var userAgent = window.navigator.userAgent;
2757  var isEdge    = /Edge/.test(userAgent); // thank you MS
2758  var isChrome  = /chrome/i.test(userAgent) && !isEdge;
2759  var isSafari  = /safari/i.test(userAgent) && !isEdge;
2760  var isMobile  = /mobile/i.test(userAgent);
2761  var isIEWin7  = /Windows NT 6.1/i.test(userAgent) && /rv:11/i.test(userAgent);
2762  var isEnabledForBrowser = (isChrome || isSafari || isIEWin7) && !isMobile;
2763
2764  var wheelEvent;
2765  if ('onwheel' in document.createElement('div'))
2766      wheelEvent = 'wheel';
2767  else if ('onmousewheel' in document.createElement('div'))
2768      wheelEvent = 'mousewheel';
2769
2770  if (wheelEvent && isEnabledForBrowser) {
2771      addEvent(wheelEvent, wheel);
2772      addEvent('mousedown', mousedown);
2773      addEvent('load', init);
2774  }
2775
2776
2777  /***********************************************
2778   * PUBLIC INTERFACE
2779   ***********************************************/
2780
2781  function SmoothScroll(optionsToSet) {
2782      for (var key in optionsToSet)
2783          if (defaultOptions.hasOwnProperty(key))
2784              options[key] = optionsToSet[key];
2785  }
2786  SmoothScroll.destroy = cleanup;
2787
2788  if (window.SmoothScrollOptions) // async API
2789      SmoothScroll(window.SmoothScrollOptions);
2790
2791  if (typeof define === 'function' && define.amd)
2792      define(function() {
2793          return SmoothScroll;
2794      });
2795  else if ('object' == typeof exports)
2796      module.exports = SmoothScroll;
2797  else
2798      window.SmoothScroll = SmoothScroll;
2799
2800  })();
2801};
2802
2803UNCODE.twentytwenty = function() {
2804
2805  if (!$('.twentytwenty-container').length) return;
2806
2807  // jquery.event.move
2808  //
2809  // 1.3.6
2810  //
2811  // Stephen Band
2812  //
2813  // Triggers 'movestart', 'move' and 'moveend' events after
2814  // mousemoves following a mousedown cross a distance threshold,
2815  // similar to the native 'dragstart', 'drag' and 'dragend' events.
2816  // Move events are throttled to animation frames. Move event objects
2817  // have the properties:
2818  //
2819  // pageX:
2820  // pageY:   Page coordinates of pointer.
2821  // startX:
2822  // startY:  Page coordinates of pointer at movestart.
2823  // distX:
2824  // distY:  Distance the pointer has moved since movestart.
2825  // deltaX:
2826  // deltaY:  Distance the finger has moved since last event.
2827  // velocityX:
2828  // velocityY:  Average velocity over last few events.
2829
2830
2831  (function (module) {
2832    if (typeof define === 'function' && define.amd) {
2833      // AMD. Register as an anonymous module.
2834      define(['jquery'], module);
2835    } else {
2836      // Browser globals
2837      module(jQuery);
2838    }
2839  })(function(jQuery, undefined){
2840
2841    var // Number of pixels a pressed pointer travels before movestart
2842        // event is fired.
2843        threshold = 6,
2844
2845        add = jQuery.event.add,
2846
2847        remove = jQuery.event.remove,
2848
2849        // Just sugar, so we can have arguments in the same order as
2850        // add and remove.
2851        trigger = function(node, type, data) {
2852          jQuery.event.trigger(type, data, node);
2853        },
2854
2855        // Shim for requestAnimationFrame, falling back to timer. See:
2856        // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
2857        requestFrame = (function(){
2858          return (
2859            window.requestAnimationFrame ||
2860            window.webkitRequestAnimationFrame ||
2861            window.mozRequestAnimationFrame ||
2862            window.oRequestAnimationFrame ||
2863            window.msRequestAnimationFrame ||
2864            function(fn, element){
2865              return window.setTimeout(function(){
2866                fn();
2867              }, 25);
2868            }
2869          );
2870        })(),
2871
2872        ignoreTags = {
2873          textarea: true,
2874          input: true,
2875          select: true,
2876          button: true
2877        },
2878
2879        mouseevents = {
2880          move: 'mousemove',
2881          cancel: 'mouseup dragstart',
2882          end: 'mouseup'
2883        },
2884
2885        touchevents = {
2886          move: 'touchmove',
2887          cancel: 'touchend',
2888          end: 'touchend'
2889        };
2890
2891
2892    // Constructors
2893
2894    function Timer(fn){
2895      var callback = fn,
2896          active = false,
2897          running = false;
2898
2899      function trigger(time) {
2900        if (active){
2901          callback();
2902          requestFrame(trigger);
2903          running = true;
2904          active = false;
2905        }
2906        else {
2907          running = false;
2908        }
2909      }
2910
2911      this.kick = function(fn) {
2912        active = true;
2913        if (!running) { trigger(); }
2914      };
2915
2916      this.end = function(fn) {
2917        var cb = callback;
2918
2919        if (!fn) { return; }
2920
2921        // If the timer is not running, simply call the end callback.
2922        if (!running) {
2923          fn();
2924        }
2925        // If the timer is running, and has been kicked lately, then
2926        // queue up the current callback and the end callback, otherwise
2927        // just the end callback.
2928        else {
2929          callback = active ?
2930            function(){ cb(); fn(); } :
2931            fn ;
2932
2933          active = true;
2934        }
2935      };
2936    }
2937
2938
2939    // Functions
2940
2941    function returnTrue() {
2942      return true;
2943    }
2944
2945    function returnFalse() {
2946      return false;
2947    }
2948
2949    function preventDefault(e) {
2950      e.preventDefault();
2951    }
2952
2953    function preventIgnoreTags(e) {
2954      // Don't prevent interaction with form elements.
2955      if (ignoreTags[ e.target.tagName.toLowerCase() ]) { return; }
2956
2957      e.preventDefault();
2958    }
2959
2960    function isLeftButton(e) {
2961      // Ignore mousedowns on any button other than the left (or primary)
2962      // mouse button, or when a modifier key is pressed.
2963      return (e.which === 1 && !e.ctrlKey && !e.altKey);
2964    }
2965
2966    function identifiedTouch(touchList, id) {
2967      var i, l;
2968
2969      if (touchList.identifiedTouch) {
2970        return touchList.identifiedTouch(id);
2971      }
2972
2973      // touchList.identifiedTouch() does not exist in
2974      // webkit yet… we must do the search ourselves...
2975
2976      i = -1;
2977      l = touchList.length;
2978
2979      while (++i < l) {
2980        if (touchList[i].identifier === id) {
2981          return touchList[i];
2982        }
2983      }
2984    }
2985
2986    function changedTouch(e, event) {
2987      var touch = identifiedTouch(e.changedTouches, event.identifier);
2988
2989      // This isn't the touch you're looking for.
2990      if (!touch) { return; }
2991
2992      // Chrome Android (at least) includes touches that have not
2993      // changed in e.changedTouches. That's a bit annoying. Check
2994      // that this touch has changed.
2995      if (touch.pageX === event.pageX && touch.pageY === event.pageY) { return; }
2996
2997      return touch;
2998    }
2999
3000
3001    // Handlers that decide when the first movestart is triggered
3002
3003    function mousedown(e){
3004      var data;
3005
3006      if (!isLeftButton(e)) { return; }
3007
3008      data = {
3009        target: e.target,
3010        startX: e.pageX,
3011        startY: e.pageY,
3012        timeStamp: e.timeStamp
3013      };
3014
3015      add(document, mouseevents.move, mousemove, data);
3016      add(document, mouseevents.cancel, mouseend, data);
3017    }
3018
3019    function mousemove(e){
3020      var data = e.data;
3021
3022      checkThreshold(e, data, e, removeMouse);
3023    }
3024
3025    function mouseend(e) {
3026      removeMouse();
3027    }
3028
3029    function removeMouse() {
3030      remove(document, mouseevents.move, mousemove);
3031      remove(document, mouseevents.cancel, mouseend);
3032    }
3033
3034    function touchstart(e) {
3035      var touch, template;
3036
3037      // Don't get in the way of interaction with form elements.
3038      if (ignoreTags[ e.target.tagName.toLowerCase() ]) { return; }
3039
3040      touch = e.changedTouches[0];
3041
3042      // iOS live updates the touch objects whereas Android gives us copies.
3043      // That means we can't trust the touchstart object to stay the same,
3044      // so we must copy the data. This object acts as a template for
3045      // movestart, move and moveend event objects.
3046      template = {
3047        target: touch.target,
3048        startX: touch.pageX,
3049        startY: touch.pageY,
3050        timeStamp: e.timeStamp,
3051        identifier: touch.identifier
3052      };
3053
3054      // Use the touch identifier as a namespace, so that we can later
3055      // remove handlers pertaining only to this touch.
3056      add(document, touchevents.move + '.' + touch.identifier, touchmove, template);
3057      add(document, touchevents.cancel + '.' + touch.identifier, touchend, template);
3058    }
3059
3060    function touchmove(e){
3061      var data = e.data,
3062          touch = changedTouch(e, data);
3063
3064      if (!touch) { return; }
3065
3066      checkThreshold(e, data, touch, removeTouch);
3067    }
3068
3069    function touchend(e) {
3070      var template = e.data,
3071          touch = identifiedTouch(e.changedTouches, template.identifier);
3072
3073      if (!touch) { return; }
3074
3075      removeTouch(template.identifier);
3076    }
3077
3078    function removeTouch(identifier) {
3079      remove(document, '.' + identifier, touchmove);
3080      remove(document, '.' + identifier, touchend);
3081    }
3082
3083
3084    // Logic for deciding when to trigger a movestart.
3085
3086    function checkThreshold(e, template, touch, fn) {
3087      var distX = touch.pageX - template.startX,
3088          distY = touch.pageY - template.startY;
3089
3090      // Do nothing if the threshold has not been crossed.
3091      if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
3092
3093      triggerStart(e, template, touch, distX, distY, fn);
3094    }
3095
3096    function handled() {
3097      // this._handled should return false once, and after return true.
3098      this._handled = returnTrue;
3099      return false;
3100    }
3101
3102    function flagAsHandled(e) {
3103      e._handled();
3104    }
3105
3106    function triggerStart(e, template, touch, distX, distY, fn) {
3107      var node = template.target,
3108          touches, time;
3109
3110      touches = e.targetTouches;
3111      time = e.timeStamp - template.timeStamp;
3112
3113      // Create a movestart object with some special properties that
3114      // are passed only to the movestart handlers.
3115      template.type = 'movestart';
3116      template.distX = distX;
3117      template.distY = distY;
3118      template.deltaX = distX;
3119      template.deltaY = distY;
3120      template.pageX = touch.pageX;
3121      template.pageY = touch.pageY;
3122      template.velocityX = distX / time;
3123      template.velocityY = distY / time;
3124      template.targetTouches = touches;
3125      template.finger = touches ?
3126        touches.length :
3127        1 ;
3128
3129      // The _handled method is fired to tell the default movestart
3130      // handler that one of the move events is bound.
3131      template._handled = handled;
3132
3133      // Pass the touchmove event so it can be prevented if or when
3134      // movestart is handled.
3135      template._preventTouchmoveDefault = function() {
3136        e.preventDefault();
3137      };
3138
3139      // Trigger the movestart event.
3140      trigger(template.target, template);
3141
3142      // Unbind handlers that tracked the touch or mouse up till now.
3143      fn(template.identifier);
3144    }
3145
3146
3147    // Handlers that control what happens following a movestart
3148
3149    function activeMousemove(e) {
3150      var timer = e.data.timer;
3151
3152      e.data.touch = e;
3153      e.data.timeStamp = e.timeStamp;
3154      timer.kick();
3155    }
3156
3157    function activeMouseend(e) {
3158      var event = e.data.event,
3159          timer = e.data.timer;
3160
3161      removeActiveMouse();
3162
3163      endEvent(event, timer, function() {
3164        // Unbind the click suppressor, waiting until after mouseup
3165        // has been handled.
3166        setTimeout(function(){
3167          remove(event.target, 'click', returnFalse);
3168        }, 0);
3169      });
3170    }
3171
3172    function removeActiveMouse(event) {
3173      remove(document, mouseevents.move, activeMousemove);
3174      remove(document, mouseevents.end, activeMouseend);
3175    }
3176
3177    function activeTouchmove(e) {
3178      var event = e.data.event,
3179          timer = e.data.timer,
3180          touch = changedTouch(e, event);
3181
3182      if (!touch) { return; }
3183
3184      // Stop the interface from gesturing
3185      e.preventDefault();
3186
3187      event.targetTouches = e.targetTouches;
3188      e.data.touch = touch;
3189      e.data.timeStamp = e.timeStamp;
3190      timer.kick();
3191    }
3192
3193    function activeTouchend(e) {
3194      var event = e.data.event,
3195          timer = e.data.timer,
3196          touch = identifiedTouch(e.changedTouches, event.identifier);
3197
3198      // This isn't the touch you're looking for.
3199      if (!touch) { return; }
3200
3201      removeActiveTouch(event);
3202      endEvent(event, timer);
3203    }
3204
3205    function removeActiveTouch(event) {
3206      remove(document, '.' + event.identifier, activeTouchmove);
3207      remove(document, '.' + event.identifier, activeTouchend);
3208    }
3209
3210
3211    // Logic for triggering move and moveend events
3212
3213    function updateEvent(event, touch, timeStamp, timer) {
3214      var time = timeStamp - event.timeStamp;
3215
3216      event.type = 'move';
3217      event.distX =  touch.pageX - event.startX;
3218      event.distY =  touch.pageY - event.startY;
3219      event.deltaX = touch.pageX - event.pageX;
3220      event.deltaY = touch.pageY - event.pageY;
3221
3222      // Average the velocity of the last few events using a decay
3223      // curve to even out spurious jumps in values.
3224      event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
3225      event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
3226      event.pageX =  touch.pageX;
3227      event.pageY =  touch.pageY;
3228    }
3229
3230    function endEvent(event, timer, fn) {
3231      timer.end(function(){
3232        event.type = 'moveend';
3233
3234        trigger(event.target, event);
3235
3236        return fn && fn();
3237      });
3238    }
3239
3240
3241    // jQuery special event definition
3242
3243    function setup(data, namespaces, eventHandle) {
3244      // Stop the node from being dragged
3245      //add(this, 'dragstart.move drag.move', preventDefault);
3246
3247      // Prevent text selection and touch interface scrolling
3248      //add(this, 'mousedown.move', preventIgnoreTags);
3249
3250      // Tell movestart default handler that we've handled this
3251      add(this, 'movestart.move', flagAsHandled);
3252
3253      // Don't bind to the DOM. For speed.
3254      return true;
3255    }
3256
3257    function teardown(namespaces) {
3258      remove(this, 'dragstart drag', preventDefault);
3259      remove(this, 'mousedown touchstart', preventIgnoreTags);
3260      remove(this, 'movestart', flagAsHandled);
3261
3262      // Don't bind to the DOM. For speed.
3263      return true;
3264    }
3265
3266    function addMethod(handleObj) {
3267      // We're not interested in preventing defaults for handlers that
3268      // come from internal move or moveend bindings
3269      if (handleObj.namespace === "move" || handleObj.namespace === "moveend") {
3270        return;
3271      }
3272
3273      // Stop the node from being dragged
3274      add(this, 'dragstart.' + handleObj.guid + ' drag.' + handleObj.guid, preventDefault, undefined, handleObj.selector);
3275
3276      // Prevent text selection and touch interface scrolling
3277      add(this, 'mousedown.' + handleObj.guid, preventIgnoreTags, undefined, handleObj.selector);
3278    }
3279
3280    function removeMethod(handleObj) {
3281      if (handleObj.namespace === "move" || handleObj.namespace === "moveend") {
3282        return;
3283      }
3284
3285      remove(this, 'dragstart.' + handleObj.guid + ' drag.' + handleObj.guid);
3286      remove(this, 'mousedown.' + handleObj.guid);
3287    }
3288
3289    jQuery.event.special.movestart = {
3290      setup: setup,
3291      teardown: teardown,
3292      add: addMethod,
3293      remove: removeMethod,
3294
3295      _default: function(e) {
3296        var event, data;
3297
3298        // If no move events were bound to any ancestors of this
3299        // target, high tail it out of here.
3300        if (!e._handled()) { return; }
3301
3302        function update(time) {
3303          updateEvent(event, data.touch, data.timeStamp);
3304          trigger(e.target, event);
3305        }
3306
3307        event = {
3308          target: e.target,
3309          startX: e.startX,
3310          startY: e.startY,
3311          pageX: e.pageX,
3312          pageY: e.pageY,
3313          distX: e.distX,
3314          distY: e.distY,
3315          deltaX: e.deltaX,
3316          deltaY: e.deltaY,
3317          velocityX: e.velocityX,
3318          velocityY: e.velocityY,
3319          timeStamp: e.timeStamp,
3320          identifier: e.identifier,
3321          targetTouches: e.targetTouches,
3322          finger: e.finger
3323        };
3324
3325        data = {
3326          event: event,
3327          timer: new Timer(update),
3328          touch: undefined,
3329          timeStamp: undefined
3330        };
3331
3332        if (e.identifier === undefined) {
3333          // We're dealing with a mouse
3334          // Stop clicks from propagating during a move
3335          add(e.target, 'click', returnFalse);
3336          add(document, mouseevents.move, activeMousemove, data);
3337          add(document, mouseevents.end, activeMouseend, data);
3338        }
3339        else {
3340          // We're dealing with a touch. Stop touchmove doing
3341          // anything defaulty.
3342          e._preventTouchmoveDefault();
3343          add(document, touchevents.move + '.' + e.identifier, activeTouchmove, data);
3344          add(document, touchevents.end + '.' + e.identifier, activeTouchend, data);
3345        }
3346      }
3347    };
3348
3349    jQuery.event.special.move = {
3350      setup: function() {
3351        // Bind a noop to movestart. Why? It's the movestart
3352        // setup that decides whether other move events are fired.
3353        add(this, 'movestart.move', jQuery.noop);
3354      },
3355
3356      teardown: function() {
3357        remove(this, 'movestart.move', jQuery.noop);
3358      }
3359    };
3360
3361    jQuery.event.special.moveend = {
3362      setup: function() {
3363        // Bind a noop to movestart. Why? It's the movestart
3364        // setup that decides whether other move events are fired.
3365        add(this, 'movestart.moveend', jQuery.noop);
3366      },
3367
3368      teardown: function() {
3369        remove(this, 'movestart.moveend', jQuery.noop);
3370      }
3371    };
3372
3373    add(document, 'mousedown.move', mousedown);
3374    add(document, 'touchstart.move', touchstart);
3375
3376    // Make jQuery copy touch event properties over to the jQuery event
3377    // object, if they are not already listed. But only do the ones we
3378    // really need. IE7/8 do not have Array#indexOf(), but nor do they
3379    // have touch events, so let's assume we can ignore them.
3380    if (typeof Array.prototype.indexOf === 'function') {
3381      (function(jQuery, undefined){
3382        var props = ["changedTouches", "targetTouches"],
3383            l = props.length;
3384
3385        while (l--) {
3386          if (jQuery.event.props.indexOf(props[l]) === -1) {
3387            jQuery.event.props.push(props[l]);
3388          }
3389        }
3390      })(jQuery);
3391    };
3392  });
3393
3394  $.fn.twentytwenty = function(options) {
3395    var options = $.extend({default_offset_pct: 0.5, orientation: 'horizontal'}, options);
3396    return this.each(function() {
3397
3398      var sliderPct = options.default_offset_pct;
3399      var container = $(this);
3400      var sliderOrientation = options.orientation;
3401      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
3402      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
3403
3404      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
3405      container.append("<div class='twentytwenty-overlay'></div>");
3406      var beforeImg = container.find("img:first");
3407      var afterImg = container.find("img:last");
3408      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
3409      var slider = container.find(".twentytwenty-handle");
3410      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
3411      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
3412      container.addClass("twentytwenty-container");
3413      beforeImg.addClass("twentytwenty-before");
3414      afterImg.addClass("twentytwenty-after");
3415
3416      var overlay = container.find(".twentytwenty-overlay");
3417      overlay.append("<div class='twentytwenty-before-label'></div>");
3418      overlay.append("<div class='twentytwenty-after-label'></div>");
3419
3420      var calcOffset = function(dimensionPct) {
3421        var w = beforeImg.width();
3422        var h = beforeImg.height();
3423        return {
3424          w: w+"px",
3425          h: h+"px",
3426          cw: (dimensionPct*w)+"px",
3427          ch: (dimensionPct*h)+"px"
3428        };
3429      };
3430
3431      var adjustContainer = function(offset) {
3432      	if (sliderOrientation === 'vertical') {
3433      	  beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
3434      	}
3435      	else {
3436          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
3437    	}
3438        container.css("height", offset.h);
3439      };
3440
3441      var adjustSlider = function(pct) {
3442        var offset = calcOffset(pct);
3443        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
3444        adjustContainer(offset);
3445      }
3446
3447      $(window).on("resize.twentytwenty", function(e) {
3448        adjustSlider(sliderPct);
3449      });
3450
3451      var offsetX = 0,
3452      offsetY = 0,
3453      imgWidth = 0,
3454      imgHeight = 0;
3455
3456      slider.on("movestart", function(e) {
3457        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
3458          e.preventDefault();
3459        }
3460        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
3461          e.preventDefault();
3462        }
3463        container.addClass("active");
3464        offsetX = container.offset().left;
3465        offsetY = container.offset().top;
3466        imgWidth = beforeImg.width();
3467        imgHeight = beforeImg.height();
3468      });
3469
3470      slider.on("moveend", function(e) {
3471        container.removeClass("active");
3472      });
3473
3474      slider.on("move", function(e) {
3475        if (container.hasClass("active")) {
3476          sliderPct = (sliderOrientation === 'vertical') ? (e.pageY-offsetY)/imgHeight : (e.pageX-offsetX)/imgWidth;
3477          if (sliderPct < 0) {
3478            sliderPct = 0;
3479          }
3480          if (sliderPct > 1) {
3481            sliderPct = 1;
3482          }
3483          adjustSlider(sliderPct);
3484        }
3485      });
3486
3487      container.find("img").on("mousedown", function(event) {
3488        event.preventDefault();
3489      });
3490
3491      $(window).trigger("resize.twentytwenty");
3492    });
3493  };
3494
3495  $('.twentytwenty-container').twentytwenty();
3496
3497}
3498
3499	UNCODE.init = function() {
3500		UNCODE.utils();
3501		UNCODE.menuSystem();
3502		UNCODE.okvideo();
3503		UNCODE.tapHover();
3504		UNCODE.isotopeLayout();
3505		UNCODE.lightbox();
3506		UNCODE.backVideo();
3507		UNCODE.carousel($('body'));
3508		UNCODE.animations();
3509		UNCODE.stickyElements();
3510		UNCODE.twentytwenty();
3511		UNCODE.disableHoverScroll();
3512		UNCODE.onePage(UNCODE.isMobile);
3513		if ($('body.smooth-scroller').length) {
3514			setTimeout(function(){
3515				UNCODE.scrollEnance();
3516			}, 300);
3517		}
3518	}
3519	UNCODE.init();
3520})(jQuery);
3521

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.