PageSourceSearch

https://www.aizawa-group.co.jp/home/wp-content/themes/uncode/library/js/init.js?ver=1647322733

js aizawa-group.co.jp collected 2026-10-02 18:32:15 UTC 93,172 bytes, 2,736 lines download raw bytes

1/**
2 * Load utils - BEGIN
3 */
4/*
5 CSS Browser Selector 1.0
6 Originally written by Rafael Lima (http://rafael.adm.br)
7 http://rafael.adm.br/css_browser_selector
8 License: http://creativecommons.org/licenses/by/2.5/
9
10 Co-maintained by:
11 https://github.com/ridjohansen/css_browser_selector
12 https://github.com/wbruno/css_browser_selector
13 */
14
15"use strict";
16
17var uaInfo = {
18	ua: '',
19	is: function(t) {
20		return RegExp(t, "i").test(uaInfo.ua);
21	},
22	version: function(p, n) {
23		n = n.replace(".", "_");
24		var i = n.indexOf('_'),
25			ver = "";
26		while (i > 0) {
27			ver += " " + p + n.substring(0, i);
28			i = n.indexOf('_', i + 1);
29		}
30		ver += " " + p + n;
31		return ver;
32	},
33	getBrowser: function() {
34		var g = 'gecko',
35			w = 'webkit',
36			c = 'chrome',
37			f = 'firefox',
38			s = 'safari',
39			o = 'opera',
40			a = 'android',
41			bb = 'blackberry',
42			dv = 'device_',
43			ua = uaInfo.ua,
44			is = uaInfo.is;
45		return [
46			(!(/opera|webtv/i.test(ua)) && /msie\s(\d+)/.test(ua)) ? ('ie ie' + (/trident\/4\.0/.test(ua) ? '8' : RegExp.$1)) : is('firefox/') ? g + " " + f + (/firefox\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua) ? ' ' + f + RegExp.$2 + ' ' + f + RegExp.$2 + "_" + RegExp.$4 : '') : is('gecko/') ? g : is('opera') ? o + (/version\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua) ? ' ' + o + RegExp.$2 + ' ' + o + RegExp.$2 + "_" + RegExp.$4 : (/opera(\s|\/)(\d+)\.(\d+)/.test(ua) ? ' ' + o + RegExp.$2 + " " + o + RegExp.$2 + "_" + RegExp.$3 : '')) : is('konqueror') ? 'konqueror' : is('blackberry') ? (bb + (/Version\/(\d+)(\.(\d+)+)/i.test(ua) ? " " + bb + RegExp.$1 + " " + bb + RegExp.$1 + RegExp.$2.replace('.', '_') : (/Blackberry ?(([0-9]+)([a-z]?))[\/|;]/gi.test(ua) ? ' ' + bb + RegExp.$2 + (RegExp.$3 ? ' ' + bb + RegExp.$2 + RegExp.$3 : '') : ''))) // blackberry
47			: is('android') ? (a + (/Version\/(\d+)(\.(\d+))+/i.test(ua) ? " " + a + RegExp.$1 + " " + a + RegExp.$1 + RegExp.$2.replace('.', '_') : '') + (/Android (.+); (.+) Build/i.test(ua) ? ' ' + dv + ((RegExp.$2).replace(/ /g, "_")).replace(/-/g, "_") : '')) //android
48			: is('chrome') ? w + ' ' + c + (/chrome\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua) ? ' ' + c + RegExp.$2 + ((RegExp.$4 > 0) ? ' ' + c + RegExp.$2 + "_" + RegExp.$4 : '') : '') : is('iron') ? w + ' iron' : is('applewebkit/') ? (w + ' ' + s + (/version\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua) ? ' ' + s + RegExp.$2 + " " + s + RegExp.$2 + RegExp.$3.replace('.', '_') : (/ Safari\/(\d+)/i.test(ua) ? ((RegExp.$1 == "419" || RegExp.$1 == "417" || RegExp.$1 == "416" || RegExp.$1 == "412") ? ' ' + s + '2_0' : RegExp.$1 == "312" ? ' ' + s + '1_3' : RegExp.$1 == "125" ? ' ' + s + '1_2' : RegExp.$1 == "85" ? ' ' + s + '1_0' : '') : ''))) //applewebkit
49			: is('mozilla/') ? g : ''
50		];
51	},
52	getPlatform: function() {
53		var ua = uaInfo.ua,
54			version = uaInfo.version,
55			is = uaInfo.is;
56		return [
57			is('j2me') ? 'j2me' : is('ipad|ipod|iphone') ? (
58				(/CPU( iPhone)? OS (\d+[_|\.]\d+([_|\.]\d+)*)/i.test(ua) ? 'ios' + version('ios', RegExp.$2) : '') + ' ' + (/(ip(ad|od|hone))/gi.test(ua) ? RegExp.$1 : "")) //'iphone'
59			//:is('ipod')?'ipod'
60			//:is('ipad')?'ipad'
61			: is('playbook') ? 'playbook' : is('kindle|silk') ? 'kindle' : is('playbook') ? 'playbook' : is('mac') ? 'mac' + (/mac os x ((\d+)[.|_](\d+))/.test(ua) ? (' mac' + (RegExp.$2) + ' mac' + (RegExp.$1).replace('.', "_")) : '') : is('win') ? 'win' + (is('windows nt 6.2') ? ' win8' : is('windows nt 6.1') ? ' win7' : is('windows nt 6.0') ? ' vista' : is('windows nt 5.2') || is('windows nt 5.1') ? ' win_xp' : is('windows nt 5.0') ? ' win_2k' : is('windows nt 4.0') || is('WinNT4.0') ? ' win_nt' : '') : is('freebsd') ? 'freebsd' : is('x11|linux') ? 'linux' : ''
62		];
63	},
64	getMobile: function() {
65		var is = uaInfo.is;
66		return [
67			is("android|mobi|mobile|j2me|iphone|ipod|ipad|blackberry|playbook|kindle|silk") ? 'mobile' : ''
68		];
69	},
70	getIpadApp: function() {
71		var is = uaInfo.is;
72		return [
73			(is('ipad|iphone|ipod') && !is('safari')) ? 'ipad_app' : ''
74		];
75	},
76	getLang: function() {
77		var ua = uaInfo.ua;
78		return [/[; |\[](([a-z]{2})(\-[a-z]{2})?)[)|;|\]]/i.test(ua) ? ('lang_' + RegExp.$2).replace("-", "_") + (RegExp.$3 != '' ? (' ' + 'lang_' + RegExp.$1).replace("-", "_") : '') : ''];
79	}
80}
81var screenInfo = {
82	width: (window.outerWidth || document.documentElement.clientWidth) - 15,
83	height: window.outerHeight || document.documentElement.clientHeight,
84	screens: [0, 768, 980, 1200],
85	screenSize: function() {
86		screenInfo.width = (window.outerWidth || document.documentElement.clientWidth) - 15;
87		screenInfo.height = window.outerHeight || document.documentElement.clientHeight;
88		var screens = screenInfo.screens,
89			i = screens.length,
90			arr = [],
91			maxw,
92			minw;
93		while (i--) {
94			if (screenInfo.width >= screens[i]) {
95				if (i) {
96					arr.push("minw_" + screens[(i)]);
97				}
98				if (i <= 2) {
99					arr.push("maxw_" + (screens[(i) + 1] - 1));
100				}
101				break;
102			}
103		}
104		return arr;
105	},
106	getOrientation: function() {
107		return screenInfo.width < screenInfo.height ? ["orientation_portrait"] : ["orientation_landscape"];
108	},
109	getInfo: function() {
110		var arr = [];
111		arr = arr.concat(screenInfo.screenSize());
112		arr = arr.concat(screenInfo.getOrientation());
113		return arr;
114	},
115	getPixelRatio: function() {
116		var arr = [],
117			pixelRatio = window.devicePixelRatio ? window.devicePixelRatio : 1;
118		if (pixelRatio > 1) {
119			arr.push('retina_' + parseInt(pixelRatio) + 'x');
120			arr.push('hidpi');
121		} else {
122			arr.push('no-hidpi');
123		}
124		return arr;
125	}
126}
127var dataUriInfo = {
128	data: new Image(),
129	div: document.createElement("div"),
130	isIeLessThan9: false,
131	getImg: function() {
132		dataUriInfo.data.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
133		dataUriInfo.div.innerHTML = "<!--[if lt IE 9]><i></i><![endif]-->";
134		dataUriInfo.isIeLessThan9 = dataUriInfo.div.getElementsByTagName("i").length == 1;
135		return dataUriInfo.data;
136	},
137	checkSupport: function() {
138		if (dataUriInfo.data.width != 1 || dataUriInfo.data.height != 1 || dataUriInfo.isIeLessThan9) {
139			return ["no-datauri"];
140		} else {
141			return ["datauri"];
142		}
143	}
144}
145
146function css_browser_selector(u, ns) {
147		var html = document.documentElement,
148			b = []
149		ns = ns ? ns : "";
150		/* ua */
151		uaInfo.ua = u.toLowerCase();
152		var browser = uaInfo.getBrowser();
153		if (browser == 'gecko') browser = (!(window.ActiveXObject) && "ActiveXObject" in window) ? 'ie ie11' : browser;
154		var pattTouch = /no-touch/g;
155		if (pattTouch.test(html.className)) b = b.concat('no-touch');
156		else b = b.concat('touch');
157		var pattAdmin = /admin-mode/g;
158		if (pattAdmin.test(html.className)) b = b.concat('admin-mode');
159		b = b.concat(browser);
160		b = b.concat(uaInfo.getPlatform());
161		b = b.concat(uaInfo.getMobile());
162		b = b.concat(uaInfo.getIpadApp());
163		b = b.concat(uaInfo.getLang());
164		/* js */
165		b = b.concat(['js']);
166		/* pixel ratio */
167		b = b.concat(screenInfo.getPixelRatio());
168		/* screen */
169		b = b.concat(screenInfo.getInfo());
170		var updateScreen = function() {
171			html.className = html.className.replace(/ ?orientation_\w+/g, "").replace(/ [min|max|cl]+[w|h]_\d+/g, "");
172			html.className = html.className + ' ' + screenInfo.getInfo().join(' ');
173		}
174		window.addEventListener('resize', updateScreen);
175		window.addEventListener('orientationchange', updateScreen);
176		/* dataURI */
177		var data = dataUriInfo.getImg();
178		data.onload = data.onerror = function() {
179				html.className += ' ' + dataUriInfo.checkSupport().join(' ');
180			}
181			/* removendo itens invalidos do array */
182		b = b.filter(function(e) {
183			return e;
184		});
185		/* prefixo do namespace */
186		b[0] = ns ? ns + b[0] : b[0];
187		html.className = b.join(' ' + ns);
188		return html.className;
189	}
190	// define css_browser_selector_ns before loading this script to assign a namespace
191var css_browser_selector_ns = css_browser_selector_ns || "";
192// init
193css_browser_selector(navigator.userAgent, css_browser_selector_ns);
194/**
195 * skip-link-focus-fix.js
196 *
197 * Helps with accessibility for keyboard only users.
198 *
199 * Learn more: https://github.com/Automattic/_s/pull/136
200 */
201(function() {
202	var is_webkit = navigator.userAgent.toLowerCase().indexOf('webkit') > -1,
203		is_opera = navigator.userAgent.toLowerCase().indexOf('opera') > -1,
204		is_ie = navigator.userAgent.toLowerCase().indexOf('msie') > -1;
205	if ((is_webkit || is_opera || is_ie) && document.getElementById && window.addEventListener) {
206		window.addEventListener('hashchange', function() {
207			var id = location.hash.substring(1),
208				element;
209			if (!(/^[A-z0-9_-]+$/.test(id))) {
210				return;
211			}
212			element = document.getElementById(id);
213			if (element) {
214				if (!(/^(?:a|select|input|button|textarea)$/i.test(element.tagName))) {
215					element.tabIndex = -1;
216				}
217				element.focus();
218			}
219		}, false);
220	}
221})();
222// Polyfill for creating CustomEvents on IE9/10/11
223// code pulled from:
224// https://github.com/d4tocchini/customevent-polyfill
225// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill
226try {
227	new CustomEvent("test");
228} catch (e) {
229	var CustomEvent = function(event, params) {
230		var evt;
231		params = params || {
232			bubbles: false,
233			cancelable: false,
234			detail: undefined
235		};
236		evt = document.createEvent("CustomEvent");
237		evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
238		return evt;
239	};
240	CustomEvent.prototype = window.Event.prototype;
241	window.CustomEvent = CustomEvent; // expose definition to window
242}
243// Evento - v1.0.0
244// by Erik Royall <[email protected]> (http://erikroyall.github.io)
245// Dual licensed under MIT and GPL
246// Array.prototype.indexOf shim
247// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
248Array.prototype.indexOf || (Array.prototype.indexOf = function(n) {
249	"use strict";
250	if (null == this) throw new TypeError;
251	var t, e, o = Object(this),
252		r = o.length >>> 0;
253	if (0 === r) return -1;
254	if (t = 0, arguments.length > 1 && (t = Number(arguments[1]), t != t ? t = 0 : 0 != t && 1 / 0 != t && t != -1 / 0 && (t = (t > 0 || -1) * Math.floor(Math.abs(t)))), t >= r) return -1;
255	for (e = t >= 0 ? t : Math.max(r - Math.abs(t), 0); r > e; e++)
256		if (e in o && o[e] === n) return e;
257	return -1
258});
259var evento = function(n) {
260	var t, e, o, r = n,
261		i = r.document,
262		f = {};
263	return t = function() {
264		return "function" == typeof i.addEventListener ? function(n, t, e) {
265			n.addEventListener(t, e, !1), f[n] = f[n] || {}, f[n][t] = f[n][t] || [], f[n][t].push(e)
266		} : "function" == typeof i.attachEvent ? function(n, t, e) {
267			n.attachEvent(t, e), f[n] = f[n] || {}, f[n][t] = f[n][t] || [], f[n][t].push(e)
268		} : function(n, t, e) {
269			n["on" + t] = e, f[n] = f[n] || {}, f[n][t] = f[n][t] || [], f[n][t].push(e)
270		}
271	}(), e = function() {
272		return "function" == typeof i.removeEventListener ? function(n, t, e) {
273			n.removeEventListener(t, e, !1), Helio.each(f[n][t], function(o) {
274				o === e && (f[n] = f[n] || {}, f[n][t] = f[n][t] || [], f[n][t][f[n][t].indexOf(o)] = void 0)
275			})
276		} : "function" == typeof i.detachEvent ? function(n, t, e) {
277			n.detachEvent(t, e), Helio.each(f[n][t], function(o) {
278				o === e && (f[n] = f[n] || {}, f[n][t] = f[n][t] || [], f[n][t][f[n][t].indexOf(o)] = void 0)
279			})
280		} : function(n, t, e) {
281			n["on" + t] = void 0, Helio.each(f[n][t], function(o) {
282				o === e && (f[n] = f[n] || {}, f[n][t] = f[n][t] || [], f[n][t][f[n][t].indexOf(o)] = void 0)
283			})
284		}
285	}(), o = function(n, t) {
286		f[n] = f[n] || {}, f[n][t] = f[n][t] || [];
287		for (var e = 0, o = f[n][t].length; o > e; e += 1) f[n][t][e]()
288	}, {
289		add: t,
290		remove: e,
291		trigger: o,
292		_handlers: f
293	}
294}(this);
295/*
296 * OKVideo by OKFocus v2.3.2
297 * http://okfoc.us
298 *
299 * Copyright 2014, OKFocus
300 * Licensed under the MIT license.
301 *
302 */
303var player, OKEvents, options, videoWidth, videoHeight, YTplayers, youtubePlayers = new Array();
304// youtube player ready
305function onYouTubeIframeAPIReady() {
306	YTplayers = new Array();
307	jQuery('.no-touch .uncode-video-container.video').each(function() {
308		var playerY;
309		if (jQuery(this).attr('data-provider') == 'youtube') {
310			var id = jQuery(this).attr('data-id');
311			options = jQuery(window).data('okoptions-' + id);
312			playerY = new YT.Player('okplayer-' + id, {
313				videoId: options.video ? options.video.id : null,
314				playerVars: {
315					'autohide': 1,
316					'autoplay': 0, //options.autoplay,
317					'disablekb': options.keyControls,
318					'cc_load_policy': options.captions,
319					'controls': options.controls,
320					'enablejsapi': 1,
321					'fs': 0,
322					'modestbranding': 1,
323					'origin': window.location.origin || (window.location.protocol + '//' + window.location.hostname),
324					'iv_load_policy': options.annotations,
325					'loop': options.loop,
326					'showinfo': 0,
327					'rel': 0,
328					'wmode': 'opaque',
329					'hd': options.hd
330				},
331				events: {
332					'onReady': OKEvents.yt.ready,
333					'onStateChange': OKEvents.yt.onStateChange,
334					'onError': OKEvents.yt.error
335				}
336			});
337			YTplayers[id] = playerY;
338		}
339	});
340}
341// vimeo player ready
342function vimeoPlayerReady(id) {
343	options = jQuery(window).data('okoptions-' + id);
344	var jIframe = options.jobject,
345	iframe = jIframe[0];
346	jIframe.attr('src', jIframe.data('src'));
347	var playerV = $f(iframe);
348	// hide player until Vimeo hides controls...
349	playerV.addEvent('ready', function(e) {
350		OKEvents.v.onReady(iframe);
351		var carouselContainer = jQuery(iframe).closest('.owl-carousel');
352		if (carouselContainer.length) {
353			UNCODE.owlPlayVideo(carouselContainer);
354		}
355		// "Do not try to add listeners or call functions before receiving this event."
356		if (OKEvents.utils.isMobile()) {
357			// mobile devices cannot listen for play event
358			OKEvents.v.onPlay(playerV);
359		} else {
360			playerV.addEvent('play', OKEvents.v.onPlay(playerV));
361			playerV.addEvent('pause', OKEvents.v.onPause);
362			playerV.addEvent('finish', OKEvents.v.onFinish);
363		}
364		if (options.time != null) {
365			playerV.api('seekTo', (options.time).replace('t=', ''));
366		}
367
368		playerV.api('play');
369		jQuery(iframe).css({
370			visibility: 'visible',
371			opacity: 1
372		});
373
374	});
375}
376OKEvents = {
377	yt: {
378		ready: function(event) {
379			var iframe = jQuery(event.target)[0].c,
380				id = jQuery(iframe).closest('.uncode-video-container').attr('data-id');
381			youtubePlayers[id] = event.target;
382			event.target.setVolume(options.volume);
383			if (options.autoplay === 1) {
384				if (options.playlist.list) {
385					player.loadPlaylist(options.playlist.list, options.playlist.index, options.playlist.startSeconds, options.playlist.suggestedQuality);
386				} else {
387					var inCarousel = jQuery(iframe).closest('.owl-item');
388					if (!inCarousel.length || (inCarousel.length && inCarousel.hasClass('active'))) {
389						event.target.playVideo();
390					} else {
391						event.target.pauseVideo();
392					}
393				}
394			}
395			OKEvents.utils.isFunction(options.onReady) && options.onReady(event.target);
396		},
397		onStateChange: function(event) {
398			switch (event.data) {
399				case -1:
400					OKEvents.utils.isFunction(options.unstarted) && options.unstarted();
401					break;
402				case 0:
403					OKEvents.utils.isFunction(options.onFinished) && options.onFinished();
404					options.loop && event.target.playVideo();
405					break;
406				case 1:
407					OKEvents.utils.isFunction(options.onPlay) && options.onPlay();
408					jQuery(event.target.c).closest('.uncode-video-container').css('opacity', '1');
409					break;
410				case 2:
411					OKEvents.utils.isFunction(options.onPause) && options.onPause();
412					break;
413				case 3:
414					OKEvents.utils.isFunction(options.buffering) && options.buffering();
415					break;
416				case 5:
417					OKEvents.utils.isFunction(options.cued) && options.cued();
418					break;
419				default:
420					throw "OKVideo: received invalid data from YT player.";
421			}
422		},
423		error: function(event) {
424			throw event;
425		}
426	},
427	v: {
428		onReady: function(target) {
429			OKEvents.utils.isFunction(options.onReady) && options.onReady(target);
430		},
431		onPlay: function(player) {
432			if (!OKEvents.utils.isMobile()) player.api('setVolume', options.volume);
433			OKEvents.utils.isFunction(options.onPlay) && options.onPlay();
434			jQuery(player.element).closest('.uncode-video-container').css('opacity', '1');
435		},
436		onPause: function() {
437			OKEvents.utils.isFunction(options.onPause) && options.onPause();
438		},
439		onFinish: function() {
440			OKEvents.utils.isFunction(options.onFinish) && options.onFinish();
441		}
442	},
443	utils: {
444		isFunction: function(func) {
445			if (typeof func === 'function') {
446				return true;
447			} else {
448				return false;
449			}
450		},
451		isMobile: function() {
452			if (navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/)) {
453				return true;
454			} else {
455				return false;
456			}
457		}
458	}
459};
460// DOM class helper
461(function(window) {
462	'use strict';
463	// class helper functions from bonzo https://github.com/ded/bonzo
464	function classReg(className) {
465			return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
466		}
467		// classList support for class management
468		// altho to be fair, the api sucks because it won't accept multiple classes at once
469	var hasClass, addClass, removeClass;
470	if ('classList' in document.documentElement) {
471		hasClass = function(elem, c) {
472			if (elem !== null) return elem.classList.contains(c);
473		};
474		addClass = function(elem, c) {
475			if (elem !== null) elem.classList.add(c);
476		};
477		removeClass = function(elem, c) {
478			if (elem !== null) elem.classList.remove(c);
479		};
480	} else {
481		hasClass = function(elem, c) {
482			if (elem !== null) return classReg(c).test(elem.className);
483		};
484		addClass = function(elem, c) {
485			if (!hasClass(elem, c)) {
486				if (elem !== null) elem.className = elem.className + ' ' + c;
487			}
488		};
489		removeClass = function(elem, c) {
490			if (elem !== null) elem.className = elem.className.replace(classReg(c), ' ');
491		};
492	}
493
494	function toggleClass(elem, c) {
495		var fn = hasClass(elem, c) ? removeClass : addClass;
496		fn(elem, c);
497	}
498	var classie = {
499		// full names
500		hasClass: hasClass,
501		addClass: addClass,
502		removeClass: removeClass,
503		toggleClass: toggleClass,
504		// short names
505		has: hasClass,
506		add: addClass,
507		remove: removeClass,
508		toggle: toggleClass
509	};
510	// transport
511	if (typeof define === 'function' && define.amd) {
512		// AMD
513		define(classie);
514	} else {
515		// browser global
516		window.classie = classie;
517	}
518})(window);
519/* From Modernizr */
520function whichTransitionEvent() {
521		var t;
522		var el = document.createElement('fakeelement');
523		var transitions = {
524			'transition': 'transitionend',
525			'OTransition': 'oTransitionEnd',
526			'MozTransition': 'transitionend',
527			'WebkitTransition': 'webkitTransitionEnd'
528		}
529		for (t in transitions) {
530			if (el.style[t] !== undefined) {
531				return transitions[t];
532			}
533		}
534	}
535/**
536 * Load utils - END
537 */
538
539/**
540 * Start main js
541 */
542(function(window, undefined) {
543	'use strict';
544	// Init variables
545	var bodyTop,
546		scrollbarWidth,
547		noScroll = false,
548		boxEvent = new CustomEvent('boxResized'),
549		boxWidth = 0,
550		boxLeft = 0,
551		parallaxRows,
552		parallaxCols,
553		parallaxHeaders,
554		headerWithOpacity,
555		speedDivider = 0.25,
556		pageHeader,
557		masthead,
558		menuwrapper,
559		menuhide,
560		menusticky,
561		menuHeight = 0,
562		mainmenu,
563		secmenu,
564		secmenuHeight = 0,
565		transmenuHeight = 0,
566		header,
567		transmenuel,
568		logo,
569		logoel,
570		logolink,
571		logoMinScale,
572		lastScrollValue = 0,
573		deltaY,
574		overHtml = true,
575		wwidth = window.innerWidth || document.documentElement.clientWidth,
576		wheight = window.innerHeight || document.documentElement.clientHeight,
577		boxWrapper,
578		docheight = 0,
579		isMobile = classie.hasClass(document.documentElement, 'touch') ? true : false,
580		isIE = classie.hasClass(document.documentElement, 'ie') || classie.hasClass(document.documentElement, 'opera12') ? true : false,
581		isFF = classie.hasClass(document.documentElement, 'firefox') ? true : false,
582		transitionEvent = whichTransitionEvent(),
583		footerScroller = false,
584		mediaQuery = 959,
585		mediaQueryMobile = 569,
586		resizeTimer,
587	initBox = function() {
588			if (!isMobile && scrollbarWidth == undefined) {
589				// Create the measurement node
590				var scrollDiv = document.createElement("div");
591				scrollDiv.className = "scrollbar-measure";
592				var dombody = document.body;
593				if (dombody != null) {
594					dombody.appendChild(scrollDiv);
595					// Get the scrollbar width
596					scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
597					// Delete the DIV
598					dombody.removeChild(scrollDiv);
599				}
600			}
601			if (!isMobile) {
602				forEachElement('.box-container', function(el, i) {
603					if (!classie.hasClass(el, 'limit-width')) {
604						var elWidth = outerWidth(el),
605							newWidth = 12 * Math.ceil((wwidth - scrollbarWidth) / 12);
606						boxWidth = newWidth;
607						boxLeft = Math.ceil(((newWidth) - wwidth) / 2);
608						el.style.width = boxWidth + 'px';
609						el.style.marginLeft = '-' + (boxLeft + (scrollbarWidth / 2)) + 'px';
610						if (mainmenu != undefined && mainmenu[0] != undefined) {
611							mainmenu[0].style.width = newWidth + 'px';
612						}
613					}
614				});
615			}
616		},
617		fixMenuHeight = function() {
618			if (!classie.hasClass(document.body, 'vmenu')) noScroll = true;
619			menuwrapper = document.querySelectorAll(".menu-wrapper");
620			masthead = document.getElementById("masthead");
621			menuhide = document.querySelector('#masthead .menu-hide');
622			menusticky = document.querySelectorAll('.menu-sticky');
623			transmenuel = document.querySelectorAll('.menu-transparent:not(.vmenu-container)');
624			var menuItemsButton = document.querySelectorAll('.menu-item-button .menu-btn-table');
625			logo = document.querySelector('#main-logo');
626			if (logo != undefined) logolink = (logo.firstElementChild || logo.firstChild);
627			if (logolink != undefined) logoMinScale = logolink.getAttribute("data-minheight");
628			logoel = document.querySelectorAll('.menu-shrink .logo-container');
629			mainmenu = (wwidth > mediaQuery) ? document.querySelectorAll('.menu-primary .menu-container') : document.querySelectorAll('.menu-primary .menu-container, .vmenu-container .logo-container');
630			secmenu = document.querySelectorAll('.menu-secondary');
631			calculateMenuHeight(true);
632			for (var k = 0;
632 k < menuItemsButton.length; k++) {
633				var a_item = menuItemsButton[k].parentNode,
634					buttonHeight = outerHeight(menuItemsButton[k]);
635				a_item.style.height = buttonHeight + 'px';
636			}
637		},
638		calculateMenuHeight = function(first) {
639			menuHeight = transmenuHeight = secmenuHeight = 0;
640			for (var i = 0; i < mainmenu.length; i++) {
641				menuHeight = menuHeight + outerHeight(mainmenu[i]);
642				if (isIE && first) {
643					getDivChildren(mainmenu[i], '.menu-horizontal-inner', function(innerMenu, i) {
644						innerMenu.style.height = menuHeight + 'px';
645					});
646				}
647
648				if (classie.hasClass(mainmenu[i].parentNode, 'menu-transparent')) {
649					transmenuHeight += menuHeight;
650				}
651			}
652			for (var j = 0; j < secmenu.length; j++) {
653				secmenuHeight = outerHeight(secmenu[j]);
654			}
655			menuHeight += secmenuHeight;
656			if (masthead != undefined && first) {
657				if (wwidth > mediaQuery) masthead.parentNode.style.height = menuHeight + 'px';
658			}
659			if (classie.hasClass(document.documentElement, 'admin-mode')) menuHeight += 32;
660			UNCODE.menuHeight = menuHeight;
661		},
662		initHeader = function() {
663			UNCODE.adaptive();
664			headerHeight('.header-wrapper');
665			parallaxHeaders = document.querySelectorAll('.header-parallax > .header-bg-wrapper > .header-bg');
666			header = document.querySelectorAll('.header-wrapper.header-uncode-block, .header-wrapper.header-revslider, .header-basic .header-wrapper, .header-uncode-block > .row-container:first-child > .row > .row-inner > .col-lg-12 > .uncol, .header-uncode-block .uncode-slider .owl-carousel > .row-container:first-child .col-lg-12 .uncoltable');
667			headerWithOpacity = document.querySelectorAll('.header-scroll-opacity');
668			pageHeader = document.getElementById("page-header");
669			if (pageHeader != undefined) {
670				var backs = pageHeader.querySelectorAll('.header-bg'),
671					backsCarousel = pageHeader.querySelectorAll('.header-uncode-block .background-inner'),
672					uri_pattern = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig;
673				if (backs.length == 0 && backsCarousel.length == 0) {
674					pageHeader.setAttribute('data-imgready', 'true');
675				} else {
676					if (backsCarousel.length) {
677						for (var j = 0; j < backsCarousel.length; j++) {
678							if (j == 0) {
679								if (!!backsCarousel[j].style.backgroundImage && backsCarousel[j].style.backgroundImage !== void 0) {
680									var url = (backsCarousel[j].style.backgroundImage).match(uri_pattern),
681										image = new Image();
682									image.onload = function() {
683										pageHeader.setAttribute('data-imgready', 'true');
684									};
685									image.src = url[0];
686								} else {
687									pageHeader.setAttribute('data-imgready', 'true');
688								}
689							}
690						}
691					} else {
692						for (var i = 0; i < backs.length; i++) {
693							if (i == 0) {
694								if (!!backs[i].style.backgroundImage && backs[i].style.backgroundImage !== void 0) {
695									var url = (backs[i].style.backgroundImage).match(uri_pattern),
696										image = new Image();
697									image.onload = function() {
698										pageHeader.setAttribute('data-imgready', 'true');
699									};
700									image.src = url[0];
701								} else {
702									pageHeader.setAttribute('data-imgready', 'true');
703								}
704							}
705						}
706					}
707				}
708			}
709			if (masthead != undefined) {
710				if (header.length) {
711					classie.addClass(menuwrapper[0], 'with-header');
712					for (var j = 0; j < header.length; j++) {
713						var headerel = header[j],
714							closestStyle = getClosest(headerel, 'style-light');
715						if (closestStyle != null && classie.hasClass(closestStyle, 'style-light')) switchColorsMenu(0, 'light');
716						else if (getClosest(headerel, 'style-dark') != null) switchColorsMenu(0, 'dark');
717						else {
718							if (masthead.style.opacity !== 1) masthead.style.opacity = 1;
719						}
720						if (classie.hasClass(masthead, 'menu-transparent')) {
721							masthead.parentNode.style.height = '0px';
722							if (wwidth > mediaQuery) {
723								if (classie.hasClass(masthead, 'menu-add-padding')) {
724									var headerBlock = getClosest(headerel, 'header-uncode-block');
725									if (headerBlock != null) {
726										var innerRows = headerel.querySelectorAll('.column_parent > .uncol > .uncoltable > .uncell > .uncont, .uncode-slider .column_child > .uncol > .uncoltable > .uncell > .uncont');
727										for (var k = 0; k < innerRows.length; k++) {
728											if (innerRows[k] != undefined) {
729												innerRows[k].style.paddingTop = transmenuHeight + 'px';
730											}
731										}
732									} else {
733										getDivChildren(headerel, '.header-content', function(headerContent, i) {
734											headerContent.style.paddingTop = transmenuHeight + 'px';
735										});
736									}
737								}
738							}
739						}
740					}
741				} else {
742					classie.addClass(menuwrapper[0], 'no-header');
743					classie.removeClass(masthead, 'menu-transparent');
744					transmenuHeight = 0;
745				}
746			}
747			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
748			if (wwidth > mediaQuery) scrollFunction();
749			showHideScrollup(bodyTop);
750		},
751		initRow = function(currentRow) {
752			UNCODE.adaptive();
753			var el = currentRow.parentNode.parentNode.getAttribute("data-parent") == 'true' ? currentRow.parentNode : currentRow.parentNode.parentNode,
754				rowParent = el.parentNode,
755				rowInner = currentRow.parentNode,
756				percentHeight = el.getAttribute("data-height-ratio"),
757				minHeight = el.getAttribute("data-minheight"),
758				calculateHeight,
759				calculatePadding = 0,
760				isHeader = false,
761				isFirst = false,
762				uri_pattern = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig;
763
764			/** Add class to the row when contains responsive column size */
765			getDivChildren(el.parentNode, '.column_parent, .column_child', function(obj, i, total) {
766				if ((obj.className).indexOf("col-md-") > - 1) classie.addClass(obj.parentNode, 'cols-md-responsive');
767			});
768
769			setRowHeight(el);
770
771			var elements = 0;
772			getDivChildren(el, '.row-internal .background-inner', function(obj, i, total) {
773				elements++;
774				if (i == 0) {
775					if (!!obj.style.backgroundImage && obj.style.backgroundImage !== void 0) {
776						var url = (obj.style.backgroundImage).match(uri_pattern),
777							image = new Image();
778						image.onload = function() {
779							el.setAttribute('data-imgready', 'true');
780							el.dispatchEvent(new CustomEvent('imgLoaded'));
781						};
782						image.src = url[0];
783					} else {
784						el.setAttribute('data-imgready', 'true');
785						el.dispatchEvent(new CustomEvent('imgLoaded'));
786					}
787				}
788			});
789			if (elements == 0) {
790				el.setAttribute('data-imgready', 'true');
791			}
792
793			/** init parallax is not mobile */
794			if (!UNCODE.isMobile) {
795				parallaxRows = el.parentNode.parentNode.querySelectorAll('.with-parallax > .row-background > .background-wrapper');
796				parallaxCols = el.querySelectorAll('.with-parallax > .column-background > .background-wrapper');
797				bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
798				parallaxRowCol(bodyTop);
799			}
800		},
801		setRowHeight = function(container, forced) {
802			var currentTallest = 0,
803				percentHeight = 0,
804				minHeight = 0,
805				el,
806				child,
807				hasSubCols = false;
808			if (container.length == undefined) {
809				container = [container];
810			}
811			// Loop for each container element to match their heights
812			for (var i = 0; i < container.length; i++) {
813				var el = container[i],
814					$row = el,
815					totalHeight = 0,
816					colsArray = new Array(),
817					calculatePadding = 0,
818					$rowParent = $row.parentNode,
819					isHeader = false,
820					isFirst = false;
821				$row.oversized = false;
822				percentHeight = el.getAttribute("data-height-ratio");
823				minHeight = el.getAttribute("data-minheight");
824				child = (el.firstElementChild || el.firstChild);
825				var childHeight = outerHeight(child);
826				/** window height without header **/
827				if (!!percentHeight || !!minHeight || forced || (isIE && classie.hasClass(el, 'unequal'))) {
828					child.style.height = '';
829					if (!!percentHeight) {
830						if (percentHeight == 'full') {
831							currentTallest = parseInt(wheight);
832						} else {
833							currentTallest = parseInt((wheight * percentHeight) / 100);
834						}
835					} else {
836						currentTallest = el.clientHeight;
837					}
838
839					if (!!minHeight) {
840						if (currentTallest < minHeight || currentTallest == undefined) currentTallest = parseInt(minHeight);
841					}
842
843					var computedStyleRow = getComputedStyle(el),
844						computedStyleRowParent = getComputedStyle($rowParent);
845					calculatePadding -= (parseFloat(computedStyleRow.paddingTop) + parseFloat(computedStyleRowParent.paddingTop));
846					calculatePadding -= (parseFloat(computedStyleRow.paddingBottom) + parseFloat(computedStyleRowParent.paddingBottom));
847					if (getClosest(el, 'header-uncode-block') != null) {
848						el.setAttribute('data-row-header', 'true');
849						isHeader = true;
850					} else {
851						if (pageHeader == null) {
852							var prevRow = $rowParent.previousSibling;
853							if (prevRow != null && prevRow.innerText == 'UNCODE.initHeader();') {
854								isFirst = true;
855							}
856						}
857					}
858
859					if (classie.hasClass(el, 'row-slider')) {
860						percentHeight = el.getAttribute("data-height-ratio");
861						minHeight = el.getAttribute("data-minheight");
862						if (percentHeight == 'full') {
863							currentTallest = parseInt(wheight);
864						} else {
865							currentTallest = parseInt((wheight * percentHeight) / 100);
866						}
867
868						if (isHeader || isFirst) {
869							if (wwidth > mediaQuery) currentTallest -= menuHeight - transmenuHeight;
870							else currentTallest -= menuHeight - secmenuHeight;
871							currentTallest += calculatePadding;
872						} else {
873							if (wwidth > mediaQuery) currentTallest += calculatePadding;
874							else currentTallest = 'auto';
875						}
876						getDivChildren(el, '.owl-carousel', function(owl, i) {
877							owl.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px');
878							if (isIE) {
879								getDivChildren(owl, '.owl-stage', function(owlIn, i) {
880									owlIn.style.height = (currentTallest == 'auto' ? '100%' : currentTallest + 'px');
881								});
882							}
883						});
884						continue;
885					} else {
886						if (isHeader || isFirst) {
887							if (wwidth > mediaQuery) currentTallest -= menuHeight - transmenuHeight;
888							else currentTallest -= menuHeight - secmenuHeight;
889							currentTallest += calculatePadding;
890						} else {
891							if (wwidth > mediaQuery) currentTallest += calculatePadding;
892							else currentTallest = 'auto';
893						}
894					}
895					if (!!minHeight) {
896						if (currentTallest < minHeight || currentTallest == 'auto') currentTallest = parseInt(minHeight);
897					}
898
899					child.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px');
900				} else {
901					currentTallest = 0;
902				}
903
904				if (wwidth > mediaQuery) {
905
906					getDivChildren(el, '.column_parent', function(col, i, total) {
907						var $col = col,
908							$colHeight = 0,
909							$colDiff = 0,
910							$colPercDiff = 100;
911						$col.oversized = false;
912						$col.forceHeight = currentTallest;
913						currentTallest = child.clientHeight;
914						if ((isHeader || isFirst) && currentTallest != 'auto') currentTallest -= transmenuHeight;
915						var getFirstCol = null;
916						var getMargin = 0;
917						getDivChildren(col, '.row-child', function(obj, i, total) {
918							var $colChild = obj,
919								$colInner = $colChild.children[0],
920								$colParent = $colChild.parentNode,
921								$uncont = $colParent.parentNode;
922							if (i == 0 && total > 1) getFirstCol = $colInner;
923							$colChild.oversized = false;
924							percentHeight = $colChild.getAttribute("data-height");
925							minHeight = $colChild.getAttribute("data-minheight");
926							if (percentHeight != null || minHeight != null) {
927								$colInner.style.height = '';
928								$colParent.style.height = 'auto';
929								$uncont.style.height = '100%';
930								$colChild.removeAttribute("style");
931								var newHeight = (percentHeight != null) ? Math.ceil((currentTallest) * (percentHeight / 100)) : parseInt(minHeight);
932								var computedStyleCol = getComputedStyle($colParent);
933								parseFloat(computedStyleCol.marginTop);
934								getMargin = parseFloat(computedStyleCol.marginTop);
935								newHeight -= (getMargin);
936								if (currentTallest > newHeight) {
937									var getColHeight = outerHeight($colChild);
938									if (getColHeight > newHeight) {
939										$colHeight += getColHeight;
940										$colDiff += getColHeight;
941										$colPercDiff -= (percentHeight != null) ? percentHeight : 0;
942										$colChild.oversized = true;
943										$col.oversized = true;
944										$row.oversized = true;
945									} else {
946										$colHeight += newHeight;
947										$colInner.style.height = newHeight + 'px';
948									}
949								}
950							} else {
951								$colHeight += outerHeight($colChild);
952							}
953						});
954						if (getFirstCol != null) {
955							getFirstCol.style.height = (parseFloat(getFirstCol.style.height) - getMargin) + 'px';
956						}
957						colsArray.push({
958							colHeight: $colHeight,
959							colDiv: $col
960						});
961						$col.colDiff = $colDiff;
962						$col.colPercDiff = $colPercDiff;
963					});
964
965					if ($row.oversized) {
966						child.style.height = '';
967						colsArray.sort(function(a, b) {
968							if (a.colHeight < b.colHeight) return 1;
969							if (a.colHeight > b.colHeight) return -1;
970							return 0;
971						});
972						var $totalHeight = 0;
973						colsArray.forEach(function(col) {
974							var $col = col.colDiv,
975								$colHeight = col.colHeight;
976							getDivChildren($col, '.row-child', function(obj, i, total) {
977								var $colChild = obj,
978									$colInner = $colChild.children[0],
979									percentHeight = $colChild.getAttribute("data-height"),
980									$colParent = $colChild.parentNode,
981									$uncont = $colParent.parentNode,
982									newHeight;
983								$colHeight = $col.forceHeight - $col.colDiff;
984								if (percentHeight != null) {
985									if ($colHeight > 0) {
986										if ($col.oversized) {
987											if (!$colChild.oversized) {
988												newHeight = Math.ceil(($colHeight) * (percentHeight / $col.colPercDiff));
989												if (i == total - 1 && total > 1) {
990													$uncont.style.height = 'auto';
991													$colChild.style.display = 'none';
992													newHeight = outerHeight($col.parentNode) - outerHeight($uncont);
993													$uncont.style.height = '100%';
994													$colChild.style.display = 'table';
995												}
996												if (newHeight == 0) newHeight = Math.ceil(($col.forceHeight) * (percentHeight / 100));
997												$colInner.style.height = newHeight + 'px';
998											}
999										} else {
1000											if ($totalHeight == 0) newHeight = Math.ceil(($colHeight) * (percentHeight / $col.colPercDiff));
1001											else {
1002												newHeight = Math.ceil(($totalHeight) * (percentHeight / $col.colPercDiff));
1003											}
1004											if (i == total - 1 && total > 1) {
1005												$uncont.style.height = 'auto';
1006												$colChild.style.display = 'none';
1007												newHeight = outerHeight($col.parentNode) - outerHeight($uncont);
1008												$uncont.style.height = '100%';
1009												$colChild.style.display = 'table';
1010											}
1011											$colInner.style.height = newHeight + 'px';
1012										}
1013									} else {
1014										if ($colChild.oversized) {
1015											if ($totalHeight == 0) newHeight = Math.ceil(($colHeight) * (percentHeight / $col.colPercDiff));
1016											else {
1017												if ($col.colPercDiff == 0) $col.colPercDiff = 100;
1018												newHeight = Math.ceil(($totalHeight) * (percentHeight / $col.colPercDiff));
1019											}
1020											if (i == total - 1 && total > 1) {
1021												$uncont.style.height = 'auto';
1022												$colChild.style.display = 'none';
1023												newHeight = outerHeight($col.parentNode) - outerHeight($uncont);
1024												$uncont.style.height = '100%';
1025												$colChild.style.display = 'table';
1026											}
1027											$colInner.style.height = newHeight + 'px';
1028										}
1029									}
1030								}
1031							});
1032							var uncell = $col.getElementsByClassName('uncell');
1033							if (uncell[0] != undefined && $totalHeight == 0) $totalHeight = outerHeight(uncell[0]);
1034						});
1035					}
1036					if (isFF) {
1037						getDivChildren(el, '.uncoltable', function(col, i, total) {
1038							if (col.style.minHeight != '') {
1039								col.style.height = '';
1040							}
1041						});
1042					}
1043					getDivChildren(el, '.row-child > .row-inner', function(obj, k, total) {
1044						if (obj.style.height == '') {
1045							if (wwidth > mediaQueryMobile) {
1046								var getStyle = (window.getComputedStyle((obj.parentNode), null)),
1047								getInnerHeight = (parseInt(getStyle.height) - parseInt(getStyle.paddingTop) - parseInt(getStyle.paddingBottom));
1048								obj.style.height = getInnerHeight + 1 + 'px';
1049								obj.style.marginBottom = '-1px';
1050							}
1051						}
1052					});
1053				} else {
1054					if (isFF) {
1055						getDivChildren(el, '.uncoltable', function(col, i, total) {
1056							if (col.style.minHeight != '') {
1057								col.style.height = '';
1058								col.style.height = outerHeight(col.parentNode) + 'px';
1059							}
1060						});
1061					}
1062					if (isIE && (wwidth > mediaQueryMobile)) {
1063						if (child.style.height == 'auto') {
1064							child.style.height = outerHeight(child) + 'px';
1065						}
1066					}
1067				}
1068				if (isFF) {
1069					var sliderColumnFix = document.querySelector('.uncode-slider .row-inner > .column_child:only-child');
1070					if (sliderColumnFix != null) {
1071						if (wwidth > mediaQuery) {
1072							sliderColumnFix.style.setProperty("height", "");
1073						} else {
1074							sliderColumnFix.style.setProperty("height", "");
1075							sliderColumnFix.style.setProperty("height", outerHeight(sliderColumnFix.parentNode) + "px", "important");
1076						}
1077					}
1078				}
1079			};
1080		},
1081		headerHeight = function(container) {
1082			forEachElement(container, function(el, i) {
1083				var getHeight = el.getAttribute("data-height"),
1084					newHeight = ((wheight * getHeight) / 100);
1085				if (getHeight != 'fixed' && newHeight != 0) {
1086					if (wwidth > mediaQuery) newHeight -= menuHeight - transmenuHeight;
1087					else newHeight -= menuHeight - secmenuHeight;
1088					el.style.height = newHeight + 'px';
1089				}
1090			});
1091			if (masthead != undefined) {
1092				if (header != undefined && header.length) {
1093					if (classie.hasClass(masthead, 'menu-transparent')) {
1094						if (wwidth > mediaQuery) {
1095							if (classie.hasClass(masthead, 'menu-add-padding')) {
1096								for (var j = 0; j < header.length; j++) {
1097									var headerel = header[j];
1098									var headerBlock = getClosest(headerel, 'header-uncode-block');
1099									if (headerBlock != null) {
1100										var innerRows = headerel.querySelectorAll('.column_parent > .uncol > .uncoltable > .uncell > .uncont, .uncode-slider .column_child > .uncol > .uncoltable > .uncell > .uncont');
1101										for (var k = 0; k < innerRows.length; k++) {
1102											if (innerRows[k] != undefined) {
1103												innerRows[k].style.paddingTop = transmenuHeight + 'px';
1104											}
1105										}
1106									} else {
1107										getDivChildren(headerel, '.header-content', function(headerContent, i) {
1108											headerContent.style.paddingTop = transmenuHeight + 'px';
1109										});
1110									}
1111								}
1112							}
1113						}
1114					}
1115				}
1116			}
1117		},
1118		initVideoComponent = function(container, classTarget) {
1119			getDivChildren(container, classTarget, function(el, i) {
1120				var width = outerWidth(el),
1121					pWidth, // player width, to be defined
1122					height = outerHeight(el),
1123					pHeight, // player height, tbd
1124					$tubularPlayer = (el.getElementsByTagName('iframe').length == 1) ? el.getElementsByTagName('iframe') : el.getElementsByTagName('video'),
1125					ratio = (el.getAttribute("data-ratio") != null) ? Number(el.getAttribute("data-ratio")) : null,
1126					heightOffset = 80,
1127					widthOffset = heightOffset * ratio;
1128				// when screen aspect ratio differs from video, video must center and underlay one dimension
1129				if ($tubularPlayer[0] != undefined) {
1130					if (width / ratio < height) { // if new video height < window height (gap underneath)
1131						pWidth = Math.ceil((height + heightOffset) * ratio); // get new player width
1132						$tubularPlayer[0].style.width = pWidth + widthOffset + 'px';
1133						$tubularPlayer[0].style.height = height + heightOffset + 'px';
1134						$tubularPlayer[0].style.left = ((width - pWidth) / 2) - (widthOffset / 2) + 'px';
1135						$tubularPlayer[0].style.top = '-' + (heightOffset / 2) + 'px';
1136						$tubularPlayer[0].style.position = 'absolute';
1137					} else { // new video width < window width (gap to right)
1138						pHeight = Math.ceil(width / ratio); // get new player height
1139						$tubularPlayer[0].style.width = width + widthOffset + 'px';
1140						$tubularPlayer[0].style.height = pHeight + heightOffset + 'px';
1141						$tubularPlayer[0].style.left = '-' + (widthOffset / 2) + 'px';
1142						$tubularPlayer[0].style.top = ((height - pHeight) / 2) - (heightOffset / 2) + 'px';
1143						$tubularPlayer[0].style.position = 'absolute';
1144					}
1145				}
1146			});
1147		},
1148		init_overlay = function() {
1149			var triggerButton,
1150			closeButton;
1151			function toggleOverlay(btn) {
1152				if (!classie.hasClass(triggerButton, 'search-icon')) {
1153					if (classie.hasClass(triggerButton, 'close')) {
1154						classie.removeClass(closeButton, 'close');
1155						classie.removeClass(triggerButton, 'close');
1156						classie.addClass(closeButton, 'closing');
1157						classie.addClass(triggerButton, 'closing');
1158						setTimeout(function() {
1159							classie.removeClass(closeButton, 'closing');
1160							classie.removeClass(triggerButton, 'closing');
1161							triggerButton.style.opacity = 1;
1162							closeButton.style.opacity = 0;
1163						}, 800);
1164					} else {
1165						var getBtnRect = triggerButton.getBoundingClientRect();
1166						closeButton.parentNode.setAttribute('style', 'top:' + getBtnRect.top + 'px; left:'+getBtnRect.left + 'px !important');
1167						classie.addClass(closeButton, 'close');
1168						classie.addClass(triggerButton, 'close');
1169						triggerButton.style.opacity = 0;
1170						closeButton.style.opacity = 1;
1171					}
1172				}
1173				Array.prototype.forEach.call(document.querySelectorAll('div.overlay'), function(overlay) {
1174					if (btn.getAttribute('data-area') == overlay.getAttribute('data-area')) {
1175						var container = document.querySelector('div.' + btn.getAttribute('data-container')),
1176							inputField = overlay.querySelector('.search-field');
1177						if (classie.has(overlay, 'open')) {
1178							classie.remove(overlay, 'open');
1179							classie.remove(container, 'overlay-open');
1180							classie.add(overlay, 'close');
1181							classie.remove(overlay, 'open-items');
1182							var onEndTransitionFn = function(ev) {
1183								if (transitionEvent) {
1184									if (ev.propertyName !== 'visibility') return;
1185									this.removeEventListener(transitionEvent, onEndTransitionFn);
1186								}
1187								classie.remove(overlay, 'close');
1188							};
1189							if (transitionEvent) {
1190								overlay.addEventListener(transitionEvent, onEndTransitionFn);
1191							} else {
1192								onEndTransitionFn();
1193							}
1194						} else if (!classie.has(overlay, 'close')) {
1195							classie.add(overlay, 'open');
1196							classie.add(container, 'overlay-open');
1197							if (jQuery('body.menu-overlay').length == 0) {
1198								setTimeout(function() {
1199									inputField.focus();
1200								}, 1000);
1201							}
1202							setTimeout(function() {
1203								if (classie.has(overlay, 'overlay-sequential')) classie.add(overlay, 'open-items');
1204							}, 800);
1205						}
1206					}
1207				});
1208			}
1209			Array.prototype.forEach.call(document.querySelectorAll('.trigger-overlay'), function(triggerBttn) {
1210				triggerButton = triggerBttn;
1211				triggerBttn.addEventListener('click', function(e) {
1212					if (wwidth > mediaQuery) toggleOverlay(triggerBttn);
1213					e.preventDefault();
1214					return false;
1215				}, false);
1216			});
1217			Array.prototype.forEach.call(document.querySelectorAll('.overlay-close'), function(closeBttn) {
1218				closeButton = closeBttn;
1219				closeBttn.addEventListener('click', function(e) {
1220					if (wwidth > mediaQuery) toggleOverlay(closeBttn);
1221					e.preventDefault();
1222					return false;
1223				}, false);
1224			});
1225		},
1226		/** All scrolling functions - Begin */
1227		/** Shrink menu **/
1228		shrinkMenu = function(bodyTop) {
1229			var logoShrink,
1230				offset = 100;
1231			for (var i = 0; i < logoel.length; i++) {
1232				if (((secmenuHeight == 0) ? bodyTop > menuHeight : bodyTop > secmenuHeight + offset) && !classie.hasClass(logoel[i], 'shrinked')) {
1233					classie.addClass(logoel[i], 'shrinked');
1234					if (logoMinScale != undefined) {
1235						logoShrink = logolink.children;
1236						Array.prototype.forEach.call(logoShrink, function(singleLogo) {
1237							singleLogo.style.height = logoMinScale + 'px';
1238							singleLogo.style.lineHeight = logoMinScale + 'px';
1239							if (classie.hasClass(singleLogo, 'text-logo')) singleLogo.style.fontSize = logoMinScale + 'px';
1240						});
1241					}
1242				} else if (((secmenuHeight == 0) ? bodyTop == 0 : bodyTop <= secmenuHeight + offset) && classie.hasClass(logoel[i], 'shrinked')) {
1243					classie.removeClass(logoel[i], 'shrinked');
1244					if (logoMinScale != undefined) {
1245						logoShrink = logolink.children;
1246						Array.prototype.forEach.call(logoShrink, function(singleLogo) {
1247							singleLogo.style.height = singleLogo.getAttribute('data-maxheight') + 'px';
1248							singleLogo.style.lineHeight = singleLogo.getAttribute('data-maxheight') + 'px';
1249							if (classie.hasClass(singleLogo, 'text-logo')) singleLogo.style.fontSize = singleLogo.getAttribute('data-maxheight') + 'px';
1250						});
1251					}
1252				}
1253			}
1254		},
1255		/** Switch colors menu **/
1256		switchColorsMenu = function(bodyTop, style) {
1257			for (var i = 0; i < transmenuel.length; i++) {
1258				if (masthead.style.opacity !== 1) masthead.style.opacity = 1;
1259				if ((secmenuHeight == 0) ? bodyTop > menuHeight / 2 : bodyTop > secmenuHeight) {
1260					if (classie.hasClass(masthead, 'style-dark-original')) {
1261						logo.className = logo.className.replace("style-light", "style-dark");
1262					}
1263					if (classie.hasClass(masthead, 'style-light-original')) {
1264						logo.className = logo.className.replace("style-dark", "style-light");
1265					}
1266					if (style != undefined) {
1267						if (style == 'dark') {
1268							classie.removeClass(transmenuel[i], 'style-light-override');
1269						}
1270						if (style == 'light') {
1271							classie.removeClass(transmenuel[i], 'style-dark-override');
1272						}
1273						classie.addClass(transmenuel[i], 'style-' + style + '-override');
1274					}
1275				} else {
1276					if (style != undefined) {
1277						if (style == 'dark') {
1278							classie.removeClass(transmenuel[i], 'style-light-override');
1279						}
1280						if (style == 'light') {
1281							classie.removeClass(transmenuel[i], 'style-dark-override');
1282						}
1283						classie.addClass(transmenuel[i], 'style-' + style + '-override');
1284					}
1285				}
1286			}
1287			if (pageHeader != undefined) {
1288				if (style != undefined) {
1289					if (classie.hasClass(pageHeader, 'header-style-dark')) {
1290						classie.removeClass(pageHeader, 'header-style-dark');
1291					}
1292					if (classie.hasClass(pageHeader, 'header-style-light')) {
1293						classie.removeClass(pageHeader, 'header-style-light');
1294					}
1295					classie.addClass(pageHeader, 'header-style-' + style);
1296				}
1297			}
1298		},
1299		/** Parallax Rows **/
1300		parallaxRowCol = function(bodyTop) {
1301			var value;
1302			if (typeof parallaxRows == 'object') {
1303				for (var i = 0; i < parallaxRows.length; i++) {
1304					var section = parallaxRows[i].parentNode,
1305						thisHeight = outerHeight(parallaxRows[i]),
1306						sectionHeight = outerHeight(section),
1307						offSetTop = bodyTop + (section != null ? (classie.hasClass(section.parentNode.parentNode, 'owl-carousel') ? section.parentNode.parentNode.getBoundingClientRect().top : section.getBoundingClientRect().top) : 0),
1308						offSetPosition = wheight + bodyTop - offSetTop;
1309					if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) {
1310						value = ((offSetPosition - wheight) * speedDivider);
1311						if (Math.abs(value) < (thisHeight - sectionHeight)) {
1312							translateElement(parallaxRows[i], value);
1313						} else {
1314							translateElement(parallaxRows[i], thisHeight - sectionHeight);
1315						}
1316					}
1317				}
1318			}
1319			if (typeof parallaxCols == 'object') {
1320				for (var j = 0; j < parallaxCols.length; j++) {
1321					var section = parallaxCols[j].parentNode,
1322						thisHeight = outerHeight(parallaxCols[j]),
1323						sectionHeight = outerHeight(section),
1324						offSetTop = bodyTop + (section != null ? section.getBoundingClientRect().top : 0),
1325						offSetPosition = wheight + bodyTop - offSetTop;
1326					if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) {
1327						value = ((offSetPosition - wheight) * speedDivider);
1328						value *= .8;
1329						if (Math.abs(value) < (thisHeight - sectionHeight)) {
1330							translateElement(parallaxCols[j], value);
1331						} else {
1332							translateElement(parallaxCols[j], thisHeight - sectionHeight);
1333						}
1334					}
1335				}
1336			}
1337		},
1338		/** Parallax Headers **/
1339		parallaxHeader = function(bodyTop) {
1340			var value;
1341			if (typeof parallaxHeaders == 'object') {
1342				for (var i = 0; i < parallaxHeaders.length; i++) {
1343					var section = parallaxHeaders[i].parentNode,
1344						thisSibling = section.nextSibling,
1345						thisHeight,
1346						sectionHeight,
1347						offSetTop,
1348						offSetPosition;
1349					if (classie.hasClass(parallaxHeaders[i], 'header-carousel-wrapper')) {
1350						getDivChildren(parallaxHeaders[i], '.t-background-cover', function(item, l, total) {
1351							thisHeight = outerHeight(item);
1352							sectionHeight = outerHeight(section);
1353							offSetTop = bodyTop + section.getBoundingClientRect().top;
1354							offSetPosition = wheight + bodyTop - offSetTop;
1355							if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) {
1356								value = ((offSetPosition - wheight) * speedDivider);
1357								if (Math.abs(value) < (thisHeight - sectionHeight)) {
1358									translateElement(item, value);
1359								}
1360							}
1361						});
1362					} else {
1363						thisHeight = outerHeight(parallaxHeaders[i]);
1364						sectionHeight = outerHeight(section);
1365						offSetTop = bodyTop + section.getBoundingClientRect().top;
1366						offSetPosition = wheight + bodyTop - offSetTop;
1367						if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) {
1368							value = ((offSetPosition - wheight) * speedDivider);
1369							if (Math.abs(value) < (thisHeight - sectionHeight)) {
1370								translateElement(parallaxHeaders[i], value);
1371							}
1372						}
1373					}
1374				}
1375			}
1376		},
1377		/** Header opacity **/
1378		headerOpacity = function(bodyTop) {
1379			if (headerWithOpacity && headerWithOpacity.length) {
1380				var thisHeight = outerHeight(headerWithOpacity[0]);
1381				if (bodyTop > thisHeight / 8) {
1382					if (pageHeader != undefined) classie.addClass(pageHeader, 'header-scrolled');
1383				} else {
1384					if (pageHeader != undefined) classie.removeClass(pageHeader, 'header-scrolled');
1385				}
1386			}
1387		},
1388		/** Show hide scroll top arrow **/
1389		showHideScrollup = function(bodyTop) {
1390			if (bodyTop != 0) {
1391				if (bodyTop > wheight || ((bodyTop + wheight) >= docheight) && docheight > 0) {
1392					classie.addClass(document.body, 'window-scrolled');
1393					classie.removeClass(document.body, 'hide-scrollup');
1394					if (footerScroller && footerScroller[0] != undefined) {
1395						footerScroller[0].style.display = '';
1396					}
1397				} else {
1398					if (classie.hasClass(document.body, 'window-scrolled')) classie.addClass(document.body, 'hide-scrollup');
1399					classie.removeClass(document.body, 'window-scrolled');
1400				}
1401			}
1402		},
1403		/** Hide Menu **/
1404		hideMenu = function(bodyTop) {
1405			if (typeof menuhide == 'object' && menuhide != null) {
1406				var translate;
1407				if (lastScrollValue > bodyTop) {
1408					if (!UNCODE.scrolling) {
1409						if (classie.hasClass(menuhide, 'menu-hided')) {
1410							classie.removeClass(menuhide, 'menu-hided');
1411							translateElement(menuhide, 0);
1412							if (mainmenu[0].style.position != 'fixed') {
1413								classie.addClass(mainmenu[0].parentNode, 'is_stuck');
1414								mainmenu[0].style.position = 'fixed';
1415								mainmenu[0].style.top = '0';
1416								if (!classie.hasClass(document.body, 'boxed-width')) mainmenu[0].style.width = boxWidth + 'px';
1417							}
1418						} else {
1419							if ((secmenuHeight == 0) ? bodyTop == 0 : bodyTop == secmenuHeight) {
1420								if (mainmenu[0].style.position == 'fixed') {
1421									classie.removeClass(mainmenu[0].parentNode, 'is_stuck');
1422									mainmenu[0].style.position = '';
1423									mainmenu[0].style.top = '';
1424								}
1425							}
1426						}
1427					}
1428				} else if (lastScrollValue < bodyTop) {
1429					if (bodyTop > wheight / 2 || UNCODE.scrolling) {
1430						if (!classie.hasClass(menuhide, 'menu-hided')) {
1431							classie.addClass(menuhide, 'menu-hided');
1432							translateElement(menuhide, -menuHeight);
1433						}
1434					}
1435				}
1436				lastScrollValue = bodyTop;
1437			}
1438		},
1439		/** Stick Menu **/
1440		stickMenu = function(bodyTop) {
1441			if (header) {
1442				if ((secmenuHeight == 0) ? bodyTop > 0 : bodyTop > secmenuHeight) {
1443					if (mainmenu[0].style.position != 'fixed') {
1444						classie.addClass(mainmenu[0].parentNode, 'is_stuck');
1445						mainmenu[0].style.position = 'fixed';
1446						if (document.documentElement.style.marginTop !== '') mainmenu[0].style.top = document.documentElement.style.marginTop;
1447						else mainmenu[0].style.top = '0';
1448						if (!classie.hasClass(document.body, 'boxed-width')) mainmenu[0].style.width = boxWidth + 'px';
1449					}
1450				} else {
1451					if (mainmenu[0].style.position != 'absolute') {
1452						classie.removeClass(mainmenu[0].parentNode, 'is_stuck');
1453						mainmenu[0].style.position = 'absolute';
1454						mainmenu[0].style.top = '';
1455					}
1456				}
1457			}
1458		},
1459		translateElement = function(element, valueY) {
1460			var translate = 'translate3d(0, ' + valueY + 'px' + ', 0)';
1461			element.style['-webkit-transform'] = translate;
1462			element.style['-moz-transform'] = translate;
1463			element.style['-ms-transform'] = translate;
1464			element.style['-o-transform'] = translate;
1465			element.style['transform'] = translate;
1466		},
1467		scrollFunction = function() {
1468			if (logoel != undefined && logoel.length) shrinkMenu(bodyTop);
1469			if (menusticky != undefined && menusticky.length && !isMobile) stickMenu(bodyTop);
1470			if (!isMobile) hideMenu(bodyTop);
1471			if (header && menusticky != undefined && menusticky.length) switchColorsMenu(bodyTop);
1472			parallaxRowCol(bodyTop);
1473			parallaxHeader(bodyTop);
1474			headerOpacity(bodyTop);
1475		};
1476	if (!noScroll) {
1477		window.addEventListener('scroll', function(e) {
1478			bodyTop = document.documentElement.scrollTop || document.body.scrollTop;
1479			if (wwidth > mediaQuery && !isMobile) {
1480				scrollFunction();
1481			}
1482			showHideScrollup(bodyTop);
1483		}, false);
1484	}
1485	/** All scrolling functions - End */
1486	/** help functions */
1487	function getClosest(el, tag) {
1488		do {
1489			if (el.className != undefined && el.className.indexOf(tag) > -1) return el;
1490		} while (el = el.parentNode);
1491		// not found :(
1492		return null;
1493	}
1494
1495	function outerHeight(el, includeMargin) {
1496		if (el != null) {
1497			var height = el.offsetHeight;
1498			if (includeMargin) {
1499				var style = el.currentStyle || getComputedStyle(el);
1500				height += parseInt(style.marginTop) + parseInt(style.marginBottom);
1501			}
1502			return height;
1503		}
1504	}
1505
1506	function outerWidth(el, includeMargin) {
1507			var width = el.offsetWidth;
1508			if (includeMargin) {
1509				var style = el.currentStyle || getComputedStyle(el);
1510				width += parseInt(style.marginLeft) + parseInt(style.marginRight);
1511			}
1512			return width;
1513		}
1514		// Replicate jQuery .each method
1515	function forEachElement(selector, fn) {
1516		var elements = document.querySelectorAll(selector);
1517		for (var i = 0; i < elements.length; i++) fn(elements[i], i);
1518	}
1519
1520	function getDivChildren(containerId, selector, fn) {
1521		if (containerId !== null) {
1522			var elements = containerId.querySelectorAll(selector);
1523			for (var i = 0; i < elements.length; i++) fn(elements[i], i, elements.length);
1524		}
1525	}
1526
1527	function hideFooterScroll() {
1528		if (classie.hasClass(document.body, 'hide-scrollup')) footerScroller[0].style.display = "none";
1529	}
1530	document.addEventListener("DOMContentLoaded", function(event) {
1531		UNCODE.adaptive();
1532		boxWrapper = document.querySelectorAll('.box-wrapper');
1533		docheight = boxWrapper[0] != undefined ? boxWrapper[0].offsetHeight : 0;
1534		if (!classie.hasClass(document.body, 'vmenu') && !classie.hasClass(document.body, 'menu-offcanvas')) init_overlay();
1535		if (!UNCODE.isMobile) {
1536			parallaxRows = document.querySelectorAll('.with-parallax > .row-background > .background-wrapper');
1537			parallaxCols = document.querySelectorAll('.with-parallax > .column-background > .background-wrapper');
1538		}
1539		footerScroller = document.querySelectorAll('.footer-scroll-top');
1540		if (footerScroller && footerScroller[0] != undefined) {
1541			if (transitionEvent) {
1542				footerScroller[0].addEventListener(transitionEvent, hideFooterScroll);
1543			}
1544		}
1545		Array.prototype.forEach.call(document.querySelectorAll('.row-inner'), function(el) {
1546			el.style.height = '';
1547			el.style.marginBottom = '';
1548		});
1549		setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'));
1550	});
1551	/** On resize events **/
1552	window.addEventListener("resize", function() {
1553		docheight = (boxWrapper != undefined && boxWrapper[0] != undefined) ? boxWrapper[0].offsetHeight : 0;
1554		var oldWidth = wwidth;
1555		wwidth = window.innerWidth || document.documentElement.clientWidth;
1556		wheight = window.innerHeight || document.documentElement.clientHeight;
1557		if (isMobile && (oldWidth == wwidth)) return false;
1558		initBox();
1559		headerHeight('.header-wrapper');
1560		window.dispatchEvent(boxEvent);
1561		clearTimeout(resizeTimer);
1562		resizeTimer = setTimeout(function() {
1563			Array.prototype.forEach.call(document.querySelectorAll('.row-inner'), function(el) {
1564				el.style.height = '';
1565				el.style.marginBottom = '';
1566			});
1567			setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'));
1568		}, 500);
1569
1570		if (!isMobile) {
1571			setTimeout(function() {
1572				initVideoComponent(document.body, '.uncode-video-container.video, .uncode-video-container.self-video');
1573			}, 100);
1574		}
1575		if (wwidth > mediaQuery) {
1576			scrollFunction();
1577		}
1578		showHideScrollup(bodyTop);
1579	});
1580
1581	/**
1582	 * On DOM ready
1583	 */
1584	window.addEventListener("load", function(){
1585		if (!UNCODE.isMobile) {
1586			if (wwidth > mediaQuery) {
1587				scrollFunction();
1588			}
1589			setTimeout(function() {
1590				window.dispatchEvent(UNCODE.boxEvent);
1591				Waypoint.refreshAll();
1592			}, 2000);
1593		}
1594		showHideScrollup(bodyTop);
1595		calculateMenuHeight(false);
1596		jQuery(window).trigger('resize');
1597	}, false);
1598
1599	var UNCODE = {
1600		boxEvent: boxEvent,
1601		initBox: initBox,
1602		menuHeight: 0,
1603		fixMenuHeight: fixMenuHeight,
1604		initHeader: initHeader,
1605		initRow: initRow,
1606		setRowHeight: setRowHeight,
1607		switchColorsMenu: switchColorsMenu,
1608		isMobile: isMobile,
1609		scrolling: false,
1610		mediaQuery: mediaQuery,
1611		initVideoComponent: initVideoComponent
1612	};
1613	// transport
1614	if (typeof define === 'function' && define.amd) {
1615		// AMD
1616		define(UNCODE);
1617	} else {
1618		// browser global
1619		window.UNCODE = UNCODE;
1620	}
1621
1622	UNCODE.adaptive = function() {
1623		var images = new Array(),
1624			getImages = document.querySelectorAll('.adaptive-async:not(.adaptive-fetching)');
1625		for (var i = 0; i < getImages.length; i++) {
1626			var imageObj = {},
1627				el = getImages[i];
1628			classie.addClass(el, 'adaptive-fetching');
1629			imageObj.unique = el.getAttribute('data-uniqueid');
1630			imageObj.url = el.getAttribute('data-guid');
1631			imageObj.path = el.getAttribute('data-path');
1632			imageObj.singlew = el.getAttribute('data-singlew');
1633			imageObj.singleh = el.getAttribute('data-singleh');
1634			imageObj.origwidth = el.getAttribute('data-width');
1635			imageObj.origheight = el.getAttribute('data-height');
1636			imageObj.crop = el.getAttribute('data-crop');
1637			imageObj.screen = window.uncodeScreen;
1638			imageObj.images = window.uncodeImages;
1639			images.push(imageObj);
1640		}
1641		var jsonString = JSON.stringify(images);
1642		var data = new Array();
1643		data['action'] = 'get_adaptive_async';
1644		data['images'] = jsonString;
1645		data['cache'] = 'false';
1646
1647		if (images.length > 0) {
1648			var xmlhttp;
1649			if (window.XMLHttpRequest) {
1650				// code for IE7+, Firefox, Chrome, Opera, Safari
1651				xmlhttp = new XMLHttpRequest();
1652			} else {
1653				// code for IE6, IE5
1654				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
1655			}
1656			xmlhttp.onreadystatechange = function() {
1657				if (xmlhttp.readyState == XMLHttpRequest.DONE ) {
1658					if(xmlhttp.status == 200){
1659						var images = JSON.parse(xmlhttp.responseText);
1660						for (var i = 0; i < images.length; i++) {
1661							var val = images[i],
1662								getImage = document.querySelectorAll('[data-uniqueid="'+val.unique+'"]');
1663							for (var j = 0; j < getImage.length; j++) {
1664								var attrScr = getImage[j].getAttribute('src'),
1665								replaceImg = new Image();
1666								replaceImg.source = attrScr;
1667								replaceImg.el = getImage[j];
1668
1669								classie.removeClass(getImage[j], 'adaptive-async');
1670								classie.removeClass(getImage[j], 'adaptive-fetching');
1671
1672								replaceImg.onload = function () {
1673									if (this.source !== null) {
1674										(this.el).src = this.src;
1675										// (this.el).removeAttribute('width');
1676										// (this.el).removeAttribute('height');
1677									} else {
1678										(this.el).style.backgroundImage = 'url("'+this.src+'")';
1679									}
1680									classie.addClass(this.el, 'async-done');
1681								}
1682								replaceImg.src = val.url;
1683							}
1684						}
1685					}
1686					else if(xmlhttp.status == 400) {
1687						console.log('There was an error 400')
1688					}
1689					else {
1690						console.log('something else other than 200 was returned')
1691					}
1692				}
1693			}
1694			//Serialize the data
1695	    var queryString = "",
1696	    	arrayLength = Object.keys(data).length,
1697	    	arrayCounter = 0;
1698
1699	    for (var key in data) {
1700				queryString += key + "=" + data[key];
1701				if(arrayCounter < arrayLength - 1) {
1702					queryString += "&";
1703				}
1704				arrayCounter++;
1705			}
1706
1707			xmlhttp.open("POST", SiteParameters.uncode_ajax, true);
1708			xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
1709	    xmlhttp.send(queryString);
1710
1711		}
1712	};
1713
1714})(window);
1715
1716
1717
1718/**
1719 * vivus - JavaScript library to make drawing animation on SVG
1720 * @version v0.3.0
1721 * @link https://github.com/maxwellito/vivus
1722 * @license MIT
1723 */
1724
1725'use strict';
1726
1727(function (window, document) {
1728
1729  'use strict';
1730
1731/**
1732 * Pathformer
1733 * Beta version
1734 *
1735 * Take any SVG version 1.1 and transform
1736 * child elements to 'path' elements
1737 *
1738 * This code is purely forked from
1739 * https://github.com/Waest/SVGPathConverter
1740 */
1741
1742/**
1743 * Class constructor
1744 *
1745 * @param {DOM|String} element Dom element of the SVG or id of it
1746 */
1747function Pathformer(element) {
1748  // Test params
1749  if (typeof element === 'undefined') {
1750    throw new Error('Pathformer [constructor]: "element" parameter is required');
1751  }
1752
1753  // Set the element
1754  if (element.constructor === String) {
1755    element = document.getElementById(element);
1756    if (!element) {
1757      throw new Error('Pathformer [constructor]: "element" parameter is not related to an existing ID');
1758    }
1759  }
1760  if (element.constructor instanceof window.SVGElement || /^svg$/i.test(element.nodeName)) {
1761    this.el = element;
1762  } else {
1763    throw new Error('Pathformer [constructor]: "element" parameter must be a string or a SVGelement');
1764  }
1765
1766  // Start
1767  this.scan(element);
1768}
1769
1770/**
1771 * List of tags which can be transformed
1772 * to path elements
1773 *
1774 * @type {Array}
1775 */
1776Pathformer.prototype.TYPES = ['line', 'ellipse', 'circle', 'polygon', 'polyline', 'rect'];
1777
1778/**
1779 * List of attribute names which contain
1780 * data. This array list them to check if
1781 * they contain bad values, like percentage. 
1782 *
1783 * @type {Array}
1784 */
1785Pathformer.prototype.ATTR_WATCH = ['cx', 'cy', 'points', 'r', 'rx', 'ry', 'x', 'x1', 'x2', 'y', '
1785y1', 'y2'];
1786
1787/**
1788 * Finds the elements compatible for transform
1789 * and apply the liked method
1790 *
1791 * @param  {object} options Object from the constructor
1792 */
1793Pathformer.prototype.scan = function (svg) {
1794  var fn, element, pathData, pathDom,
1795    elements = svg.querySelectorAll(this.TYPES.join(','));
1796  for (var i = 0; i < elements.length; i++) {
1797    element = elements[i];
1798    fn = this[element.tagName.toLowerCase() + 'ToPath'];
1799    pathData = fn(this.parseAttr(element.attributes));
1800    pathDom = this.pathMaker(element, pathData);
1801    element.parentNode.replaceChild(pathDom, element);
1802  }
1803};
1804
1805
1806/**
1807 * Read `line` element to extract and transform
1808 * data, to make it ready for a `path` object.
1809 *
1810 * @param  {DOMelement} element Line element to transform
1811 * @return {object}             Data for a `path` element
1812 */
1813Pathformer.prototype.lineToPath = function (element) {
1814  var newElement = {};
1815  newElement.d = 'M' + element.x1 + ',' + element.y1 + 'L' + element.x2 + ',' + element.y2;
1816  return newElement;
1817};
1818
1819/**
1820 * Read `rect` element to extract and transform
1821 * data, to make it ready for a `path` object.
1822 * The radius-border is not taken in charge yet.
1823 * (your help is more than welcomed)
1824 *
1825 * @param  {DOMelement} element Rect element to transform
1826 * @return {object}             Data for a `path` element
1827 */
1828Pathformer.prototype.rectToPath = function (element) {
1829  var newElement = {},
1830    x = parseFloat(element.x) || 0,
1831    y = parseFloat(element.y) || 0,
1832    width = parseFloat(element.width) || 0,
1833    height = parseFloat(element.height) || 0;
1834  newElement.d  = 'M' + x + ' ' + y + ' ';
1835  newElement.d += 'L' + (x + width) + ' ' + y + ' ';
1836  newElement.d += 'L' + (x + width) + ' ' + (y + height) + ' ';
1837  newElement.d += 'L' + x + ' ' + (y + height) + ' Z';
1838  return newElement;
1839};
1840
1841/**
1842 * Read `polyline` element to extract and transform
1843 * data, to make it ready for a `path` object.
1844 *
1845 * @param  {DOMelement} element Polyline element to transform
1846 * @return {object}             Data for a `path` element
1847 */
1848Pathformer.prototype.polylineToPath = function (element) {
1849  var i, path;
1850  var newElement = {};
1851  var points = element.points.trim().split(' ');
1852  
1853  // Reformatting if points are defined without commas
1854  if (element.points.indexOf(',') === -1) {
1855    var formattedPoints = [];
1856    for (i = 0; i < points.length; i+=2) {
1857      formattedPoints.push(points[i] + ',' + points[i+1]);
1858    }
1859    points = formattedPoints;
1860  }
1861
1862  // Generate the path.d value
1863  path = 'M' + points[0];
1864  for(i = 1; i < points.length; i++) {
1865    if (points[i].indexOf(',') !== -1) {
1866      path += 'L' + points[i];
1867    }
1868  }
1869  newElement.d = path;
1870  return newElement;
1871};
1872
1873/**
1874 * Read `polygon` element to extract and transform
1875 * data, to make it ready for a `path` object.
1876 * This method rely on polylineToPath, because the
1877 * logic is similar. The path created is just closed,
1878 * so it needs an 'Z' at the end.
1879 *
1880 * @param  {DOMelement} element Polygon element to transform
1881 * @return {object}             Data for a `path` element
1882 */
1883Pathformer.prototype.polygonToPath = function (element) {
1884  var newElement = Pathformer.prototype.polylineToPath(element);
1885  newElement.d += 'Z';
1886  return newElement;
1887};
1888
1889/**
1890 * Read `ellipse` element to extract and transform
1891 * data, to make it ready for a `path` object.
1892 *
1893 * @param  {DOMelement} element ellipse element to transform
1894 * @return {object}             Data for a `path` element
1895 */
1896Pathformer.prototype.ellipseToPath = function (element) {
1897  var startX = element.cx - element.rx,
1898      startY = element.cy;
1899  var endX = parseFloat(element.cx) + parseFloat(element.rx),
1900      endY = element.cy;
1901
1902  var newElement = {};
1903  newElement.d = 'M' + startX + ',' + startY +
1904                 'A' + element.rx + ',' + element.ry + ' 0,1,1 ' + endX + ',' + endY +
1905                 'A' + element.rx + ',' + element.ry + ' 0,1,1 ' + startX + ',' + endY;
1906  return newElement;
1907};
1908
1909/**
1910 * Read `circle` element to extract and transform
1911 * data, to make it ready for a `path` object.
1912 *
1913 * @param  {DOMelement} element Circle element to transform
1914 * @return {object}             Data for a `path` element
1915 */
1916Pathformer.prototype.circleToPath = function (element) {
1917  var newElement = {};
1918  var startX = element.cx - element.r,
1919      startY = element.cy;
1920  var endX = parseFloat(element.cx) + parseFloat(element.r),
1921      endY = element.cy;
1922  newElement.d =  'M' + startX + ',' + startY +
1923                  'A' + element.r + ',' + element.r + ' 0,1,1 ' + endX + ',' + endY +
1924                  'A' + element.r + ',' + element.r + ' 0,1,1 ' + startX + ',' + endY;
1925  return newElement;
1926};
1927
1928/**
1929 * Create `path` elements form original element
1930 * and prepared objects
1931 *
1932 * @param  {DOMelement} element  Original element to transform
1933 * @param  {object} pathData     Path data (from `toPath` methods)
1934 * @return {DOMelement}          Path element
1935 */
1936Pathformer.prototype.pathMaker = function (element, pathData) {
1937  var i, attr, pathTag = document.createElementNS('http://www.w3.org/2000/svg','path');
1938  for(i = 0; i < element.attributes.length; i++) {
1939    attr = element.attributes[i];
vendor: 6,064 bytes, lines 1940-2132
1940    if (this.ATTR_WATCH.indexOf(attr.name) === -1) {
1941      pathTag.setAttribute(attr.name, attr.value);
1942    }
1943  }
1944  for(i in pathData) {
1945    pathTag.setAttribute(i, pathData[i]);
1946  }
1947  return pathTag;
1948};
1949
1950/**
1951 * Parse attributes of a DOM element to
1952 * get an object of attribute => value
1953 *
1954 * @param  {NamedNodeMap} attributes Attributes object from DOM element to parse
1955 * @return {object}                  Object of attributes
1956 */
1957Pathformer.prototype.parseAttr = function (element) {
1958  var attr, output = {};
1959  for (var i = 0; i < element.length; i++) {
1960    attr = element[i];
1961    // Check if no data attribute contains '%', or the transformation is impossible
1962    if (this.ATTR_WATCH.indexOf(attr.name) !== -1 && attr.value.indexOf('%') !== -1) {
1963      throw new Error('Pathformer [parseAttr]: a SVG shape got values in percentage. This cannot be transformed into \'path\' tags. Please use \'viewBox\'.');
1964    }
1965    output[attr.name] = attr.value;
1966  }
1967  return output;
1968};
1969
1970  'use strict';
1971
1972var requestAnimFrame, cancelAnimFrame, parsePositiveInt;
1973
1974/**
1975 * Vivus
1976 * Beta version
1977 *
1978 * Take any SVG and make the animation
1979 * to give give the impression of live drawing
1980 *
1981 * This in more than just inspired from codrops
1982 * At that point, it's a pure fork.
1983 */
1984
1985/**
1986 * Class constructor
1987 * option structure
1988 *   type: 'delayed'|'async'|'oneByOne'|'script' (to know if the item must be drawn asynchronously or not, default: delayed)
1989 *   duration: <int> (in frames)
1990 *   start: 'inViewport'|'manual'|'autostart' (start automatically the animation, default: inViewport)
1991 *   delay: <int> (delay between the drawing of first and last path)
1992 *   dashGap <integer> whitespace extra margin between dashes
1993 *   pathTimingFunction <function> timing animation function for each path element of the SVG
1994 *   animTimingFunction <function> timing animation function for the complete SVG
1995 *   forceRender <boolean> force the browser to re-render all updated path items
1996 *   selfDestroy <boolean> removes all extra styling on the SVG, and leaves it as original
1997 *
1998 * The attribute 'type' is by default on 'delayed'.
1999 *  - 'delayed'
2000 *    all paths are draw at the same time but with a
2001 *    little delay between them before start
2002 *  - 'async'
2003 *    all path are start and finish at the same time
2004 *  - 'oneByOne'
2005 *    only one path is draw at the time
2006 *    the end of the first one will trigger the draw
2007 *    of the next one
2008 *
2009 * All these values can be overwritten individually
2010 * for each path item in the SVG
2011 * The value of frames will always take the advantage of
2012 * the duration value.
2013 * If you fail somewhere, an error will be thrown.
2014 * Good luck.
2015 *
2016 * @constructor
2017 * @this {Vivus}
2018 * @param {DOM|String}   element  Dom element of the SVG or id of it
2019 * @param {Object}       options  Options about the animation
2020 * @param {Function}     callback Callback for the end of the animation
2021 */
2022function Vivus (element, options, callback) {
2023
2024  // Setup
2025  this.isReady = false;
2026  this.setElement(element, options);
2027  this.setOptions(options);
2028  this.setCallback(callback);
2029
2030  if (this.isReady) {
2031    this.init();
2032  }
2033}
2034
2035/**
2036 * Timing functions
2037 ************************************** 
2038 * 
2039 * Default functions to help developers.
2040 * It always take a number as parameter (between 0 to 1) then
2041 * return a number (between 0 and 1)
2042 */
2043Vivus.LINEAR          = function (x) {return x;};
2044Vivus.EASE            = function (x) {return -Math.cos(x * Math.PI) / 2 + 0.5;};
2045Vivus.EASE_OUT        = function (x) {return 1 - Math.pow(1-x, 3);};
2046Vivus.EASE_IN         = function (x) {return Math.pow(x, 3);};
2047Vivus.EASE_OUT_BOUNCE = function (x) {
2048  var base = -Math.cos(x * (0.5 * Math.PI)) + 1,
2049    rate = Math.pow(base,1.5),
2050    rateR = Math.pow(1 - x, 2),
2051    progress = -Math.abs(Math.cos(rate * (2.5 * Math.PI) )) + 1;
2052  return (1- rateR) + (progress * rateR);
2053};
2054
2055
2056/**
2057 * Setters
2058 **************************************
2059 */
2060
2061/**
2062 * Check and set the element in the instance
2063 * The method will not return anything, but will throw an
2064 * error if the parameter is invalid
2065 *
2066 * @param {DOM|String}   element  SVG Dom element or id of it
2067 */
2068Vivus.prototype.setElement = function (element, options) {
2069  // Basic check
2070  if (typeof element === 'undefined') {
2071    throw new Error('Vivus [constructor]: "element" parameter is required');
2072  }
2073
2074  // Set the element
2075  if (element.constructor === String) {
2076    element = document.getElementById(element);
2077    if (!element) {
2078      throw new Error('Vivus [constructor]: "element" parameter is not related to an existing ID');
2079    }
2080  }
2081  this.parentEl = element;
2082
2083  // Create the object element if the property `file` exists in the options object
2084  if (options && options.file) {
2085    var objElm = document.createElement('object');
2086    objElm.setAttribute('type', 'image/svg+xml');
2087    objElm.setAttribute('data', options.file);
2088    objElm.setAttribute('built-by-vivus', 'true');
2089    element.appendChild(objElm);
2090    element = objElm;
2091  }
2092
2093  switch (element.constructor) {
2094  case window.SVGSVGElement:
2095  case window.SVGElement:
2096    this.el = element;
2097    this.isReady = true;
2098    break;
2099
2100  case window.HTMLObjectElement:
2101    // If we have to wait for it
2102    var onLoad, self;
2103    
2104    self = this;
2105    onLoad = function (e) {
2106      if (self.isReady) {
2107        return;
2108      }
2109      self.el = element.contentDocument && element.contentDocument.querySelector('svg');
2110      if (!self.el && e) {
2111        throw new Error('Vivus [constructor]: object loaded does not contain any SVG');
2112      }
2113      else if (self.el) {
2114        if (element.getAttribute('built-by-vivus')) {
2115          self.parentEl.insertBefore(self.el, element);
2116          self.parentEl.removeChild(element);
2117          self.el.setAttribute('width', '100%');
2118          self.el.setAttribute('height', '100%');
2119        }
2120        self.isReady = true;
2121        self.init();
2122        return true;
2123      }
2124    };
2125
2126    if (!onLoad()) {
2127      element.addEventListener('load', onLoad);
2128    }
2129    break;
2130
2131  default:
2132    throw new Error('Vivus [constructor]: "element" parameter is not val
2132id (or miss the "file" attribute)');
2133  }
2134};
2135
2136/**
2137 * Set up user option to the instance
2138 * The method will not return anything, but will throw an
2139 * error if the parameter is invalid
2140 *
2141 * @param  {object} options Object from the constructor
2142 */
2143Vivus.prototype.setOptions = function (options) {
2144  var allowedTypes = ['delayed', 'async', 'oneByOne', 'scenario', 'scenario-sync'];
2145  var allowedStarts =  ['inViewport', 'manual', 'autostart'];
2146
2147  // Basic check
2148  if (options !== undefined && options.constructor !== Object) {
2149    throw new Error('Vivus [constructor]: "options" parameter must be an object');
2150  }
2151  else {
2152    options = options || {};
2153  }
2154
2155  // Set the animation type
2156  if (options.type && allowedTypes.indexOf(options.type) === -1) {
2157    throw new Error('Vivus [constructor]: ' + options.type + ' is not an existing animation `type`');
2158  }
2159  else {
2160    this.type = options.type || allowedTypes[0];
2161  }
2162
2163  // Set the start type
2164  if (options.start && allowedStarts.indexOf(options.start) === -1) {
2165    throw new Error('Vivus [constructor]: ' + options.start + ' is not an existing `start` option');
2166  }
2167  else {
2168    this.start = options.start || allowedStarts[0];
2169  }
2170
2171  this.isIE        = (window.navigator.userAgent.indexOf('MSIE') !== -1 || window.navigator.userAgent.indexOf('Trident/') !== -1 || window.navigator.userAgent.indexOf('Edge/') !== -1 );
2172  this.duration    = parsePositiveInt(options.duration, 120);
2173  this.delay       = parsePositiveInt(options.delay, null);
2174  this.delayStart  = parsePositiveInt(options.delayStart, null);
2175  this.dashGap     = parsePositiveInt(options.dashGap, 1);
2176  this.forceRender = options.hasOwnProperty('forceRender') ? !!options.forceRender : this.isIE;
2177  this.selfDestroy = !!options.selfDestroy;
2178  this.onReady     = options.onReady;
2179  this.frameLength = this.currentFrame = this.map = this.delayUnit = this.speed = this.handle = null;
2180
2181  this.ignoreInvisible = options.hasOwnProperty('ignoreInvisible') ? !!options.ignoreInvisible : false;
2182
2183  this.animTimingFunction = options.animTimingFunction || Vivus.LINEAR;
2184  this.pathTimingFunction = options.pathTimingFunction || Vivus.LINEAR;
2185
2186  if (this.delay >= this.duration) {
2187    throw new Error('Vivus [constructor]: delay must be shorter than duration');
2188  }
2189};
2190
2191/**
2192 * Set up callback to the instance
2193 * The method will not return enything, but will throw an
2194 * error if the parameter is invalid
2195 *
2196 * @param  {Function} callback Callback for the animation end
2197 */
2198Vivus.prototype.setCallback = function (callback) {
2199  // Basic check
2200  if (!!callback && callback.constructor !== Function) {
2201    throw new Error('Vivus [constructor]: "callback" parameter must be a function');
2202  }
2203  this.callback = callback || function () {};
2204};
2205
2206
2207/**
2208 * Core
2209 **************************************
2210 */
2211
2212/**
2213 * Map the svg, path by path.
2214 * The method return nothing, it just fill the
2215 * `map` array. Each item in this array represent
2216 * a path element from the SVG, with informations for
2217 * the animation.
2218 *
2219 * ```
2220 * [
2221 *   {
2222 *     el: <DOMobj> the path element
2223 *     length: <number> length of the path line
2224 *     startAt: <number> time start of the path animation (in frames)
2225 *     duration: <number> path animation duration (in frames)
2226 *   },
2227 *   ...
2228 * ]
2229 * ```
2230 *
2231 */
2232Vivus.prototype.mapping = function () {
2233  var i, paths, path, pAttrs, pathObj, totalLength, lengthMeter, timePoint;
2234  timePoint = totalLength = lengthMeter = 0;
2235  paths = this.el.querySelectorAll('path');
2236
2237  for (i = 0; i < paths.length; i++) {
2238    path = paths[i];
2239    if (this.isInvisible(path)) {
2240      continue;
2241    }
2242    pathObj = {
2243      el: path,
2244      length: Math.ceil(path.getTotalLength())
2245    };
2246    // Test if the path length is correct
2247    if (isNaN(pathObj.length)) {
2248      if (window.console && console.warn) {
2249        console.warn('Vivus [mapping]: cannot retrieve a path element length', path);
2250      }
2251      continue;
2252    }
2253    this.map.push(pathObj);
2254    path.style.strokeDasharray  = pathObj.length + ' ' + (pathObj.length + this.dashGap * 2);
2255    path.style.strokeDashoffset = pathObj.length + this.dashGap;
2256    pathObj.length += this.dashGap;
2257    totalLength += pathObj.length;
2258
2259    this.renderPath(i);
2260  }
2261
2262  totalLength = totalLength === 0 ? 1 : totalLength;
2263  this.delay = this.delay === null ? this.duration / 3 : this.delay;
2264  this.delayUnit = this.delay / (paths.length > 1 ? paths.length - 1 : 1);
2265
2266  for (i = 0; i < this.map.length; i++) {
2267    pathObj = this.map[i];
2268
2269    switch (this.type) {
2270    case 'delayed':
2271      pathObj.startAt = this.delayUnit * i;
2272      pathObj.duration = this.duration - this.delay;
2273      break;
2274
2275    case 'oneByOne':
2276      pathObj.startAt = lengthMeter / totalLength * this.duration;
2277      pathObj.duration = pathObj.length / totalLength * this.duration;
2278      break;
2279
2280    case 'async':
2281      pathObj.startAt = 0;
2282      pathObj.duration = this.duration;
2283      break;
2284
2285    case 'scenario-sync':
2286      path = paths[i];
2287      pAttrs = this.parseAttr(path);
2288      pathObj.startAt = timePoint + (parsePositiveInt(pAttrs['data-delay'], this.delayUnit) || 0);
2289      pathObj.duration = parsePositiveInt(pAttrs['data-duration'], this.duration);
2290      timePoint = pAttrs['data-async'] !== undefined ? pathObj.startAt : pathObj.startAt + pathObj.duration;
2291      this.frameLength = Math.max(this.frameLength, (pathObj.startAt + pathObj.duration));
2292      break;
2293
2294    case 'scenario':
2295      path = paths[i];
2296      pAttrs = this.parseAttr(path);
2297      pathObj.startAt = parsePositiveInt(pAttrs['data-start'], this.delayUnit) || 0;
2298      pathObj.duration = parsePositiveInt(pAttrs['data-duration'], this.duration);
2299      this.frameLength = Math.max(this.frameLength, (pathObj.startAt + pathObj.duration));
2300      break;
2301    }
2302    lengthMeter += pathObj.length;
2303    this.frameLength = this.frameLength || this.duration;
2304  }
2305};
2306
2307/**
2308 * Interval method to draw the SVG from current
2309 * position of the animation. It update the value of
2310 * `currentFrame` and re-trace the SVG.
2311 *
2312 * It use this.handle to store the requestAnimationFrame
2313 * and clear it one the animation is stopped. So this
2314 * attribute can be used to know if the animation is
2315 * playing.
2316 *
2317 * Once the animation at the end, this method will
2318 * trigger the Vivus callback.
2319 *
2320 */
2321Vivus.prototype.drawer = function () {
2322  var self = this;
2323  this.currentFrame += this.speed;
2324
2325  if (this.currentFrame <= 0) {
2326    this.stop();
2327    this.reset();
2328    this.callback(this);
2329  } else if (this.currentFrame >= this.frameLength) {
2330    this.stop();
2331    this.currentFrame = this.frameLength;
2332    this.trace();
2333    if (this.selfDestroy) {
2334      this.destroy();
2335    }
2336    this.callback(this);
2337  } else {
2338    this.trace();
2339    this.handle = requestAnimFrame(function () {
2340      self.drawer();
2341    });
2342  }
2343};
2344
2345/**
2346 * Draw the SVG at the current instant from the
2347 * `currentFrame` value. Here is where most of the magic is.
2348 * The trick is to use the `strokeDashoffset` style property.
2349 *
2350 * For optimisation reasons, a new property called `progress`
2351 * is added in each item of `map`. This one contain the current
2352 * progress of the path element. Only if the new value is different
2353 * the new value will be applied to the DOM element. This
2354 * method save a lot of resources to re-render the SVG. And could
2355 * be improved if the animation couldn't be played forward.
2356 *
2357 */
2358Vivus.prototype.trace = function () {
2359  var i, progress, path, currentFrame;
2360  currentFrame = this.animTimingFunction(this.currentFrame / this.frameLength) * this.frameLength;
2361  for (i = 0; i < this.map.length; i++) {
2362    path = this.map[i];
2363    progress = (currentFrame - path.startAt) / path.duration;
2364    progress = this.pathTimingFunction(Math.max(0, Math.min(1, progress)));
2365    if (path.progress !== progress) {
2366      path.progress = progress;
2367      path.el.style.strokeDashoffset = Math.floor(path.length * (1 - progress));
2368      this.renderPath(i);
2369    }
2370  }
2371};
2372
2373/**
2374 * Method forcing the browser to re-render a path element
2375 * from it's index in the map. Depending on the `forceRender`
2376 * value.
2377 * The trick is to replace the path element by it's clone.
2378 * This practice is not recommended because it's asking more
2379 * ressources, too much DOM manupulation..
2380 * but it's the only way to let the magic happen on IE.
2381 * By default, this fallback is only applied on IE.
2382 * 
2383 * @param  {Number} index Path index
2384 */
2385Vivus.prototype.renderPath = function (index) {
2386  if (this.forceRender && this.map && this.map[index]) {
2387    var pathObj = this.map[index],
2388        newPath = pathObj.el.cloneNode(true);
2389    pathObj.el.parentNode.replaceChild(newPath, pathObj.el);
2390    pathObj.el = newPath;
2391  }
2392};
2393
2394/**
2395 * When the SVG object is loaded and ready,
2396 * this method will continue the initialisation.
2397 *
2398 * This this mainly due to the case of passing an
2399 * object tag in the constructor. It will wait
2400 * the end of the loading to initialise.
2401 * 
2402 */
2403Vivus.prototype.init = function () {
2404  // Set object variables
2405  this.frameLength = 0;
2406  this.currentFrame = 0;
2407  this.map = [];
2408
2409  // Start
2410  new Pathformer(this.el);
2411  this.mapping();
2412  this.starter();
2413
2414  if (this.onReady) {
2415    this.onReady(this);
2416  }
2417};
2418
2419/**
2420 * Trigger to start of the animation.
2421 * Depending on the `start` value, a different script
2422 * will be applied.
2423 *
2424 * If the `start` value is not valid, an error will be thrown.
2425 * Even if technically, this is impossible.
2426 *
2427 */
2428Vivus.prototype.starter = function () {
2429  switch (this.start) {
2430  case 'manual':
2431    return;
2432
2433  case 'autostart':
2434    this.play();
2435    break;
2436
2437  case 'inViewport':
2438    var self = this,
2439    listener = function () {
2440      if (self.isInViewport(self.parentEl, 1)) {
2441        if (self.delayStart != null) {
2442        	setTimeout(function() {
2443        		self.play();
2444        	}, self.delayStart);
2445        } else self.play();
2446        window.removeEventListener('scroll', listener);
2447      }
2448    };
2449    window.addEventListener('scroll', listener);
2450    listener();
2451    break;
2452  }
2453};
2454
2455
2456/**
2457 * Controls
2458 **************************************
2459 */
2460
2461/**
2462 * Get the current status of the animation between
2463 * three different states: 'start', 'progress', 'end'.
2464 * @return {string} Instance status
2465 */
2466Vivus.prototype.getStatus = function () {
2467  return this.currentFrame === 0 ? 'start' : this.currentFrame === this.frameLength ? 'end' : 'progress';
2468};
2469
2470/**
2471 * Reset the instance to the initial state : undraw
2472 * Be careful, it just reset the animation, if you're
2473 * playing the animation, this won't stop it. But just
2474 * make it start from start.
2475 *
2476 */
2477Vivus.prototype.reset = function () {
2478  return this.setFrameProgress(0);
2479};
2480
2481/**
2482 * Set the instance to the final state : drawn
2483 * Be careful, it just set the animation, if you're
2484 * playing the animation on rewind, this won't stop it.
2485 * But just make it start from the end.
2486 *
2487 */
2488Vivus.prototype.finish = function () {
2489  return this.setFrameProgress(1);
2490};
2491
2492/**
2493 * Set the level of progress of the drawing.
2494 * 
2495 * @param {number} progress Level of progress to set
2496 */
2497Vivus.prototype.setFrameProgress = function (progress) {
2498  progress = Math.min(1, Math.max(0, progress));
2499  this.currentFrame = Math.round(this.frameLength * progress);
2500  this.trace();
2501  return this;
2502};
2503
2504/**
2505 * Play the animation at the desired speed.
2506 * Speed must be a valid number (no zero).
2507 * By default, the speed value is 1.
2508 * But a negative value is accepted to go forward.
2509 *
2510 * And works with float too.
2511 * But don't forget we are in JavaScript, se be nice
2512 * with him and give him a 1/2^x value.
2513 *
2514 * @param  {number} speed Animation speed [optional]
2515 */
2516Vivus.prototype.play = function (speed) {
2517  if (speed && typeof speed !== 'number') {
2518    throw new Error('Vivus [play]: invalid speed');
2519  }
2520  this.speed = speed || 1;
2521  if (!this.handle) {
2522    this.drawer();
2523  }
2524  return this;
2525};
2526
2527/**
2528 * Stop the current animation, if on progress.
2529 * Should not trigger any error.
2530 *
2531 */
2532Vivus.prototype.stop = function () {
2533  if (this.handle) {
2534    cancelAnimFrame(this.handle);
2535    this.handle = null;
2536  }
2537  return this;
2538};
2539
2540/**
2541 * Destroy the instance.
2542 * Remove all bad styling attributes on all
2543 * path tags
2544 *
2545 */
2546Vivus.prototype.destroy = function () {
2547  var i, path;
2548  for (i = 0; i < this.map.length; i++) {
2549    path = this.map[i];
2550    path.el.style.strokeDashoffset = null;
2551    path.el.style.strokeDasharray = null;
2552    this.renderPath(i);
2553  }
2554};
2555
2556
2557/**
2558 * Utils methods
2559 * include methods from Codrops
2560 **************************************
2561 */
2562
2563/**
2564 * Method to best guess if a path should added into
2565 * the animation or not.
2566 *
2567 * 1. Use the `data-vivus-ignore` attribute if set
2568 * 2. Check if the instance must ignore invisible paths
2569 * 3. Check if the path is visible
2570 *
2571 * For now the visibility checking is unstable.
2572 * It will be used for a beta phase.
2573 *
2574 * Other improvments are planned. Like detecting
2575 * is the path got a stroke or a valid opacity.
2576 */
2577Vivus.prototype.isInvisible = function (el) {
2578  var rect,
2579    ignoreAttr = el.getAttribute('data-ignore');
2580
2581  if (ignoreAttr !== null) {
2582    return ignoreAttr !== 'false';
2583  }
2584
2585  if (this.ignoreInvisible) {
2586    rect = el.getBoundingClientRect();
2587    return !rect.width && !rect.height;
2588  }
2589  else {
2590    return false;
2591  }
2592};
2593
2594/**
2595 * Parse attributes of a DOM element to
2596 * get an object of {attributeName => attributeValue}
2597 *
2598 * @param  {object} element DOM element to parse
2599 * @return {object}         Object of attributes
2600 */
2601Vivus.prototype.parseAttr = function (element) {
2602  var attr, output = {};
2603  if (element && element.attributes) {
2604    for (var i = 0; i < element.attributes.length; i++) {
2605      attr = element.attributes[i];
2606      output[attr.name] = attr.value;
2607    }
2608  }
2609  return output;
2610};
2611
2612/**
2613 * Reply if an element is in the page viewport
2614 *
2615 * @param  {object} el Element to observe
2616 * @param  {number} h  Percentage of height
2617 * @return {boolean}
2618 */
2619Vivus.prototype.isInViewport = function (el, h) {
2620  var scrolled   = this.scrollY(),
2621    viewed       = scrolled + this.getViewportH(),
2622    elBCR        = el.getBoundingClientRect(),
2623    elHeight     = elBCR.height,
2624    elTop        = scrolled + elBCR.top,
2625    elBottom     = elTop + elHeight;
2626
2627  // if 0, the element is considered in the viewport as soon as it enters.
2628  // if 1, the element is considered in the viewport only when it's fully inside
2629  // value in percentage (1 >= h >= 0)
2630  h = h || 0;
2631
2632  return (elTop + elHeight * h) <= viewed && (elBottom) >= scrolled;
2633};
2634
2635/**
2636 * Alias for document element
2637 *
2638 * @type {DOMelement}
2639 */
2640Vivus.prototype.docElem = window.document.documentElement;
2641
2642/**
2643 * Get the viewport height in pixels
2644 *
2645 * @return {integer} Viewport height
2646 */
2647Vivus.prototype.getViewportH = function () {
2648  var client = this.docElem.clientHeight,
2649    inner = window.innerHeight;
2650
2651  if (client < inner) {
2652    return inner;
2653  }
2654  else {
2655    return client;
2656  }
2657};
2658
2659/**
2660 * Get the page Y offset
2661 *
2662 * @return {integer} Page Y offset
2663 */
2664Vivus.prototype.scrollY = function () {
2665  return window.pageYOffset || this.docElem.scrollTop;
2666};
2667
2668/**
2669 * Alias for `requestAnimationFrame` or
2670 * `setTimeout` function for deprecated browsers.
2671 *
2672 */
2673requestAnimFrame = (function () {
2674  return (
2675    window.requestAnimationFrame       ||
2676    window.webkitRequestAnimationFrame ||
2677    window.mozRequestAnimationFrame    ||
2678    window.oRequestAnimationFrame      ||
2679    window.msRequestAnimationFrame     ||
2680    function(/* function */ callback){
2681      return window.setTimeout(callback, 1000 / 60);
2682    }
2683  );
2684})();
2685
2686/**
2687 * Alias for `cancelAnimationFrame` or
2688 * `cancelTimeout` function for deprecated browsers.
2689 *
2690 */
2691cancelAnimFrame = (function () {
2692  return (
2693    window.cancelAnimationFrame       ||
2694    window.webkitCancelAnimationFrame ||
2695    window.mozCancelAnimationFrame    ||
2696    window.oCancelAnimationFrame      ||
2697    window.msCancelAnimationFrame     ||
2698    function(id){
2699      return window.clearTimeout(id);
2700    }
2701  );
2702})();
2703
2704/**
2705 * Parse string to integer.
2706 * If the number is not positive or null
2707 * the method will return the default value
2708 * or 0 if undefined
2709 *
2710 * @param {string} value String to parse
2711 * @param {*}
2711 defaultValue Value to return if the result parsed is invalid
2712 * @return {number}
2713 *
2714 */
2715parsePositiveInt = function (value, defaultValue) {
2716  var output = parseInt(value, 10);
2717  return (output >= 0) ? output : defaultValue;
2718};
2719
2720
2721  if (typeof define === 'function' && define.amd) {
2722    // AMD. Register as an anonymous module.
2723    define([], function() {
2724      return Vivus;
2725    });
2726  } else if (typeof exports === 'object') {
2727    // Node. Does not work with strict CommonJS, but
2728    // only CommonJS-like environments that support module.exports,
2729    // like Node.
2730    module.exports = Vivus;
2731  } else {
2732    // Browser globals
2733    window.Vivus = Vivus;
2734  }
2735
2736}(window, document));

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.