PageSourceSearch

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

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

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.