PageSourceSearch

https://cosettepharma.com/wp-content/themes/uncode/library/js/app.js?ver=1626229103

js cosettepharma.com collected 2026-09-25 04:33:43 UTC 304,152 bytes, 9,562 lines download raw bytes

1/* ----------------------------------------------------------
2 * Uncode App
3 * ---------------------------------------------------------- */
4
5(function($) {
6	"use strict";
7	var UNCODE = window.UNCODE || {};
8	window.UNCODE = UNCODE;
9
10	window.requestAnimFrame = (function() {
11	return  window.requestAnimationFrame	   ||
12			window.webkitRequestAnimationFrame ||
13			window.mozRequestAnimationFrame	||
14			window.oRequestAnimationFrame	  ||
15			window.msRequestAnimationFrame	 ||
16			function(/* function */ callback, /* DOMElement */ element){
17				window.setTimeout(callback, 1000 / 60);
18			};
19})();
20
21window.requestTimeout = function(fn, delay) {
22	if( !window.requestAnimationFrame	  	&&
23		!window.webkitRequestAnimationFrame &&
24		!(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) && // Firefox 5 ships without cancel support
25		!window.oRequestAnimationFrame	  &&
26		!window.msRequestAnimationFrame)
27			return window.setTimeout(fn, delay);
28
29	var start = new Date().getTime(),
30		handle = new Object();
31
32	function loop(){
33		var current = new Date().getTime(),
34			delta = current - start;
35
36		delta >= delay ? fn.call() : handle.value = requestAnimFrame(loop);
37	};
38
39	handle.value = requestAnimFrame(loop);
40	return handle;
41};
42
43window.clearRequestTimeout = function(handle) {
44	if ( typeof handle !== 'undefined' ) {
45		window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) :
46		window.webkitCancelAnimationFrame ? window.webkitCancelAnimationFrame(handle.value) :
47		window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value) : /* Support for legacy API */
48		window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) :
49		window.oCancelRequestAnimationFrame	? window.oCancelRequestAnimationFrame(handle.value) :
50		window.msCancelRequestAnimationFrame ? window.msCancelRequestAnimationFrame(handle.value) :
51		clearTimeout(handle);
52	}
53};
54
55Number.isInteger = Number.isInteger || function(value) {
56    return typeof value === "number" &&
57           isFinite(value) &&
58           Math.floor(value) === value;
59};
60
61UNCODE.utils = function() {
62	$(document).on('mouseover', 'a', function() {
63		$(this).attr('data-title', $(this).attr('title'));
64		$(this).removeAttr('title');
65	});
66	$(document).on('mouseout', 'a', function() {
67		$(this).attr('title', $(this).attr('data-title'));
68		$(this).removeAttr('data-title');
69	});
70
71	this.get_scroll_offset = function(e) {
72
73		var scroll_offset = 0,
74			is_first_link = false,
75			target,
76			trigger;
77
78		if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) {
79			target = e.target;
80			trigger = e.currentTarget;
81		}
82
83		if ($('.menu-hide').length || $('.menu-hide-vertical').length) {
84			if (UNCODE.bodyTop > UNCODE.wheight / 2) {
85				UNCODE.hideMenu(100);
86			}
87		}
88
89		if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery  ) {
90			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
91				if ( $('.menu-sticky').length && !$('.menu-hide').length ) {
92					scroll_offset += $('#logo-container-mobile').outerHeight();
93				} else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) {
94					scroll_offset += $('.menu-sticky .menu-container').outerHeight();
95				} else {
96					if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) {
97						scroll_offset += UNCODE.menuMobileHeight;
98					} else {
99						if ( typeof target !== 'undefined' && target.closest('.main-menu-container') != null && UNCODE.wwidth < UNCODE.mediaQuery && ! $('body').hasClass('vmenu') && ! $('body').hasClass('menu-mobile-transparent') && ! $('.menu-sticky').length ) {
100							scroll_offset += $('.main-menu-container > div:first-child()').height() - 2;
101						} else {
102							if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) {
103								scroll_offset += UNCODE.menuMobileHeight;
104							}
105						}
106					}
107				}
108			}
109		}
110
111		scroll_offset += UNCODE.bodyBorder;
112
113		return scroll_offset;
114	}
115
116	if ( !UNCODE.isFullPage ) {
117		$(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) {
118
119			var hash = (e.currentTarget).hash,
120			is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false,
121			anchor = '';
122			if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return;
123			if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) {
124				e.preventDefault();
125				if (!$('#tab-reviews').is(':visible')) {
126					$('a[href="#tab-reviews"]').trigger('click');
127				}
128				var calc_scroll = $('.wootabs .tab-content').offset().top;
129				calc_scroll -= UNCODE.get_scroll_offset(e);
130
131				if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
132					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
133
134					if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
135						scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
136					}
137				}
138
139				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
140					delta = bodyTop - calc_scroll,
141					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
142				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
143
144				requestTimeout(function(){
145					if (scrollSpeed == 0) {
146						$('html, body').scrollTop(calc_scroll);
147						UNCODE.scrolling = false;
148					} else {
149   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
150							$(this).stop();
151						}).animate({
152								scrollTop: calc_scroll
153							}, scrollSpeed, 'easeInOutCubic', function() {
154								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
155								UNCODE.scrolling = false;
156							}
157						);
158					}
159				}, 200);
160				return;
161			}
162			if (hash != undefined) {
163				var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
164				var anchor = this.hash.slice(1);
165				if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) {
166			  		if ( !specialFormat.test(hash) ) {
167			  			if ( $(hash).length )
168			  				anchor = $(hash);
169			  		}
170				}
171			}
172
173			if (is_scrolltop || anchor != '') {
174				if (is_scrolltop) {
175					e.preventDefault();
176					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
177					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
178					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
179
180					if (scrollSpeed == 0) {
181						$('html, body').scrollTop(0);
182						UNCODE.scrolling = false;
183					} else {
184   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
185							$(this).stop();
186						}).animate({
187							scrollTop: 0
188						}, scrollSpeed, 'easeInOutCubic', function() {
189							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
190							UNCODE.scrolling = false;
191						});
192					}
193				} else {
194					var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor;
195					$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) {
196						var get_href = $(val).attr('href');
197						if (get_href != undefined) {
198							if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active');
199							else $(val).parent().removeClass('active');
200						}
201					});
202					if (scrollSection.length) {
203						if ( $('body').hasClass('uncode-scroll-no-history') ) {
204							e.preventDefault();
205						}
206
207						if (UNCODE.menuOpened) {
208							if (UNCODE.wwidth < UNCODE.mediaQuery) {
209								window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
210							} else {
211								$('.mmb-container-overlay .overlay-close').trigger('click');
212								$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
213							}
214						}
215
216						var calc_scroll = scrollSection.offset().top,
217							getOffset = UNCODE.get_scroll_offset(e),
218							$logo = $('#logo-container-mobile'),
219							logoH,
220							$menu = $('#masthead .menu-container'),
221							menuH;
222
223						calc_scroll -= getOffset;
224
225						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
226							delta = bodyTop - calc_scroll,
227							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
228						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
229
230						if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
231							if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') ) {
232								logoH = $logo.outerHeight(),
233								menuH = $menu.outerHeight();
234								if ( calc_scroll < ( logoH + menuH ) ) {
235									calc_scroll = 0;
236								}
237							}
238						}
239
240						if (scrollSpeed == 0) {
241							$('html, body').scrollTop(calc_scroll);
242							UNCODE.scrolling = false;
243						} else {
244	   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
245								$(this).stop();
246							}).animate({
247								scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
248							}, scrollSpeed, 'easeInOutCubic', function() {
249								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
250								UNCODE.scrolling = false;
251								if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
252									if (getOffset != UNCODE.get_scroll_offset(e)) {
253										calc_scroll = scrollSection.offset().top;
254										getOffset = UNCODE.get_scroll_offset(e);
255										calc_scroll -= getOffset;
256										$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
257											$(this).stop();
258										}).animate({
259											scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
260											}, scrollSpeed, 'easeInOutCubic', function() {
261												$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
262												UNCODE.scrolling = false;
263											}
264										);
265									}
266								}
267							});
268						}
269					}
270				}
271			}
272		});
273		$('.header-scrolldown').on('click', function(event) {
274
275			event.preventDefault();
276
277			var pageHeader = $(event.target).closest('#page-header'),
278				pageHeaderTop = pageHeader.offset().top,
279				pageHeaderHeight = pageHeader.outerHeight(),
280				scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
281			if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
282
283			var calc_scroll = pageHeaderTop + pageHeaderHeight,
284			getOffset = UNCODE.get_scroll_offset(event);
285			calc_scroll -= getOffset;
286
287			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
288				var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
289
290				if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
291					scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
292				}
293			}
294
295			if (scrollSpeed == 0) {
296				$('html, body').scrollTop(calc_scroll);
297				UNCODE.scrolling = false;
298			} else {
299					$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
300						$(this).stop();
301					}).animate({
302						scrollTop: calc_scroll
303					}, scrollSpeed, 'easeInOutCubic', function() {
304						$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
305						UNCODE.scrolling = false;
306						if (getOffset != UNCODE.get_scroll_offset(event)) {
307							calc_scroll = pageHeaderTop + pageHeaderHeight;
308							getOffset = UNCODE.get_scroll_offset(event);
309							calc_scroll -= getOffset;
310								$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
311									$(this).stop();
312								}).animate({
313									scrollTop: calc_scroll
314								}, scrollSpeed, 'easeInOutCubic', function() {
315									$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
316									UNCODE.scrolling = false;
317								}
318							);
319						}
320					}
321				);
322			}
323		});
324	}
325
326	// Colomun hover effect
327	// =================
328	$(document).on('mouseenter', '.col-link', function(e) {
329		var uncol = $(e.target).prev('.uncol'),
330		el = uncol.find('.column-background');
331		if (el) {
332			$('.btn-container .btn', uncol).toggleClass('active');
333			var elOverlay = $(el[0]).find('.block-bg-overlay');
334			if (elOverlay.length) {
335				var getOpacity = $(elOverlay).css('opacity');
336				if (getOpacity != 1) {
337					getOpacity = Math.round(getOpacity * 100) / 100;
338					var newOpacity = getOpacity + .1;
339					$(elOverlay).data('data-opacity', getOpacity);
340					$(elOverlay).css('opacity', newOpacity);
341				}
342			}
343		}
344	}).on('mouseleave', '.col-link', function(e) {
345		var uncol = $(e.target).prev('.uncol'),
346		el = uncol.find('.column-background');
347		$('.btn-container .btn', uncol).toggleClass('active');
348		if (el) {
349			var elOverlay = $(el[0]).find('.block-bg-overlay');
350			if (elOverlay.length) {
351				var getOpacity = $(elOverlay).data('data-opacity');
352				$(elOverlay).css('opacity', getOpacity);
353			}
354		}
355	});
356
357	// Admin bar
358	// ============
359	var fixAdminBar = function() {
360		if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) {
361			var getAdminBar = $('#wpadminbar');
362			if (getAdminBar.length) {
363				if (getAdminBar.css('position') !== 'hidden') {
364					var getAdminBarHeight = getAdminBar.height();
365					if (getAdminBar.css('position') === 'fixed') {
366						$('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'});
367						$('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'});
368					} else {
369						$('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'});
370						$('.body-borders .top-border').css({'margin-top':'0px'});
371					}
372				}
373			}
374		}
375	};
376	window.addEventListener('load', fixAdminBar);
377	window.addEventListener('resize', fixAdminBar);
378	// Print
379	// ===========
380	var beforePrint = function() {
381		window.dispatchEvent(new CustomEvent('resize'));
382		window.dispatchEvent(UNCODE.boxEvent);
383	};
384
385	if (window.matchMedia) {
386		var mediaQueryList = window.matchMedia('print');
387		mediaQueryList.addListener(function(mql) {
388			if (mql.matches) {
389				beforePrint();
390			}
391		});
392	}
393
394	window.onbeforeprint = beforePrint;
395
396	// Safari srcset
397	var safariSrcSet = function(){
398		if ( !SiteParameters.is_frontend_editor ) {
399			$('html.safari img[sizes]').each(function(){
400				var $img = $(this),
401					sizeImg = parseInt($img.attr('sizes'));
402				if ( typeof(sizeImg) === 'number' ) {
403					$img.attr('sizes', (sizeImg) + 'px');
404				}
405			});
406		}
407	};
408	window.addEventListener('load', safariSrcSet);
409}
410
411UNCODE.lettering = function() {
412
413	var setCTA;
414	var highlightStill = function(){
415
416		var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)');
417
418		$.each($heading_texts, function(key, el) {
419			var $heading = $(el);
420
421			if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) {
422				return;
423			}
424
425			if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) {
426				return;
427			}
428
429			var waypoint = new Waypoint({
430				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
431				element: el,
432				handler: function() {
433					var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element),
434						anims_l = $anims.length;
435					$anims.each(function(_key_, _el_){
436						var $anim = $(_el_);
437
438						if ( ! $anim.hasClass('heading-text-highlight-animated') ) {
439							$anim.addClass('heading-text-highlight-animated');
440
441							if ( $heading.data('animate') === true ) {
442								$anim.css({
443									'-webkit-transition-duration': '0ms',
444									'-moz-transition-duration': '0ms',
445									'-o-transition-duration': '0ms',
446									'transition-duration': '0ms',
447								});
448							} else {
449								$anim.css({
450									'-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms',
451									'-moz-transition-delay': ((_key_ + 2) * 200) + 'ms',
452									'-o-transition-delay': ((_key_ + 2) * 200) + 'ms',
453									'transition-delay': ((_key_ + 2) * 200) + 'ms',
454								});
455							}
456						}
457
458					});
459					$anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) {
460						$heading.data('animate', true);
461					});
462					$anims.removeAttr('data-animated');
463				},
464				offset: '100%'
465			});
466
467		});
468
469		Waypoint.refreshAll();
470		$( document.body ).trigger('uncode_waypoints');
471
472	}
473
474	requestTimeout(function(){
475		highlightStill();
476		$(window).on( 'resize', function(){
477			clearRequestTimeout(setCTA);
478			setCTA = requestTimeout( highlightStill, 100 );
479		});
480	}, 400);
481
482};
483
484UNCODE.isUnmodalOpen = false;
485
486var manageVideoSize = function(){
487
488	var setVideoFit;
489	$('.wp-block-embed').each(function(){
490
491		var $this = $(this);
492
493		if ( $('iframe', $this).length ) {
494
495			var $iframe = $('> iframe, > a > iframe', $this),
496				w = parseFloat($iframe.attr('width')),
497				h = parseFloat($iframe.attr('height')),
498				url = $iframe.attr('src'),
499				ratio, frW;
500
501			if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0  ) {
502
503				ratio = h / w;
504				var setResizeiFto,
505					resizeiFrame = function(){
506					frW = $iframe.width();
507					$iframe.css({
508						height: frW * ratio
509					});
510				};
511				resizeiFrame();
512				$(window).on( 'resize load', function(){
513					clearRequestTimeout(setResizeiFto);
514					setResizeiFto = requestTimeout( function() {
515						resizeiFrame();
516					}, 10 );
517				});
518
519			}
520
521		}
522
523	});
524
525};
526
527manageVideoSize();
528
529UNCODE.vivus = function(icon, time, delay, file) {
530	if (typeof Vivus !== 'undefined') {
531		var icon_options = {
532			type: 'delayed',
533			pathTimingFunction: Vivus.EASE_OUT,
534			animTimingFunction: Vivus.LINEAR,
535			duration: time,
536		}
537
538		if (delay) {
539			icon_options.delayStart = delay;
540		}
541
542		if (file) {
543			icon_options.file = file;
544		}
545
546		new Vivus(icon, icon_options);
547	}
548};
549
550UNCODE.changeSkinOnScroll = function(){
551	if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) {
552		return;
553	}
554	var $masthead = $('#masthead'),
555		transDesktop,
556		transMobile,
557		changeSkin,
558
559	checkTransparencyAndChange = function( $col ){
560		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
561		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
562		changeSkin = $masthead.hasClass('menu-change-skin');
563
564		if ( ! transDesktop && ! transMobile ) {
565			return false;
566		}
567
568		if ( ! changeSkin ) {
569			return false;
570		}
571
572		if ( $col.hasClass('style-light') ){
573			$masthead.removeClass('style-dark-override').addClass('style-light-override');
574			return false;
575		} else if ( $col.hasClass('style-dark') ) {
576			$masthead.removeClass('style-light-override').addClass('style-dark-override');
577			return false;
578		}
579	};
580
581	var prev_row = 'normal',
582		odd = true,
583		$rows = $('.vc_row[data-parent]:visible');
584	$.each($rows, function(index, row){
585		var $row = $(row),
586			$col = $('.uncol', $row).first(),
587			$slider = $('.uncode-slider', $row);
588
589		var wayDown = new Waypoint({
590			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
591			element: row,
592			handler: function(direction) {
593				if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
594					if ( $slider.length ) {
595						$col = $('.owl-item.index-active .uncol', $slider).first();
596					}
597					checkTransparencyAndChange($col);
598				}
599				if ( odd === false ) {
600					if ( row.hasAttribute('data-bg-changer') ) {
601						prev_row = 'bg-changer';
602					} else {
603						prev_row = 'normal';
604					}
605					odd = true;
606				} else {
607					odd = false;
608				}
609			},
610			offset: function() {
611				return UNCODE.menuHeight / 2
612			}
613		});
614		var wayUp = new Waypoint({
615			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
616			element: row,
617			handler: function(direction) {
618				if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
619					if ( $slider.length ) {
620						$col = $('.owl-item.index-active .uncol', $slider).first();
621					}
622					checkTransparencyAndChange($col);
623				}
624				if ( odd === false ) {
625					if ( row.hasAttribute('data-bg-changer') ) {
626						prev_row = 'bg-changer';
627					} else {
628						prev_row = 'normal';
629					}
630					odd = true;
631				} else {
632					odd = false;
633				}
634			},
635			offset: function() {
636				return -row.clientHeight + ( UNCODE.menuHeight / 2 )
637			}
638		});
639	});
640
641};
642
643UNCODE.share = function() {
644	if (typeof Share !== 'undefined') {
645		var share_button_element = $('.share-button');
646		var share_button_url = share_button_element.data('url');
647
648		var share_button_config = {
649			ui: {
650				flyout: "top center",
651				button_font: false,
652				button_text: '',
653				icon_font: false
654			}
655		};
656
657		if (share_button_url) {
658			share_button_config.url = share_button_url.replace("&", "%26");
659		}
660
661		var share_button_top = new Share('.share-button', share_button_config);
662	}
663};
664
665UNCODE.tooltip = function() {
666	if (typeof jQuery.fn.tooltip !== 'undefined') {
667		$('.btn-tooltip').tooltip();
668	}
669};
670
671UNCODE.counters = function() {
672	var $counters = $('.counter:not(.counter-init)');
673	$counters.each(function(){
674		var $counter = $(this).addClass('counter-init');
675		if ( $counter.closest( '.owl-carousel' ).length ) {
676			return;
677		}
678		$counter.addClass('started').counterUp({
679			delay: 10,
680			time: 1500
681		});
682	});
683};
684
685UNCODE.countdowns = function() {
686	var $countdowns = $('[data-uncode-countdown]:not(.counter-init)');
687	$countdowns.each(function() {
688		var $this = $(this).addClass('counter-init'),
689			finalDate = $(this).data('uncode-countdown');
690		$this.countdown(finalDate, function(event) {
691			$this.html(event.strftime('%D <small>' + SiteParameters.days + '</small> %H <small>' + SiteParameters.hours + '</small> %M <small>' + SiteParameters.minutes + '</small> %S <small>' + SiteParameters.seconds + '</small>'));
692		});
693	});
694};
695
696UNCODE.tabs = function() {
697	$(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function(e) {
698		e.preventDefault()
699		$(this).tab('show');
700		requestTimeout(function() {
701			window.dispatchEvent(UNCODE.boxEvent);
702			$(window).trigger('uncode.re-layout');
703		}, 300);
704	});
705};
706
707UNCODE.collapse = function() {
708	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
709		var $this = $(this),
710			href
711		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
712		var $target = $(target)
713		var data = $target.data('bs.collapse')
714		var option = data ? 'toggle' : $this.data()
715		var parent = $this.attr('data-parent')
716		var $parent = parent && $(parent)
717		var $title = $(this).parent()
718		if ($parent) {
719			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
720			if ($title.hasClass('active')) {
721				$title.removeClass('active');
722			} else {
723				$parent.find('.panel-title').removeClass('active')
724				$title[!$target.hasClass('in') ? 'addClass' : 'removeClass']('active')
725			}
726		}
727		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
728		requestTimeout(function() {
729			$(window).trigger('uncode.re-layout');
730		}, 500);
731	});
732};
733
734UNCODE.bigText = function(el) {
735	if (el == undefined) {
736		el = $('body');
737	}
738	$.each($('.bigtext', el), function(index, val) {
739		$(val).bigtext({
740			minfontsize: 24
741		});
742		if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
743			opacity: 1
744		});
745		requestTimeout(function() {
746			if ($(val).find('.animate_when_almost_visible').length != 0) {
747				$(val).css({opacity: 1});
748			}
749		}, 400);
750	});
751};
752
753UNCODE.process_shortpixel_image = function(image) {
754	var data = {
755		action: 'shortpixel_manual_optimization',
756		image_id: image,
757		cleanup: true
758	};
759
760	$.get(SiteParameters.ajax_url, data);
761};
762
763UNCODE.menuSystem = function() {
764
765	function menuMobile() {
766		var $body = $('body'),
767			$mobileToggleButton = $('.mobile-menu-button'),
768			$box,
769			$el,
770			$el_transp,
771			elHeight,
772			check,
773			animating = false,
774			stickyMobile = false,
775			menuClose = new CustomEvent('menuMobileClose'),
776			menuOpen = new CustomEvent('menuMobileOpen');
777		UNCODE.menuOpened = false;
778		$mobileToggleButton.on('click', function(event) {
779			var btn = this;
780			if ($(btn).hasClass('overlay-close')) return;
781			event.preventDefault();
782			if (UNCODE.wwidth <= UNCODE.mediaQuery) {
783				$box = $(this).closest('.box-container').find('.main-menu-container');
784				$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner');
785				$el_transp = $('.menu-absolute.menu-transparent');
786				if (UNCODE.isMobile) {
787					if ( $('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only, .main-header .menu-sticky-vertical, .main-header .menu-hide-only-vertical, .menu-mobile-centered').length ) {
788						stickyMobile = true;
789						elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
790					} else {
791						elHeight = 0;
792						$.each($box.find('> div'), function(index, val) {
793							elHeight += $(val).outerHeight();
794						});
795					}
796				} else {
797					elHeight = 0;
798					$.each($el, function(index, val) {
799						elHeight += $(val).outerHeight();
800					});
801				}
802				var open = function() {
803					if (!animating) {
804						$body.addClass('open-overlay-menu');
805						window.dispatchEvent(menuOpen);
806						animating = true;
807						UNCODE.menuOpened = true;
808						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) {
809							$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
810							if ($('body.menu-offcanvas').length) {
811								$('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed'});
812								$('.vmenu-container.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
813							} else {
814								if ( $('.menu-hide, .menu-sticky').length ) {
815									if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length  ) {
816										$('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed'});
817									}
818								}
819							}
820						}
821						if ($('body.hmenu-center').length && ($('.menu-hide, .menu-sticky').length)) {
822							$('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
823						}
824						btn.classList.add('close');
825						$box.addClass('open-items');
826						if ($el_transp.length && $('body.menu-mobile-transparent').length) {
827							$el_transp.addClass('is_mobile_open');
828						}
829						$box.animate({
830							height: elHeight
831						}, 600, "easeInOutCirc", function() {
832							animating = false;
833							if (!stickyMobile) $box.css('height', 'auto');
834						});
835					}
836				};
837
838				var close = function() {
839					if (!animating) {
840						window.dispatchEvent(menuClose);
841						animating = true;
842						UNCODE.menuOpened = false;
843						btn.classList.remove('close');
844						btn.classList.add('closing');
845						$box.addClass('close');
846						requestTimeout(function() {
847							$box.removeClass('close');
848							$box.removeClass('open-items');
849							btn.classList.remove('closing');
850							if ($el_transp.length) {
851								$el_transp.removeClass('is_mobile_open');
852							}
853						}, 500);
854						$box.animate({
855							height: 0
856						}, {
857							duration: 600,
858							easing: "easeInOutCirc",
859							complete: function(elements) {
860								$(elements).css('height', '');
861								animating = false;
862								if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) {
863									$('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.isotope-filters)').css('position','relative');
864								}
865								$body.removeClass('open-overlay-menu');
866							}
867						});
868					}
869				};
870				check = (!UNCODE.menuOpened) ? open() : close();
871			}
872		});
873		window.addEventListener('menuMobileTrigged', function(e) {
874			$('.mobile-menu-button.close').trigger('click');
875		});
876		window.addEventListener('orientationchange', function(e) {
877			$('#logo-container-mobile .mobile-menu-button.close').trigger('click');
878		});
879		window.addEventListener("resize", function() {
880			if ($(window).width() < UNCODE.mediaQuery) {
881				if (UNCODE.isMobile) {
882					var $box = $('.box-container .main-menu-container'),
883						$el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner');
884					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto') {
885						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
886							elHeight = 0;
887							$.each($el, function(index, val) {
888								elHeight += $(val).outerHeight();
889							});
890							elHeight = window.innerHeight - $('.menu-wrapper.menu-sticky .menu-container .row-menu-inner, .menu-wrapper.menu-hide-only .menu-container .row-menu-inner').height() - (UNCODE.bodyBorder * 2) + 1;
891							$($box).css('height', elHeight + 'px');
892						}
893					}
894				}
895			} else {
896				$('.menu-hide-vertical').removeAttr('style');
897				$('.menu-container-mobile').removeAttr('style');
898				$('.vmenu-container.menu-container').removeAttr('style');
899			}
900		});
901	};
902
903	function menuOffCanvas() {
904		var menuClose = new CustomEvent('menuCanvasClose'),
905			menuOpen = new CustomEvent('menuCanvasOpen');
906		$('.menu-primary .menu-button-offcanvas').click(function(event) {
907			if ($(window).width() > UNCODE.mediaQuery) {
908				if ($(event.currentTarget).hasClass('close')) {
909					$(event.currentTarget).removeClass('close');
910					$(event.currentTarget).addClass('closing');
911					requestTimeout(function() {
912						$(event.currentTarget).removeClass('closing');
913						window.dispatchEvent(menuClose);
914					}, 500);
915
916				} else {
917					$(event.currentTarget).addClass('close');
918					window.dispatchEvent(menuOpen);
919				}
920			}
921
922			$('body').toggleClass('off-opened');
923		});
924	};
925	function menuSmart() {
926		var $menusmart = $('[class*="menu-smart"]'),
927			$masthead = $('#masthead'),
928			$hMenu = $('.menu-horizontal-inner', $masthead),
929			$focus = $('.overlay-menu-focus'),
930			showTimeout = 50,
931			hideTimeout = 50,
932			showTimeoutFunc, hideTimeoutFunc;
933
934		$('> li.menu-item-has-children', $menusmart).hover(function(){
935			$(this).data('hover', true);
936		}, function(){
937			$(this).data('hover', false);
938		});
939
940		if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) {
941			var $notLis = $('> .nav > ul > li a', $hMenu),
942				$menuA = $('a', $masthead).not($notLis),
943				$hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'),
944				showFuncCond = function() { return true };
945
946			if ( $('body').hasClass('focus-megamenu') ) {
947				$hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner');
948				showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') };
949			} else if ( $('body').hasClass('focus-links') ) {
950				$hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA);
951			}
952
953			$hoverSelector.hover(function(){
954				clearRequestTimeout(hideTimeoutFunc);
955				showTimeoutFunc = requestTimeout(function(){
956					$('body').addClass('navbar-hover');
957				}, showTimeout*2);
958			}, function(){
959				hideTimeoutFunc = requestTimeout(function(){
960					$('body').removeClass('navbar-hover');
961				}, hideTimeout*2);
962			});
963		} else {
964			showFuncCond = function() { return false };
965		}
966
967		if ($menusmart.length > 0) {
968			$menusmart.smartmenus({
969				subIndicators: false,
970				subIndicatorsPos: 'append',
971				//subMenusMinWidth: '13em',
972				subIndicatorsText: '',
973				showTimeout: showTimeout,
974				hideTimeout: hideTimeout,
975				showFunction: function($ul, complete) {
976					clearRequestTimeout(showTimeoutFunc);
977					$ul.fadeIn(0, 'linear', function(){
978						complete();
979						if ( $ul.hasClass('vc_row') ) {
980							$ul.css({
981								'display': 'table'
982							});
983						}
984						if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) {
985							$('body').addClass('open-megamenu');
986						}
987						if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) {
988							$('body').addClass('navbar-hover');
989						}
990					}).addClass('open-animated');
991				},
992				hideFunction: function($ul, complete) {
993					if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) {
994						$('body').removeClass('open-megamenu');
995					}
996					var fixIE = $('html.ie').length;
997					if (fixIE) {
998						var $rowParent = $($ul).closest('.main-menu-container');
999						$rowParent.height('auto');
1000					}
1001					$ul.fadeOut(0, 'linear', function(){
1002						complete();
1003						$ul.removeClass('open-animated');
1004						if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) {
1005							$('body').removeClass('open-submenu');
1006						}
1007					});
1008				},
1009				collapsibleShowFunction: function($ul, complete) {
1010					$ul.slideDown(400, 'easeInOutCirc', complete);
1011				},
1012				collapsibleHideFunction: function($ul, complete) {
1013					$ul.slideUp(200, 'easeInOutCirc', complete);
1014				},
1015				hideOnClick: true
1016			});
1017
1018			if ( $('body').hasClass('menu-accordion-active') ) {
1019				requestTimeout(function(){
1020					$menusmart.addClass('menu-smart-init');
1021					$menusmart.smartmenus( 'itemActivate', $menusmart.find( '.current-menu-item > a' ).eq( -1 ) );
1022				}, 1000);
1023			}
1024		}
1025
1026	};
1027	function menuOverlay() {
1028		if ( $('.overlay').length ) {
1029			$('.overlay').removeClass('hidden');
1030		}
1031		if ($('.overlay-sequential, .menu-mobile-animated').length > 0) {
1032			$('.overlay-sequential .menu-smart > li, .menu-sticky .menu-container .menu-smart > li, .menu-hide.menu-container .menu-smart > li, .vmenu-container .menu-smart > li').each(function(index, el) {
1033				var transDelay = (index / 20) + 0.1;
1034				if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery )
1035					transDelay = transDelay + 0.3;
1036				$(this)[0].setAttribute('style', '-webkit-transition-delay:' + transDelay + 's; -moz-transition-delay:' + transDelay + 's; -ms-transition-delay:' + transDelay + 's; -o-transition-delay:' + transDelay + 's; transition-delay:' + transDelay + 's');
1037			});
1038		}
1039	};
1040	function menuAppend() {
1041		var $body = $('body'),
1042			$menuCont = $('.menu-container'),
1043			$cta = $('.navbar-cta'),
1044			$socials = $('.navbar-social'),
1045			$ul = $('.navbar-main ul.menu-primary-inner'),
1046			$ulCta,
1047			$ulSocials,
1048			$firstMenu = $('.main-menu-container:first-child', $menuCont),
1049			$secondMenu = $('.main-menu-container:last-child', $menuCont),
1050			$firstNav = $('.navbar-nav:first-child', $firstMenu),
1051			$secondNav = $('.navbar-nav:first-child', $secondMenu),
1052			$ulFirst = $('> ul', $firstNav),
1053			$ulSecond = $('> ul', $secondNav),
1054			setCTA,
1055			appendCTA = function(){
1056				return true;
1057			},
1058			appendSocials = function(){
1059				return true;
1060			},
1061			appendSplit = function(){
1062				return true;
1063			};
1064
1065		if ( $body.hasClass('cta-not-appended') )
1066			return false;
1067
1068		if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) {
1069			$ulCta = $('> ul', $cta);
1070
1071			appendCTA = function(){
1072				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1073					$ul.after($ulCta);
1074				} else {
1075					$cta.append($ulCta);
1076				}
1077			}
1078		}
1079		appendCTA();
1080
1081		if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') ) && $socials.length ) {
1082			$ulSocials = $('> ul', $socials);
1083
1084			appendSocials = function(){
1085				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1086					$ul.after($ulSocials);
1087				} else {
1088					$socials.append($ulSocials);
1089				}
1090			}
1091		}
1092		appendSocials();
1093
1094		if ( ( $body.hasClass('hmenu-center-double') ) ) {
1095			appendSplit = function(){
1096				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1097					if ( $secondNav.length ) {
1098						$secondNav.prepend($ulFirst);
1099					}
1100					$firstMenu.hide();
1101				} else {
1102					$firstNav.append($ulFirst);
1103					$firstMenu.css({
1104						'display': 'table-cell'
1105					});
1106				}
1107			}
1108		}
1109		appendSplit();
1110
1111		$(window).on( 'resize', function(){
1112			clearRequestTimeout(setCTA);
1113			setCTA = requestTimeout( function() {
1114				appendCTA();
1115				appendSocials();
1116				appendSplit();
1117			}, 10 );
1118		});
1119	}
1120	//menuMobileButton();
1121	menuMobile();
1122	menuOffCanvas();
1123	menuSmart();
1124	menuAppend();
1125	menuOverlay();
1126	var setMenuOverlay;
1127	$(window).on( 'resize', function(){
1128		if ( $('.overlay').length && $(window).width() > 1024 ) {
1129			$('.overlay').addClass('hidden');
1130		}
1131		clearRequestTimeout(setMenuOverlay);
1132		setMenuOverlay = requestTimeout( menuOverlay, 150 );
1133	});
1134};
1135
1136UNCODE.okvideo = function() {
1137	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
1138	$.okvideo = function(options) {
1139		// if the option var was just a string, turn it into an object
1140		if (typeof options !== 'object') options = {
1141			'video': options
1142		};
1143		var base = this;
1144		// kick things off
1145		base.init = function() {
1146			base.options = $.extend({}, $.okvideo.options, options);
1147			// support older versions of okvideo
1148			if (base.options.video === null) base.options.video = base.options.source;
1149			base.setOptions();
1150			var target = base.options.target || $('body');
1151			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
1152			var zIndex = base.options.controls === 3 ? -999 : "auto";
1153			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
1154				var mask = '<div id="okplayer-mask-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:-998;height:100%;width:100%;"></div>';
1155				if (OKEvents.utils.isMobile()) {
1156					target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:' + zIndex + ';height:100%;width:100%;"></div>');
1157				} else {
1158					if (base.options.controls === 3) {
1159						target.append(mask)
1160					}
1161					if (base.options.adproof === 1) {
1162						target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:-10%;top:-10%;overflow:hidden;z-index:' + zIndex + ';height:120%;width:120%;"></div>');
1163					} else {
1164						target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:' + zIndex + ';height:100%;width:100%;"></div>');
1165					}
1166				}
1167				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
1168				if (base.options.playlist.list === null) {
1169					if (base.options.video.provider === 'youtube') {
1170						base.loadYouTubeAPI();
1171					} else if (base.options.video.provider === 'vimeo') {
1172						base.options.volume /= 100;
1173						base.loadVimeoAPI();
1174					}
1175				} else {
1176					base.loadYouTubeAPI();
1177				}
1178			}
1179		};
1180		// clean the options
1181		base.setOptions = function() {
1182			// exchange 'true' for '1' and 'false' for 3
1183			for (var key in this.options) {
1184				if (this.options[key] === true) this.options[key] = 1;
1185				if (this.options[key] === false) this.options[key] = 3;
1186			}
1187			if (base.options.playlist.list === null) {
1188				base.options.video = base.determineProvider();
1189			}
1190			// pass options to the window
1191			$(window).data('okoptions-' + base.options.id, base.options);
1192		};
1193		// insert js into the head and exectue a callback function
1194		base.insertJS = function(src, callback){
1195			var tag;
1196			if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) {
1197				tag = UNCODE.insertedSripts[src];
1198				if (callback){
1199					if (tag.readyState){  //IE
1200						tag.onreadystatechange = function(){
1201							if (tag.readyState === "loaded" ||
1202								tag.readyState === "complete"){
1203								tag.onreadystatechange = null;
1204								callback();
1205							}
1206						};
1207					} else {
1208						$(tag).on('load', callback);
1209					}
1210				}
1211				return;
1212			}
1213			tag = document.createElement('script');
1214			if (callback){
1215				if (tag.readyState){  //IE
1216					tag.onreadystatechange = function(){
1217						if (tag.readyState === "loaded" || tag.readyState === "complete"){
1218							tag.onreadystatechange = null;
1219							callback();
1220						}
1221					};
1222				} else {
1223					tag.onload = function() {
1224						callback();
1225					};
1226				}
1227			}
1228			tag.src = src;
1229			var firstScriptTag = document.getElementsByTagName('script')[0];
1230			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
1231			if ( ! UNCODE.insertedSripts ) {
1232				UNCODE.insertedSripts = [];
1233			}
1234			UNCODE.insertedSripts[src] = tag;
1235		};
1236		// load the youtube api
1237		base.loadYouTubeAPI = function(callback) {
1238			base.insertJS('https://www.youtube.com/player_api');
1239		};
1240		base.loadYouTubePlaylist = function() {
1241			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
1242		};
1243		// load the vimeo api by replacing the div with an iframe and loading js
1244		base.loadVimeoAPI = function() {
1245			var source = '//player.vimeo.com/video/' + base.options.video.id + '?background=1&api=1&title=0&byline=0&portrait=0&playbar=0&loop=' + base.options.loop + '&autoplay=' + (base.options.autoplay === 1 ? 1 : 0) + '&player_id=okplayer-' + base.options.id,
1246			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" />');
1247			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
1248			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
1249			base.insertJS('//f.vimeocdn.com/js/froogaloop2.min.js', function() {
1250				vimeoPlayerReady(base.options.id);
1251			});
1252		};
1253		// is it from youtube or vimeo?
1254		base.determineProvider = function() {
1255			var a = document.createElement('a');
1256			a.href = base.options.video;
1257			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
1258				var videoid = a.href.split('/')[3].toString();
1259				var query = videoid.substring(videoid.indexOf('?') + 1);
1260				if (query != '') {
1261					var vars = query.split('&');
1262					for (var i = 0; i < vars.length; i++) {
1263						var pair = vars[i].split('=');
1264						if (pair[0] == 'v') {
1265							videoid = pair[1];
1266						}
1267					}
1268				}
1269				return {
1270					"provider": "youtube",
1271					"id": videoid
1272				};
1273			} else if (/vimeo.com/.test(base.options.video)) {
1274				return {
1275					"provider": "vimeo",
1276					"id": (a.href.split('/')[3].toString()).split('#')[0],
1277				};
1278			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
1279				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
1280				if (id.length == 11) {
1281					return {
1282						"provider": "youtube",
1283						"id": id.toString()
1284					};
1285				} else {
1286					for (var i = 0; i < base.options.video.length; i++) {
1287						if (typeof parseInt(base.options.video[i]) !== "number") {
1288							throw 'not vimeo but thought it was for a sec';
1289						}
1290					}
1291					return {
1292						"provider": "vimeo",
1293						"id": base.options.video
1294					};
1295				}
1296			} else {
1297				throw "OKVideo: Invalid video source";
1298			}
1299		};
1300		base.init();
1301	};
1302	$.okvideo.options = {
1303		id: null,
1304		source: null, // Deprecate dis l8r
1305		video: null,
1306		playlist: { // eat ur heart out @brokyo
1307			list: null,
1308			index: 0,
1309			startSeconds: 0,
1310			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
1311		},
1312		disableKeyControl: 1,
1313		captions: 0,
1314		loop: 1,
1315		hd: 1,
1316		volume: 0,
1317		adproof: false,
1318		unstarted: null,
1319		onFinished: null,
1320		onReady: null,
1321		onPlay: null,
1322		onPause: null,
1323		buffering: null,
1324		controls: false,
1325		autoplay: true,
1326		annotations: true,
1327		cued: null
1328	};
1329	$.fn.okvideo = function(options) {
1330		options.target = this;
1331		return this.each(function() {
1332			(new $.okvideo(options));
1333		});
1334	};
1335
1336	$(".no-touch .uncode-video-container.video").each(function(index, el) {
1337		var $this = $(this),
1338			url = $this.attr('data-video'),
1339			id = $this.attr('data-id'),
1340			cloned = $this.closest('.owl-item');
1341		if (!cloned.hasClass('cloned') || cloned.length == 0) {
1342			$this.okvideo({
1343				id: id,
1344				source: url.split('#')[0],
1345				time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
1346				autoplay: 1,
1347				controls: 0,
1348				volume: 0,
1349				adproof: 0,
1350				caller: $this,
1351				hd: 1,
1352				onReady: function(player) {
1353					var getPlayer = player.c || player.h || player,
1354					$iframe,
1355					getContainer = $(getPlayer).closest('.background-element');
1356					if (getContainer.length) {
1357						UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)');
1358					}
1359
1360					if ( $this.hasClass('drop-move') ) {
1361
1362						var $iframe = $(getPlayer),
1363							w = parseFloat($iframe.attr('width')),
1364							h = parseFloat($iframe.attr('height')),
1365							ratio = h / w,
1366							setResizeiFto,
1367						resizeiFrame = function(){
1368							var dataW = $this.attr('data-w'),
1369								newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
1370								newH = newW * ratio;
1371							$iframe.css({
1372								width: newW,
1373								height: newH
1374							});
1375						};
1376						resizeiFrame();
1377						$(window).on( 'load', resizeiFrame );
1378						$(window).on( 'resize', function(){
1379							clearRequestTimeout(setResizeiFto);
1380							setResizeiFto = requestTimeout( function() {
1381								resizeiFrame();
1382							}, 10 );
1383						});
1384
1385					}
1386
1387				}
1388			});
1389		}
1390	});
1391
1392	$(window).on('load', function(){
1393		$('.mejs-fullscreen-button button').on('click', function(){
1394			var $button = $(this),
1395				$stuck = $button.closest('.is_stucked');
1396
1397			if ( $stuck.length ) {
1398				$stuck = $(this).trigger("sticky_kit:detach");
1399				window.scrollTo(0, 0);
1400			}
1401		});
1402	});
1403};
1404
1405UNCODE.backgroundSelfVideos = function( $ctx ) {
1406
1407	if ( typeof $ctx === 'undefined' ) {
1408		$ctx = $('body');
1409	}
1410
1411	var backgroundSelfVideosInit = function( $ctx ) {
1412		$(".background-video-shortcode", $ctx).each(function(index, el) {
1413			if ( SiteParameters.block_mobile_videos === true ) {
1414				return false;
1415			}
1416			if ( $(this).closest('mediaelementwrapper').length ) {
1417				return true;
1418			}
1419			var $video_el = $(this),
1420				$parent_carousel = $video_el.parents('.uncode-slider').eq(0),
1421				$parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'),
1422				video_id = $video_el.attr('id');
1423
1424			if ( SiteParameters.is_frontend_editor ) {
1425				video_id = video_id + '_' + index;
1426				$video_el.attr('id', video_id);
1427			}
1428
1429			if (typeof MediaElement === "function") {
1430				var media = new MediaElement(video_id, {
1431					startVolume: 0,
1432					loop: true,
1433					success: function(mediaElement, domObject) {
1434						domObject.volume = 0;
1435						$(mediaElement).data('started', false);
1436						mediaElement.addEventListener('timeupdate', function(e) {
1437							if (!$(e.target).data('started')) {
1438								$(mediaElement).data('started', true);
1439							}
1440						});
1441						mediaElement.addEventListener('loadedmetadata', function(e) {
1442							mediaElement.play();
1443						});
1444						if (!UNCODE.isMobile) {
1445							requestTimeout(function() {
1446								UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)');
1447							}, 100);
1448						}
1449						if ( ($('html.firefox').length) && !$parent_carousel.length  ) {
1450							mediaElement.play();
1451						}
1452
1453						if ( $parent_drop_move.length ) {
1454							var setResizeMEto,
1455								resizeMediaElement = function(){
1456								var dataW = $parent_drop_move.attr('data-w'),
1457									videoW = domObject.width,
1458									videoH = domObject.height,
1459									newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
1460									newH = newW / ( videoW / videoH );
1461
1462								$(domObject).css({
1463									'height': newH,
1464									'width': newW
1465								});
1466							};
1467							$(window).on( 'resize load', function(){
1468								clearRequestTimeout(setResizeMEto);
1469								setResizeMEto = requestTimeout( function() {
1470									resizeMediaElement();
1471								}, 10 );
1472							});
1473						}
1474
1475						mediaElement.addEventListener('play', function() {
1476							$(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
1477							$(mediaElement).closest('#page-header').addClass('video-started');
1478							$(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
1479						}, true);
1480
1481					},
1482					// fires when a problem is detected
1483					error: function() {}
1484				});
1485
1486			} else {
1487				$video_el[0].play();
1488				$video_el[0].addEventListener('play', function() {
1489					$video_el[0].muted = true;
1490					$video_el[0].loop = true;
1491					$video_el.closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
1492					$video_el.closest('#page-header').addClass('video-started');
1493					$video_el.closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
1494				}, false);
1495			}
1496		});
1497	};
1498
1499	backgroundSelfVideosInit( $ctx );
1500
1501	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
1502		window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
1503			var $el = model.view.$el,
1504				shortcode = model.attributes.shortcode;
1505
1506			backgroundSelfVideosInit( $el );
1507		});
1508	}
1509};
1510
1511UNCODE.is_scrolling = false;
1512
1513UNCODE.disableHoverScroll = function() {
1514
1515	if (!UNCODE.isMobile && !UNCODE.isFullPage) {
1516		var body = document.body,
1517		timer;
1518
1519		window.addEventListener('scroll', function() {
1520			var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300;
1521			clearRequestTimeout(timer);
1522			if ( body.classList && !body.classList.contains('disable-hover') ) {
1523				body.classList.add('disable-hover');
1524				window.dispatchEvent(new CustomEvent('disable-hover'));
1525			}
1526			UNCODE.is_scrolling = true;
1527
1528			timer = requestTimeout(function() {
1529				if ( body.classList ) {
1530					body.classList.remove('disable-hover');
1531					window.dispatchEvent(new CustomEvent('enable-hover'));
1532				}
1533				UNCODE.is_scrolling = false;
1534			}, delay);
1535		}, false);
1536	}
1537};
1538
1539UNCODE.isotopeLayout = function() {
1540	if ($('.isotope-layout').length > 0) {
1541		var isotopeContainersArray = [],
1542			typeGridArray = [],
1543			layoutGridArray = [],
1544			screenLgArray = [],
1545			screenMdArray = [],
1546			screenSmArray = [],
1547			transitionDuration = [],
1548			$filterItems = [],
1549			$filters = $('.isotope-system .isotope-filters'),
1550			$itemSelector = '.tmb-iso',
1551			$items,
1552			itemMargin,
1553			correctionFactor = 0,
1554			firstLoad = true,
1555			isOriginLeft = $('body').hasClass('rtl') ? false : true;
1556		$('[class*="isotope-container"]').each(function(index) {
1557			var _this = $(this);
1558			var isoData = _this.data(),
1559			$data_lg,
1560			$data_md,
1561			$data_sm;
1562			_this.children('.tmb').addClass('tmb-iso');
1563			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
1564			else $data_lg = '1000';
1565			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
1566			else $data_md = '600';
1567			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
1568			else $data_sm = '480';
1569			screenLgArray.push($data_lg);
1570			screenMdArray.push($data_md);
1571			screenSmArray.push($data_sm);
1572			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
1573			if (isoData.type == 'metro') typeGridArray.push(true);
1574			else typeGridArray.push(false);
1575			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
1576			else layoutGridArray.push('masonry');
1577			isotopeContainersArray.push(_this);
1578			_this.attr('data-iso-index', index);
1579		});
1580		var colWidth = function(index) {
1581				$(isotopeContainersArray[index]).width('');
1582				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
1583					widthAvailable = $(isotopeContainersArray[index]).width(),
1584					columnNum = 12,
1585					columnWidth = 0,
1586					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
1587					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
1588					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
1589					$rowContainer,
1590					paddingRow,
1591					$colContainer,
1592					paddingCol;
1593
1594				if ( consider_menu )
1595					winHeight = winHeight - UNCODE.menuHeight;
1596
1597				if ( data_vp_height === '1' ) {
1598					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
1599					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
1600					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
1601					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
1602					winHeight = winHeight - ( paddingRow + paddingCol );
1603				}
1604
1605				if (isPx) {
1606					columnWidth = Math.ceil(widthAvailable / columnNum);
1607					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
1608				} else {
1609					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
1610				}
1611				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
1612				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
1613				for (var i = 0, len = $items.length; i < len; i++) {
1614					var $item = $($items[i]),
1615						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
1616						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
1617						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
1618
1619
1620					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
1621						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
1622					}
1623
1624					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
1625						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
1626					}
1627
1628					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
1629						if (multiplier_w != null && multiplier_w[1] !== undefined) {
1630							switch (parseInt(multiplier_w[1])) {
1631								case (5):
1632								case (4):
1633								case (3):
1634									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
1635									multiplier_w[1] = 6;
1636									break;
1637								case (2):
1638								case (1):
1639									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
1640									multiplier_w[1] = 3;
1641									break;
1642								default:
1643									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
1644									multiplier_w[1] = 12;
1645									break;
1646							}
1647
1648							if (multiplier_w[1] == 2.4) { // 5 columns
1649								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
1650								multiplier_w[1] = 6;
1651							}
1652						}
1653					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
1654						if (multiplier_w != null && multiplier_w[1] !== undefined) {
1655							switch (parseInt(multiplier_w[1])) {
1656								case (5):
1657								case (4):
1658								case (3):
1659								case (2):
1660								case (1):
1661									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
1662									multiplier_w[1] = 6;
1663									break;
1664								default:
1665									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
1666									multiplier_w[1] = 12;
1667									break;
1668							}
1669
1670							if (multiplier_w[1] == 2.4) { // 5 columns
1671								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
1672								multiplier_w[1] = 6;
1673							}
1674						}
1675					} else if (widthAvailable < screenSmArray[index]) {
1676						if (multiplier_w != null && multiplier_w[1] !== undefined) {
1677							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
1678							multiplier_w[1] = 12;
1679							if (typeGridArray[index]) multiplier_h[1] = 12;
1680						}
1681					}
1682					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
1683						height;
1684
1685					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
1686						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
1687						if ( widthAvailable < screenSmArray[index] ) {
1688							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
1689						}
1690					} else {
1691						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
1692					}
1693
1694					if (width >= widthAvailable) {
1695						$item.css({
1696							width: widthAvailable
1697						});
1698						if (typeGridArray[index]) {
1699							$item.children().add($item.find('.backimg')).css({
1700								height: height
1701							});
1702						}
1703					} else {
1704						$item.css({
1705							width: width
1706						});
1707						if (typeGridArray[index]) {
1708							$item.children().add($item.find('.backimg')).css({
1709								height: height
1710							});
1711						}
1712					}
1713				}
1714				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
1715					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
1716				} else {
1717					return columnWidth;
1718				}
1719			},
1720			init_isotope = function() {
1721				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
1722					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
1723						isotopeId = isotopeSystem.attr('id'),
1724						$layoutMode = layoutGridArray[i],
1725						setIsotopeFirstRowTimeOut,
1726					setIsotopeFirstRow = function(items){
1727						var firstRow = true;
1728						$(items).each(function(index, val){
1729							var el = items[index].element,
1730								el_top = items[index].position.y,
1731								$el = $(el);
1732							if ( index > 0 && el_top > 0 && firstRow ) {
1733								firstRow = false;
1734							} else if ( index == 0 && el_top == 0 ) {
1735								firstRow = true;
1736							}
1737							if ( firstRow ) {
1738								$el.removeClass('tmb-isotope-further-row');
1739							} else {
1740								$el.addClass('tmb-isotope-further-row');
1741							}
1742						});
1743					};
1744					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
1745						//resizable: true,
1746						itemSelector: $itemSelector,
1747						layoutMode: $layoutMode,
1748						transitionDuration: transitionDuration[i],
1749						masonry: {
1750							columnWidth: colWidth(i)
1751						},
1752						vertical: {
1753							horizontalAlignment: 0.5,
1754						},
1755						sortBy: 'original-order',
1756						isOriginLeft: isOriginLeft
1757					})
1758					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
1759					.on('layoutComplete', function( event, items ){
1760						if ( typeof items[0] !== 'undefined' ) {
1761							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
1762								setIsotopeFirstRow(items);
1763							}
1764						}
1765					})
1766					.on('arrangeComplete', function( event, items ){
1767						if ( typeof items[0] !== 'undefined' ) {
1768							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
1769								clearRequestTimeout(setIsotopeFirstRowTimeOut);
1770								setIsotopeFirstRowTimeOut = requestTimeout(function(){
1771									setIsotopeFirstRow(items);
1772								}, 100);
1773							}
1774						}
1775					});
1776					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
1777						$(isotopeContainersArray[i]).infinitescroll({
1778								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
1779								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
1780								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li', // selector for all items you'll retrieve
1781								animate: false,
1782								behavior: 'local',
1783								debug: false,
1784								loading: {
1785									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
1786									speed: 0,
1787									finished: undefined,
1788									msg: $('#' + isotopeId + ' .loadmore-button'),
1789								},
1790								errorCallback: function() {
1791									var isotope_system = $(this).closest('.isotope-system');
1792									$('.loading-button', isotope_system).hide();
1793									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
1794								}
1795							},
1796							// append the new items to isotope on the infinitescroll callback function.
1797							function(newElements, opts) {
1798								var $isotope = $(this),
1799									isotopeId = $isotope.closest('.isotope-system').attr('id'),
1800									filters = new Array(),
1801									$loading_button = $isotope.closest('.isotope-system').find('.loading-button'),
1802									$infinite_button = $isotope.closest('.isotope-system').find('.loadmore-button'),
1803									$numPages = $('a', $infinite_button).data('pages'),
1804									delay = 300;
1805								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
1806								$infinite_button.show();
1807								$loading_button.hide();
1808								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
1809								$('> li', $isotope).remove();
1810								$.each($(newElements), function(index, val) {
1811									$(val).addClass('tmb-iso');
1812									if ($(val).is("li")) {
1813										filters.push($(val)[0]);
1814									}
1815								});
1816								newElements = newElements.filter(function(x) {
1817									return filters.indexOf(x) < 0
1818								});
1819								$.each($(filters), function(index, val) {
1820									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
1821								});
1822								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
1823								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
1824									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
1825									if (typeof getLightbox === 'object') {
1826										getLightbox.refresh();
1827									} else {
1828										UNCODE.lightbox();
1829									}
1830								}
1831								if ( typeof twttr !== 'undefined' )
1832									twttr.widgets.load(isotopeContainersArray[i]);
1833
1834								requestTimeout(function() {
1835									Waypoint.refreshAll();
1836									$isotope.trigger('more-items-loaded');
1837								}, 1000);
1838
1839							});
1840						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
1841							var $infinite_isotope = $(isotopeContainersArray[i]),
1842								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
1843							$infinite_isotope.infinitescroll('pause');
1844							$infinite_button.on('click', function(event) {
1845								event.preventDefault();
1846								var $infinite_system = $(event.target).closest('.isotope-system'),
1847								$infinite_isotope = $infinite_system.find('.isotope-container'),
1848								isotopeId = $infinite_system.attr('id');
1849								$(event.currentTarget).html(SiteParameters.loading);
1850								$infinite_isotope.infinitescroll('resume');
1851								$infinite_isotope.infinitescroll('retrieve');
1852								$infinite_isotope.infinitescroll('pause');
1853							});
1854						}
1855					}
1856				}
1857			},
1858			onLayout = function(isotopeObj, startIndex, needsReload) {
1859				var needsReload = needsReload ? true : false;
1860
1861				if (typeof UNCODE.bigText !== 'undefined') {
1862					UNCODE.bigText();
1863				}
1864				isotopeObj.css('opacity', 1);
1865				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
1866
1867				requestTimeout(function() {
1868					if (startIndex > 0) {
1869						reloadIsotope(isotopeObj);
1870						if (SiteParameters.dynamic_srcset_active === '1') {
1871							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
1872							UNCODE.adaptive_srcset(isotopeObj);
1873						}
1874						// window.dispatchEvent(UNCODE.boxEvent);
1875					} else if (needsReload) {
1876						reloadIsotope(isotopeObj);
1877					}
1878
1879					UNCODE.adaptive();
1880					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
1881						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
1882					}
1883					if (typeof MediaElement === "function") {
1884						$(isotopeObj).find('audio,video').each(function() {
1885							$(this).mediaelementplayer({
1886	 							pauseOtherPlayers: false,
1887							});
1888						});
1889					}
1890					if ($(isotopeObj).find('.nested-carousel').length) {
1891						if (typeof UNCODE.carousel !== 'undefined') {
1892							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
1893						}
1894						requestTimeout(function() {
1895							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
1896						}, 200);
1897					} else {
1898						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
1899					}
1900					isotopeObj.trigger('isotope-layout-complete');
1901
1902				}, 100);
1903
1904			},
1905			boxAnimation = function(items, startIndex, sequential, container) {
1906				var $allItems = items.length - startIndex,
1907					showed = 0,
1908					index = 0;
1909				if (container.closest('.owl-item').length == 1) return false;
1910				$.each(items, function(index, val) {
1911					var $this = $(val),
1912						elInner = $('> .t-inside', val);
1913					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
1914						return;
1915					}
1916					if (val[0]) val = val[0];
1917					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
1918						new Waypoint({
1919							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
1920							element: val,
1921							handler: function() {
1922								var element = $('> .t-inside', this.element),
1923									parent = $(this.element),
1924									currentIndex = parent.index();
1925								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
1926									delayAttr = parseInt(element.attr('data-delay'));
1927								if (isNaN(delayAttr)) delayAttr = 100;
1928								delay -= showed;
1929								var objTimeout = requestTimeout(function() {
1930									element.removeClass('zoom-reverse').addClass('start_animation');
1931									showed = parent.index();
1932									if ( container.data('isotope') ) {
1933										container.isotope('layout');
1934									}
1935								}, delay * delayAttr)
1936								parent.data('objTimeout', objTimeout);
1937								if (!UNCODE.isUnmodalOpen) {
1938									this.destroy();
1939								}
1940							},
1941							offset: '100%'
1942						})
1943					} else {
1944						if (elInner.hasClass('force-anim')) {
1945							elInner.addClass('start_animation');
1946						} else {
1947							elInner.css('opacity', 1);
1948						}
1949						container.isotope('layout');
1950					}
1951
1952					index++;
1953				});
1954			},
1955			reloadIsotope = function(isotopeObj) {
1956				var isoIndex = $(isotopeObj).attr('data-iso-index');
1957				var $layoutMode = ($(isotopeObj).data('layout'));
1958				if ($layoutMode === undefined) {
1959					$layoutMode = 'masonry';
1960				}
1961				if (isotopeObj.data('isotope')) {
1962					isotopeObj.isotope({
1963						itemSelector: $itemSelector,
1964						layoutMode: $layoutMode,
1965						transitionDuration: transitionDuration[isoIndex],
1966						masonry: {
1967							columnWidth: colWidth(isoIndex)
1968						},
1969						vertical: {
1970							horizontalAlignment: 0.5,
1971						},
1972						sortBy: 'original-order',
1973						isOriginLeft: isOriginLeft
1974					});
1975				}
1976			}
1977			;
1978		if ($('.isotope-pagination').length > 0) {
1979			$('.isotope-system').on('click', '.pagination a', function(evt) {
1980				evt.preventDefault();
1981
1982                var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
1983					container = $(this).closest('.isotope-system'),
1984                    calc_scroll = container.closest('.row-parent').offset().top;
1985                calc_scroll -= UNCODE.get_scroll_offset();
1986
1987				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
1988					delta = bodyTop - calc_scroll,
1989					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
1990				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
1991
1992				if ( !UNCODE.isFullPage ) {
1993					if (scrollSpeed == 0) {
1994						$('html, body').scrollTop(calc_scroll);
1995					} else {
1996						$('html, body').animate({
1997							scrollTop: calc_scroll
1998						},{
1999							easing: 'easeInOutQuad',
2000							duration: scrollSpeed,
2001							complete: function(){
2002								UNCODE.scrolling = false;
2003							}
2004						});
2005					}
2006				}
2007
2008				loadIsotope($(this));
2009				evt.preventDefault();
2010			});
2011		}
2012		$filters.on('click', 'a.isotope-nav-link', function(evt) {
2013			if ($(this).hasClass('no-isotope-filter')) {
2014				return;
2015			}
2016			var $filter = $(this),
2017				filterContainer = $filter.closest('.isotope-filters'),
2018				filterValue = $filter.attr('data-filter'),
2019				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
2020				transitionDuration = container.data().isotope.options.transitionDuration,
2021				delay = 300,
2022				filterItems = [];
2023
2024			var filter_items = function(){
2025				if (filterValue !== undefined) {
2026					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
2027						var parent = $(val).parent(),
2028							objTimeout = parent.data('objTimeout');
2029						if (objTimeout) {
2030							$(val).removeClass('zoom-reverse').removeClass('start_animation')
2031							clearRequestTimeout(objTimeout);
2032						}
2033						if (transitionDuration == 0) {
2034							if ($(val).hasClass('animate_when_almost_visible')) {
2035								$(val).addClass('zoom-reverse').removeClass('start_animation');
2036							} else {
2037								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
2038							}
2039						}
2040					});
2041					requestTimeout(function(){
2042						if ( filterValue == '*' ) {
2043							container.removeClass('isotope-filtered');
2044						} else {
2045							container.addClass('isotope-filtered');
2046						}
2047						container.isotope({
2048							filter: function() {
2049								var block = $(this),
2050								filterable = (filterValue == '*') || block.hasClass(filterValue),
2051								lightboxElements = $('[data-lbox^=ilightbox]', block);
2052								if (filterable) {
2053									if (lightboxElements.length) {
2054										lightboxElements.removeClass('lb-disabled');
2055										container.data('lbox', $(lightboxElements[0]).data('lbox'));
2056									}
2057									filterItems.push(block);
2058								} else {
2059									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
2060								}
2061								container.trigger('more-items-loaded');
2062								return filterable;
2063							}
2064						});
2065						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
2066
2067					}, delay);
2068
2069					/** once filtered - start **/
2070					container.isotope('once', 'arrangeComplete', function() {
2071						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2072							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
2073							if (typeof getLightbox === 'object') {
2074								getLightbox.refresh();
2075							} else {
2076								UNCODE.lightbox();
2077							}
2078						}
2079						if (transitionDuration == 0) {
2080							requestTimeout(function() {
2081								boxAnimation(filterItems, 0, false, container);
2082							}, 100);
2083						}
2084						requestTimeout(function() {
2085							Waypoint.refreshAll();
2086						}, 2000);
2087					});
2088					/** once filtered - end **/
2089				} else {
2090					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2091						$.each(UNCODE.lightboxArray, function(index, val) {
2092							UNCODE.lightboxArray[index].destroy();
2093						});
2094					}
2095					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
2096						var parent = $(val).parent(),
2097							objTimeout = parent.data('objTimeout');
2098						if (objTimeout) {
2099							$(val).removeClass('zoom-reverse').removeClass('start_animation')
2100							clearRequestTimeout(objTimeout);
2101						}
2102						if (transitionDuration == 0) {
2103							if ($(val).hasClass('animate_when_almost_visible')) {
2104								$(val).addClass('zoom-reverse').removeClass('start_animation');
2105							} else {
2106								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
2107							}
2108						}
2109					});
2110					container.parent().addClass('grid-loading');
2111					loadIsotope($filter);
2112				}
2113			};
2114
2115			if (!$filter.hasClass('active')) {
2116				/** Scroll top with filtering */
2117				if (filterContainer.hasClass('filter-scroll')) {
2118                    var calc_scroll = container.closest('.row-parent').offset().top;
2119                    calc_scroll -= UNCODE.get_scroll_offset();
2120
2121					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
2122						delta = bodyTop - calc_scroll,
2123						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
2124						filterTolerance = false,
2125						filter_timeout;
2126					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
2127
2128					if ( !UNCODE.isFullPage ) {
2129						if (scrollSpeed == 0) {
2130							$('html, body').scrollTop(calc_scroll);
2131							UNCODE.scrolling = false;
2132							filter_items();
2133						} else {
2134
2135							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
2136								filter_items();
2137								filterTolerance = true;
2138							}
2139
2140							$('html, body').animate({
2141								scrollTop: calc_scroll
2142							},{
2143								easing: 'easeInOutQuad',
2144								duration: scrollSpeed,
2145								complete: function(){
2146									UNCODE.scrolling = false;
2147									if ( !filterTolerance ) {
2148										filter_timeout = setTimeout(function(){
2149											clearTimeout(filter_timeout);
2150											filter_items();
2151										}, 200);
2152									}
2153								}
2154							});
2155						}
2156					}
2157				} else {
2158					filter_items();
2159				}
2160			}
2161			evt.preventDefault();
2162		});
2163		$(window).on("popstate", function(e) {
2164			if (e.originalEvent.state === null) return;
2165			var params = {};
2166			if (location.search) {
2167				var parts = location.search.substring(1).split('&');
2168				for (var i = 0; i < parts.length; i++) {
2169					var nv = parts[i].split('=');
2170					if (!nv[0]) continue;
2171					params[nv[0]] = nv[1] || true;
2172				}
2173			}
2174			if (params.id === undefined) {
2175				$.each($('.isotope-system'), function(index, val) {
2176					loadIsotope($(val));
2177				});
2178			} else loadIsotope($('#' + params.id));
2179		});
2180
2181		var loadIsotope = function($href) {
2182			var href = ($href.is("a") ? $href.attr('href') : location),
2183				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
2184				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
2185				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
2186				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
2187				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
2188				isotopeId = isotopeSystem.attr('id');
2189			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
2190				history.pushState({
2191					myIsotope: true
2192				}, document.title, href);
2193			}
2194			$.ajax({
2195				url: href
2196			}).done(function(data) {
2197				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
2198					$resultPagination = $(data).find('#' + isotopeId + ' .pagination'),
2199					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count');
2200				isotopeWrapper.addClass('isotope-reloaded');
2201				requestTimeout(function() {
2202					isotopeWrapper.removeClass('grid-loading');
2203					isotopeWrapper.removeClass('isotope-reloaded');
2204				}, 500);
2205				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
2206					var parent = $(val).parent(),
2207						objTimeout = parent.data('objTimeout');
2208					if (objTimeout) {
2209						$(val).removeClass('zoom-reverse').removeClass('start_animation')
2210						clearRequestTimeout(objTimeout);
2211					}
2212					if ($(val).hasClass('animate_when_almost_visible')) {
2213						$(val).addClass('zoom-reverse').removeClass('start_animation');
2214					} else {
2215						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
2216					}
2217				});
2218				requestTimeout(function() {
2219					if (isotopeContainer.data('isotope')) {
2220						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
2221						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
2222						UNCODE.adaptive();
2223						if (SiteParameters.dynamic_srcset_active === '1') {
2224							UNCODE.adaptive_srcset(isotopeContainer);
2225						}
2226						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2227							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
2228							if (typeof getLightbox === 'object') {
2229								getLightbox.refresh();
2230							} else {
2231								UNCODE.lightbox();
2232							}
2233						}
2234					}
2235					isotopeContainer.trigger('more-items-loaded');
2236				}, 300);
2237				$('.pagination', isotopeFooter).remove();
2238				isotopeFooter.append($resultPagination);
2239
2240				if (isotopeResultCount.length > 0) {
2241					$('.woocommerce-result-count', isotopeResultCount).remove();
2242					isotopeResultCount.append($resultCount);
2243				}
2244			});
2245		};
2246		$filters.each(function(i, buttonGroup) {
2247			var $buttonGroup = $(buttonGroup);
2248			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
2249				$buttonGroup.find('.active').removeClass('active');
2250				$(this).addClass('active');
2251
2252			});
2253
2254			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
2255				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
2256				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
2257			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
2258				e.preventDefault();
2259				$cats_filters.slideToggle(400, 'easeInOutCirc');
2260			});
2261
2262		});
2263		window.addEventListener('boxResized', function(e) {
2264			if (UNCODE.printDialogOpen !== false) {
2265				return false;
2266			}
2267			$.each($('.isotope-layout'), function(index, val) {
2268				var $layoutMode = ($(this).data('layout'));
2269				if ($layoutMode === undefined) $layoutMode = 'masonry';
2270				if ($(this).data('isotope')) {
2271					$(this).isotope({
2272						itemSelector: $itemSelector,
2273						layoutMode: $layoutMode,
2274						transitionDuration: transitionDuration[index],
2275						masonry: {
2276							columnWidth: colWidth(index)
2277						},
2278						vertical: {
2279							horizontalAlignment: 0.5,
2280						},
2281						sortBy: 'original-order',
2282						isOriginLeft: isOriginLeft
2283					});
2284					$(this).isotope('unbindResize');
2285					if (SiteParameters.dynamic_srcset_active === '1') {
2286						UNCODE.refresh_dynamic_srcset_size($(this));
2287					}
2288				}
2289				$(this).find('.mejs-video,.mejs-audio').each(function() {
2290					$(this).trigger('resize');
2291				});
2292			});
2293		}, false);
2294
2295		init_isotope();
2296	};
2297}
2298
2299UNCODE.lightbox = function() {
2300	if ( SiteParameters.lbox_enhanced ) {
2301		return true;
2302	}
2303	UNCODE.lightboxArray = {};
2304	requestTimeout(function() {
2305		var groupsArr = {};
2306		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() {
2307			var group = this.getAttribute("data-lbox"),
2308				values = $(this).data();
2309			$(this).attr('data-lbox-init','true')
2310			groupsArr[group] = values;
2311		});
2312		for (var i in groupsArr) {
2313			var skin = groupsArr[i].skin || 'black',
2314				path = groupsArr[i].dir || 'horizontal',
2315				thumbs = !groupsArr[i].notmb || false,
2316				arrows = !groupsArr[i].noarr || false,
2317				social = groupsArr[i].social || false,
2318				deeplink = groupsArr[i].deep || false,
2319				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'),
2320				counter = $els.length,
2321				dataAlbum = $els.attr('data-album');
2322			if (social) social = {
2323				facebook: true,
2324				twitter: true,
2325				reddit: true,
2326				digg: true
2327			};
2328			UNCODE.lightboxArray[i] = $els.iLightBox({
2329				selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)',
2330				skin: skin,
2331				path: path,
2332				linkId: deeplink,
2333				infinite: false,
2334				//fullViewPort: 'fit',
2335				smartRecognition: false,
2336				fullAlone: true,
2337				maxScale: 1,
2338				minScale: .02,
2339				//fullStretchTypes: 'flash, video',
2340				overlay: {
2341					opacity: .94
2342				},
2343				controls: {
2344					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
2345					fullscreen: true,
2346					thumbnail: thumbs,
2347					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
2348				},
2349				show: {
2350					speed: 200
2351				},
2352				hide: {
2353					speed: 200
2354				},
2355				social: {
2356					start: false,
2357					buttons: social
2358				},
2359				caption: {
2360					start: false
2361				},
2362				styles: {
2363					nextOpacity: 1,
2364					nextScale: 1,
2365					prevOpacity: 1,
2366					prevScale: 1
2367				},
2368				effects: {
2369					switchSpeed: 400
2370				},
2371				slideshow: {
2372					pauseTime: 5000
2373				},
2374				thumbnails: {
2375					maxWidth: 60,
2376					maxHeight: 60,
2377					activeOpacity: .2
2378				},
2379				html5video: {
2380					preload: true
2381				},
2382				callback: {
2383					onOpen: function(){
2384						$(window).trigger('uncode-custom-cursor');
2385						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
2386							iNoBounce.enable();
2387						}
2388					},
2389					onHide: function(){
2390						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
2391							iNoBounce.disable()
2392						}
2393					},
2394				}
2395			});
2396
2397			$(document).on('infinite-loaded', function(){
2398				UNCODE.lightboxArray[i].refresh();
2399			});
2400
2401			$(window).on('gdprOpen', function(){
2402				UNCODE.lightboxArray[i].close();
2403			});
2404		};
2405	}, 100);
2406
2407	$(document).on('click', '.lb-disabled', function(e){
2408		e.preventDefault();
2409	});
2410};
2411
2412UNCODE.lightgallery = function( $el ) {
2413	var createSelectors = function(){
2414		$('a[data-lbox]:not([data-lbox-init]):not([data-album])').each(function(){
2415			if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
2416				$(this).addClass('lbox-trigger-item');
2417			} else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
2418				$(this).addClass('lbox-nested-item');
2419			} else {
2420				$(this).removeClass('lbox-trigger-item');
2421				$(this).removeClass('lbox-nested-item');
2422			}
2423		});
2424	};
2425
2426	createSelectors();
2427
2428	var galleries = [],
2429		nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
2430			return !$(this).closest('.nested-carousel').length;
2431		}),
2432		$_galleries = $('.isotope-container:not([data-lbox-init]), .owl-carousel:not([data-lbox-init]), .custom-grid-container:not([data-lbox-init]), .index-scroll-wrapper:not([data-lbox-init]), .justified-gallery:not([data-lbox-init]), .uncode-single-media-wrapper:not([data-lbox-init]), .woocommerce-product-gallery:not([data-lbox-init]), .icon-box:not([data-lbox-init]), .grid-container:not([data-lbox-init]), .btn-container').has('.lbox-trigger-item'),
2433		$galleries = $_galleries.filter(function( index ) {
2434			return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
2435		}),
2436		$nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item');
2437
2438	if ( typeof $el === 'undefined' ) {
2439		$el = $galleries.add( $nested );
2440	}
2441
2442	var $disabled = $('a.lb-disabled');
2443	$disabled.on('click', function(e){
2444		e.preventDefault();
2445	});
2446
2447	var beforeSlide = function(event) {
2448		var detail = event.detail,
2449			info = detail.info,
2450			item = detail.item,
2451			$slide = $(detail.currentSlide.selector),
2452			$video = $('video', $slide),
2453			$previous = $(detail.previousSlide.selector),
2454			$prevVideo = $('video', $previous),
2455			isAudio = false;
2456
2457		if ( typeof info.src !== 'undefined' ) {
2458			isAudio = info.src.search(/.mp3|.m4a/i) > -1;
2459		}
2460
2461		if ( ! $video.length && ( info.video || isAudio ) ) {
2462			if ( info.video ) {
2463				if ( typeof info.video === 'object' ) {
2464					var infoJson = info.video;
2465				} else {
2466					var infoJson = JSON.parse(info.video);
2467				}
2468				var src = infoJson.source[0].src,
2469					autoplay = $(item).attr('data-autoplay'),
2470					loop = $(item).attr('data-loop');
2471
2472			} else if ( isAudio ) {
2473				var src = info.src,
2474					autoplay = true,
2475					loop = false;
2476			}
2477			if ( typeof src !== 'undefined' ) {
2478				$slide.addClass('has-html5');
2479				var video = document.createElement('video');
2480				video.src = src;
2481				video.preload = 'auto';
2482				video.controls = 'controls';
2483				video.controlsList = 'nodownload';
2484				if ( autoplay ) {
2485					video.autoplay = 'autoplay';
2486				}
2487				if ( loop ) {
2488					video.loop = 'loop';
2489				}
2490				$(video).appendTo($slide);
2491			}
2492		} else {
2493			var $video = $('video', $slide);
2494			if ( $video.length ) {
2495				$video[0].currentTime = 0;
2496				if ( $video[0].autoplay ) {
2497					$video[0].play();
2498				}
2499			}
2500		}
2501		if ( $prevVideo.length ) {
2502			$prevVideo[0].currentTime = 0;
2503			$prevVideo[0].pause();
2504		}
2505	};
2506
2507	var beforeOpen = function(event) {
2508		var detail = event.detail,
2509			items = detail.items,
2510			galleryItems = detail.galleryItems,
2511			outer = detail.outer.selector,
2512			i, ii;
2513		for ( i = 0; i < galleryItems.length; i++ ) {
2514			var item = galleryItems[i];
2515			if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) {
2516				$(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video');
2517			}
2518		}
2519		for ( ii = 0; ii < items.length; ii++ ) {
2520			var item = items[ii];
2521			if ( $(item).attr('data-icon') === 'video' ) {
2522				$(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video');
2523			}
2524		}
2525
2526	};
2527
2528	//regular galleries
2529	$el.each( function( index, val ) {
2530		var $gallery = $(this).attr('data-lbox-init','true'),
2531			$_a = '.lbox-trigger-item',
2532			$_nested_a = '.lbox-nested-item',
2533			$_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(),
2534			galleryID = $_first.attr('data-lbox'),
2535			$_connected_a = $_a + '[data-lbox="' + galleryID + '"]',
2536			tmb = $_first.attr('data-notmb'),
2537			social = $_first.attr('data-social'),
2538			deep = $_first.attr('data-deep'),
2539			zoom = $_first.attr('data-zoom-origin'),
2540			actual = $_first.attr('data-actual-size'),
2541			download = $_first.attr('data-download'),
2542			controls = $_first.attr('data-arrows') !== 'no',
2543			fullScreen = $_first.attr('data-full'),
2544			counter = $_first.attr('data-counter'),
2545			transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide',
2546			containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
2547			connect = $_first.attr('data-connect'),
2548			$currentVideo = false,
2549			lgPlugins = [lgVideo];
2550
2551		containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
2552		containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
2553
2554		if ( typeof tmb == 'undefined' || !tmb ) {
2555			lgPlugins.push(lgThumbnail);
2556		}
2557		if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) {
2558			lgPlugins.push(lgZoom);
2559		}
2560		if ( typeof deep != 'undefined' && deep != '' ) {
2561			lgPlugins.push(lgHash);
2562		}
2563		if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
2564			lgPlugins.push(lgFullscreen);
2565		}
2566		if ( social ) {
2567			lgPlugins.push(lgShare);
2568		}
2569
2570		if ( galleries.indexOf( galleryID ) !== -1 ) {
2571			return true;
2572		}
2573
2574		$gallery.find($_a, $_nested_a).each(function(){
2575			var $a = $(this),
2576				$img = $('img', $a).first(),
2577				imgw = $img.attr('data-width'),
2578				imgh = $img.attr('data-height'),
2579				caption = $a.attr('data-caption'),
2580				title = $a.attr('data-title');
2581
2582			if ( $img.length && $img.attr('data-crop') != true ) {
2583				if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) {
2584					$a.attr('data-external-thumb-image', $img.attr('data-guid'));
2585				} else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) {
2586					$a.attr('data-external-thumb-image', $img[0].src);
2587				}
2588			}
2589
2590			if ( typeof title !== 'undefined' && title !== '' ) {
2591				title = '<h6>' + title + '</h6>';
2592			} else {
2593				title = '';
2594			}
2595
2596			if ( typeof caption !== 'undefined' && caption !== '' ) {
2597				caption = '<p>' + caption + '</p>';
2598				title += caption;
2599			}
2600
2601			if ( title !== '' ) {
2602				$a.attr( 'title', title );
2603			}
2604
2605			if ( $img.attr('data-crop') != true && typeof imgw !== 'undefined' && typeof imgh !== 'undefined' && imgw !== '' && imgh !== '' && ( typeof $a.attr('data-lg-size') === 'undefined' || !$a.attr('data-lg-size') ) ) {
2606				$a.attr('data-lg-size', imgw + '-' + imgh);
2607			}
2608		});
2609
2610		galleries.push( galleryID );
2611		var $triggerGal = connect ? $('.page-wrapper') : $gallery,
2612			$selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a;
2613		var gallery = lightGallery( $triggerGal[0], {
2614			addClass: containerClass,
2615			plugins: lgPlugins,
2616			mode: transition,
2617			selector: $selector,
2618			galleryId: galleryID,
2619			thumbnail: ( typeof tmb == 'undefined' || !tmb ),
2620			iframeWidth: '848px',
2621			iframeMaxWidth: '90%',
2622			iframeMaxHeight: '90%',
2623			exThumbImage: 'data-external-thumb-image',
2624			loadYouTubeThumbnail: false,
2625			// autoplayFirstVideo: false,
2626			pager: false,
2627			startClass: 'lg-start-opacity',
2628			zoomFromOrigin: zoom,
2629			controls: controls,
2630			download: ( typeof download != 'undefined' && download != '' ),
2631			thumbWidth: 50,
2632			thumbHeight: '50px',
2633			counter: $triggerGal.find($selector).length > 1 ? counter : false,
2634			loadYouTubePoster: false,
2635			enableDrag: $triggerGal.find($selector).length > 1
2636		});
2637
2638		$('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){
2639			e.preventDefault();
2640			var index = $(this).closest('.owl-item.cloned').attr('data-index');
2641			gallery.openGallery(index-1);
2642		});
2643
2644		$triggerGal.on('more-items-loaded', function(e, items) {
2645			createSelectors();
2646			gallery.refresh();
2647		});
2648
2649		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2650			window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
2651				$el = model.view.$el;
2652				if ( $el.find($triggerGal).length ) {
2653					gallery.destroy();
2654				}
2655			});
2656		}
2657
2658		$triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide);
2659		$triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen);
2660		$triggerGal[0].addEventListener('lgAfterOpen', function(){
2661			$(window).trigger('uncode-custom-cursor');
2662		});
2663
2664	});
2665
2666	if ( typeof $el !== 'undefined' ) {
2667
2668		//album galleries
2669		$('a[data-album]:not([data-lbox-init])').each(function(index, val) {
2670			var album = val,
2671				galleryID = index,
2672				$album = $(album),
2673				params = $album.attr('data-album'),
2674				tmb = $(val).attr('data-notmb'),
2675				social = $(val).attr('data-social'),
2676				deep = $(val).attr('data-deep'),
2677				zoom = $(val).attr('data-zoom-origin'),
2678				actual = $(val).attr('data-actual-size'),
2679				download = $(val).attr('data-download'),
2680				controls = $(val).attr('data-arrows') !== 'no',
2681				fullScreen = $(val).attr('data-full'),
2682				counter = $(val).attr('data-counter'),
2683				transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide',
2684				containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
2685				$currentVideo = false,
2686				lgPlugins = [lgVideo];
2687
2688			$(val).attr('data-lbox-init','true');
2689
2690			containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
2691			containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
2692
2693			if ( typeof tmb == 'undefined' || !tmb ) {
2694				lgPlugins.push(lgThumbnail);
2695			}
2696			if ( typeof actual != 'undefined' && actual != '' ) {
2697				lgPlugins.push(lgZoom);
2698			}
2699			if ( typeof deep != 'undefined' && deep != '' ) {
2700				lgPlugins.push(lgHash);
2701			}
2702			if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
2703				lgPlugins.push(lgFullscreen);
2704			}
2705			if ( social ) {
2706				lgPlugins.push(lgShare);
2707			}
2708
2709			var gallery = window.lightGallery(album, {
2710				dynamic: true,
2711				plugins: lgPlugins,
2712				dynamicEl: JSON.parse(params),
2713				galleryId: galleryID,
2714				addClass: containerClass,
2715				mode: transition,
2716				thumbnail: ( typeof tmb == 'undefined' || !tmb ),
2717				iframeWidth: '848px',
2718				iframeMaxWidth: '90%',
2719				iframeMaxHeight: '90%',
2720				loadYouTubeThumbnail: false,
2721				// autoplayFirstVideo: false,
2722				pager: false,
2723				startClass: 'lg-start-opacity',
2724				zoomFromOrigin: false,
2725				controls: controls,
2726				download: ( typeof download != 'undefined' && download != '' ),
2727				thumbWidth: 50,
2728				thumbHeight: '50px',
2729				loadYouTubePoster: false,
2730				counter: counter
2731			});
2732
2733			$album.on('click', function(){
2734				gallery.openGallery(0);
2735			});
2736
2737			album.addEventListener('lgBeforeSlide', beforeSlide);
2738			album.addEventListener('lgBeforeOpen', beforeOpen);
2739			album.addEventListener('lgAfterOpen', function(){
2740				$(window).trigger('uncode-custom-cursor');
2741			});
2742
2743			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2744				window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
2745					$el = model.view.$el;
2746					if ( $el.find($album).length ) {
2747						gallery.destroy();
2748					}
2749				});
2750			}
2751
2752		});
2753
2754		//single images
2755		$('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) {
2756			var gallery = lightGallery( $('.page-wrapper')[0], {
2757				selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])',
2758				iframeWidth: '848px',
2759				iframeMaxWidth: '90%',
2760				iframeMaxHeight: '90%',
2761				loadYouTubeThumbnail: false,
2762				// autoplayFirstVideo: false,
2763				startClass: 'lg-start-opacity',
2764				thumbWidth: 50,
2765				thumbHeight: '50px',
2766				download: false,
2767				loadYouTubePoster: false,
2768				counter: false
2769			});
2770
2771			$('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide);
2772			$('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen);
2773		});
2774	}
2775};
2776
2777UNCODE.carousel = function(container) {
2778	var $owlContainers = $('.owl-carousel-container', container);
2779	$owlContainers.each(function() {
2780		var $owlContainer = $(this),
2781			$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
2782			$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
2783			values = {},
2784			tempTimeStamp,
2785			currentIndex,
2786			$owlInsideEqual = [];
2787		$owlSelector.each(function() {
2788			var itemID = $(this).attr('id'),
2789				$elSelector = $(('#' + itemID).toString());
2790			values['id'] = itemID;
2791			values['items'] = 1;
2792			values['columns'] = 3;
2793			values['fade'] = false;
2794			values['nav'] = false;
2795			values['navmobile'] = false;
2796			values['navskin'] = 'light';
2797			values['navspeed'] = 400;
2798			values['dots'] = false;
2799			values['dotsmobile'] = false;
2800			values['loop'] = false;
2801			values['autoplay'] = false;
2802			values['timeout'] = 3000;
2803			values['autoheight'] = false;
2804			values['stagepadding'] = 0;
2805			values['margin'] = 0;
2806			values['lg'] = 1;
2807			values['md'] = 1;
2808			values['sm'] = 1;
2809			$.each($(this).data(), function(i, v) {
2810				values[i] = v;
2811			});
2812
2813			if ($(this).closest('.uncode-slider').length) {
2814				values['navskin'] = '';
2815				values['navmobile'] = false;
2816				//values['dotsmobile'] = true;
2817			} else {
2818				values['navskin'] = ' style-'+values['navskin']+' style-override';
2819			}
2820
2821			var setIndexActive = function(event, init){
2822				var init = typeof init === 'undefined' ? false : init,
2823					thiis = $(event.currentTarget);
2824				if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
2825					var scrolltop = $(document).scrollTop(),
2826						size = event.page.size,
2827						i;
2828					var setIndex = requestTimeout(function() {
2829						for ( i = 0; i < size; i++ ) {
2830							var itemCont = event.item.index != null ? (event.item.index + i) : i;
2831							var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
2832							if (thiis.closest('.row-slider').length) {
2833								if (currentItem == undefined) {
2834									currentItem = thiis.children()[i];
2835								}
2836								if ($(currentItem).closest('#page-header').length) {
2837									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
2838										UNCODE.switchColorsMenu(scrolltop, 'dark');
2839									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
2840										UNCODE.switchColorsMenu(scrolltop, 'light');
2841									}
2842								}
2843							}
2844							var itendIndex = $(currentItem).attr('data-index');
2845							if ( isNaN(itendIndex) ) {
2846								itendIndex = 1;
2847							}
2848							$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
2849							$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
2850							if ($.fn.counterUp) {
2851								$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .counter').each(function(){
2852									var $counter = $(this);
2853									$counter.addClass('started').counterUp({
2854										delay: 10,
2855										time: 1500
2856									});
2857								});
2858							}
2859						}
2860						$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
2861					}, 200);
2862				}
2863				tempTimeStamp = event.timeStamp;
2864			}
2865
2866			/** Initialized */
2867			$elSelector.on('initialized.owl.carousel', function(event) {
2868
2869				if ( $('.isotope-container', event.currentTarget).length ) {
2870					window.dispatchEvent(UNCODE.boxEvent);
2871				}
2872
2873				$('.owl-dot.active', $elSelector).on('click', function(){
2874					return false;
2875				});
2876
2877				var thiis = $(event.currentTarget),
2878					// get the time from the data method
2879					time = thiis.data("timer-id"),
2880					rowParent = thiis.closest('.row-parent');
2881
2882				if ( typeof rowParent[0] !== 'undefined' ) {
2883					rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
2884				}
2885
2886				if (time) {
2887					clearRequestTimeout(time);
2888				}
2889
2890				thiis.addClass('showControls');
2891				var new_time = requestTimeout(function() {
2892					thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
2893					if (thiis.hasClass('owl-height-viewport'))
2894						setItemsRelHeight(thiis);
2895					if (thiis.hasClass('owl-height-equal'))
2896						setItemsHeight(thiis);
2897					if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
2898					if (thiis.closest('.unequal, .unexpand').length) {
2899						UNCODE.setRowHeight(rowParent[0], true);
2900					}
2901					if (SiteParameters.dynamic_srcset_active === '1') {
2902						UNCODE.refresh_dynamic_srcset_size(thiis);
2903					}
2904				}, 350);
2905				// save the new time
2906				thiis.data("timer-id", new_time);
2907
2908				var scrolltop = $(document).scrollTop();
2909				thiis.closest('.uncode-slider').find('video').removeAttr('poster');
2910
2911				//if (!UNCODE.isMobile) {
2912					/** fix autoplay when visible **/
2913				$(window).on('load', function(){
2914					if (thiis.data('autoplay')) {
2915						if ( !thiis.closest('.sticky-element').length ) {
2916							thiis.trigger('stop.autoplay.owl');
2917						} else {
2918							thiis.trigger('play.owl.autoplay');
2919						}
2920					}
2921					if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) {
2922						return;
2923					}
2924					if ( ! thiis.closest('.sticky-element').length ) {
2925						var carouselInView = new Waypoint.Inview({
2926							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
2927							element: thiis[0],
2928							exited: function() {
2929								var el = $(this.element);
2930								if (el.data('autoplay') ) {
2931									el.trigger('stop.owl.autoplay');
2932									el.data('stopped','true');
2933								}
2934							},
2935							enter: function(direction) {
2936								var el = $(this.element);
2937								requestTimeout(function() {
2938									if (el.data('autoplay')) {
2939										el.trigger('play.owl.autoplay');
2940										el.data('stopped','false');
2941									}
2942								}, 100);
2943							}
2944						});
2945					}
2946				});
2947				//}
2948
2949				// $(window).on('frontend:carousel_updated', function(){
2950				// 	Waypoint.refreshAll();
2951				// });
2952
2953				if (!thiis.closest('.isotope-system').length) {
2954					requestTimeout(function() {
2955						animate_thumb($('.t-inside', el), event);
2956					}, 400);
2957				} else {
2958					requestTimeout(function() {
2959						thiis.closest('.isotope-container').isotope('layout');
2960					}, 400);
2961				}
2962
2963				var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
2964				currentIndex = $(currentItem).attr('data-index');
2965
2966				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
2967					if ($(val).closest('.uncode-slider').length) {
2968						$(val).removeClass('start_animation');
2969					}
2970				});
2971				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
2972					if ($(val).closest('.uncode-slider').length) {
2973						$(val).removeClass('already-animated');
2974					}
2975				});
2976
2977				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
2978					if ($(val).closest('.uncode-slider').length) {
2979						$(val).removeAttr('data-animated');
2980					}
2981				});
2982
2983				$.each($('.owl-item.cloned', thiis), function(index, val) {
2984					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
2985				});
2986
2987				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
2988					if ($(val).attr('data-index') != currentIndex) {
2989						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
2990						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
2991					}
2992					if ($(val).attr('data-index') != currentIndex) {
2993						$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
2994					}
2995					if ($(val).attr('data-index') == currentIndex) {
2996						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
2997					}
2998				});
2999
3000				if (thiis.closest('.uncode-slider').length) {
3001					var el = thiis.closest('.row-parent')[0];
3002					if ($(el).data('imgready')) {
3003						firstLoaded(el, event);
3004					} else {
3005						el.addEventListener("imgLoaded", function(el) {
3006							firstLoaded(el.target, event);
3007						}, false);
3008					}
3009					var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
3010					if (transHeight != null) {
3011						requestTimeout(function() {
3012							thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
3013						}, 100);
3014					}
3015				} else {
3016					var el = thiis;
3017					el.closest('.uncode-slider').addClass('slider-loaded');
3018				}
3019
3020				requestTimeout(function() {
3021					if (typeof UNCODE.bigText !== 'undefined') {
3022						UNCODE.bigText(thiis);
3023					}
3024					if (thiis.closest('.uncode-slider').length) {
3025						if (thiis.data('autoplay')) pauseOnHover(thiis);
3026					}
3027				}, 500);
3028
3029				if (thiis.closest('.unequal').length) {
3030					$owlInsideEqual.push(thiis.closest('.row-parent'));
3031				}
3032
3033				var containerClasses = '',
3034					containerStyle = '';
3035				if ( $('.owl-dots-classes', $owlContainer).length ) {
3036					containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
3037					containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
3038					$('.owl-dots-classes', $owlContainer).remove();
3039				}
3040
3041				if ( containerClasses !== '' ) {
3042					requestTimeout(function() {
3043						if ( containerClasses !== '' )
3044							$('.owl-dots', $owlContainer).attr('style', containerStyle);
3045						if ( containerStyle !== '' )
3046							$('.owl-dots', $owlContainer).addClass(containerClasses);
3047					}, 100);
3048				}
3049
3050				$.each($('.column_child.pos-bottom', thiis), function(index, val) {
3051					$(val).closest('.row-inner').css({
3052						'margin-top': '-1px'
3053					});
3054				});
3055
3056				if ($.fn.isotope) {
3057					if ( thiis.closest('.isotope-container').length ) {
3058						if (thiis.closest('.isotope-container').data('isotope')) {
3059							requestTimeout(function(){
3060								thiis.closest('.isotope-container').isotope('layout');
3061							}, 300);
3062						}
3063						$(window).on('load', function(){
3064							if (thiis.closest('.isotope-container').data('isotope')) {
3065								thiis.closest('.isotope-container').isotope('layout');
3066							}
3067						});
3068					}
3069				}
3070
3071				if (thiis.data('autoplay')) {
3072					$(window).on('menuOpen', function(){
3073						thiis.trigger('stop.owl.autoplay');
3074						thiis.data('stopped','true');
3075					}).on('menuClose', function(){
3076
3077					});
3078				}
3079				$(window).on('menuClose', function(){
3080					if (thiis.data('autoplay')) {
3081						thiis.trigger('play.owl.autoplay');
3082						thiis.data('stopped','false');
3083					}
3084				});
3085
3086				setIndexActive(event, true);
3087
3088				var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
3089						return !$(this).closest('.nested-carousel').length;
3090					}),
3091					$galleries = $('.isotope-container:not([data-lbox-init]), .owl-carousel:not([data-lbox-init]), .custom-grid-container:not([data-lbox-init]), .index-scroll-wrapper:not([data-lbox-init]), .justified-gallery:not([data-lbox-init]), .uncode-single-media-wrapper:not([data-lbox-init]), .woocommerce-product-gallery:not([data-lbox-init]), .icon-box:not([data-lbox-init]), .grid-container:not([data-lbox-init])', thiis).has(nested_a);
3092
3093
3094				if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
3095					UNCODE.lightgallery( $galleries );
3096				}
3097
3098
3099			});
3100
3101			$elSelector.on('resized.owl.carousel', function(event) {
3102				var thiis = $(event.currentTarget);
3103				// if ($(this).closest('.nested-carousel').length) {
3104				// 	requestTimeout(function() {
3105				// 		window.dispatchEvent(UNCODE.boxEvent);
3106				// 	}, 200);
3107				// }
3108				if ( thiis.hasClass('owl-height-equal') )
3109					setItemsHeight(thiis);
3110
3111				setItemsRelHeight($elSelector);
3112
3113				setIndexActive(event);
3114
3115				if (SiteParameters.dynamic_srcset_active === '1') {
3116					UNCODE.refresh_dynamic_srcset_size(thiis);
3117				}
3118
3119				if ($.fn.isotope) {
3120					$(window).on('load', function(){
3121						if ($(event.currentTarget).closest('.isotope-container').data('isotope')) {
3122							$(event.currentTarget).closest('.isotope-container').isotope('layout');
3123						}
3124					});
3125				}
3126			});
3127
3128			/** detect resize window for fluid height layout */
3129			var setFluidResize;
3130			function manageFluidCarouseHeight() {
3131				clearRequestTimeout(setFluidResize);
3132				setFluidResize = requestTimeout(function(){
3133					setItemsRelHeight($elSelector);
3134				}, 100);
3135			}
3136			window.addEventListener('resize', manageFluidCarouseHeight);
3137
3138			/** Change */
3139			$elSelector.on('change.owl.carousel', function(event) {
3140				if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
3141			});
3142
3143			/** Changed */
3144			$elSelector.on('changed.owl.carousel', function(event) {
3145				var $row = $elSelector.parents('.row')[0];
3146				if ( typeof $row !== 'undefined' ) {
3147					$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
3148				}
3149				setIndexActive(event);
3150			});
3151
3152			var checkDrag = function(e) {
3153				$elSelector.addClass('owl-dragging');
3154			};
3155			$elSelector.on('drag.owl.carousel', function(event) {
3156				document.addEventListener("mousemove", checkDrag);
3157			});
3158
3159			$elSelector.on('dragged.owl.carousel', function(event) {
3160				$elSelector.removeClass('owl-dragging');
3161				document.removeEventListener("mousemove", checkDrag);
3162			});
3163
3164			$elSelector.on('translate.owl.carousel', function(event) {
3165				if (UNCODE.isMobile) {
3166					$(event.currentTarget).addClass('owl-translating');
3167				}
3168			});
3169
3170			/** Translated */
3171			$elSelector.on('translated.owl.carousel', function(event) {
3172
3173				var thiis = $(event.currentTarget),
3174					currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
3175					currentIndex = $(currentItem).attr('data-index'),
3176					stagePadding = thiis.data('stagepadding');
3177
3178				stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
3179
3180				if (!UNCODE.isMobile) {
3181					UNCODE.owlPlayVideo(thiis);
3182				}
3183
3184				requestTimeout(function(){
3185					var lastDelayElems = animate_elems($('.owl-item.index-active', thiis));
3186					var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event);
3187					if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) {
3188						if (lastDelayElems == undefined) lastDelayElems = 0;
3189						if (lastDelayThumb == undefined) lastDelayThumb = 0;
3190						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
3191						thiis.trigger('stop.owl.autoplay');
3192						requestTimeout(function() {
3193							if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay');
3194						}, maxDelay);
3195					}
3196				}, 200);
3197
3198				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
3199					if ($(val).closest('.uncode-slider').length) {
3200						$(val).removeClass('start_animation');
3201					}
3202				});
3203
3204				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
3205					if ($(val).closest('.uncode-slider').length) {
3206						$(val).removeClass('already-animated');
3207					}
3208				});
3209
3210				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
3211					if ($(val).closest('.uncode-slider').length) {
3212						$(val).removeAttr('data-animated');
3213					}
3214				});
3215
3216				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
3217					if ($(val).attr('data-index') != currentIndex) {
3218						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
3219						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
3220					}
3221					if ($(val).attr('data-index') != currentIndex) {
3222						$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
3223					}
3224					if ($(val).attr('data-index') == currentIndex) {
3225						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
3226					}
3227				});
3228
3229				if (UNCODE.isMobile) {
3230					thiis.removeClass('owl-translating');
3231				}
3232
3233				setIndexActive(event);
3234			});
3235
3236			if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
3237
3238			/** Init carousel */
3239			$elSelector.not('.showControls').owlCarousel({
3240				items: values['items'],
3241				animateIn: (values['fade'] == true) ? 'fadeIn' : null,
3242				animateOut: (values['fade'] == true) ? 'fadeOut' : null,
3243				nav: values['nav'],
3244				dots: values['dots'],
3245				loop: values['loop'],
3246				stagePadding: values['stagepadding'],
3247				margin: 0,
3248				video: true,
3249				autoWidth: false,
3250				autoplay: false,
3251				autoplayTimeout: values['timeout'],
3252				autoplaySpeed: values['navspeed'],
3253				autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true,
3254				autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ),
3255				rtl: $('body').hasClass('rtl') ? true : false,
3256				fluidSpeed: true,
3257				navSpeed: values['navspeed'],
3258				dotsSpeed: values['navspeed'] / values['items'],
3259				navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
3260				navText: ['<div class="owl-nav-container btn-default btn-hover-nobg"><i class="fa fa-fw fa-angle-left"></i></div>', '<div class="owl-nav-container btn-default btn-hover-nobg"><i class="fa fa-fw fa-angle-right"></i></div>'],
3261				navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
3262				responsiveClass: true,
3263				responsiveBaseElement: '.box-container',
3264				responsive: {
3265					0: {
3266						items: values['sm'],
3267						nav: values['navmobile'],
3268						dots: values['dotsmobile'],
3269						dotsSpeed: values['navspeed'] / values['sm'],
3270					},
3271					480: {
3272						items: values['sm'],
3273						nav: values['navmobile'],
3274						dots: values['dotsmobile'],
3275						dotsSpeed: values['navspeed'] / values['sm'],
3276					},
3277					570: {
3278						items: values['md'],
3279						nav: values['navmobile'],
3280						dots: values['dotsmobile'],
3281						dotsSpeed: values['navspeed'] / values['md'],
3282					},
3283					960: {
3284						items: values['lg'],
3285						dotsSpeed: values['navspeed'] / values['lg'],
3286					}
3287				}
3288			});
3289
3290			var transDuration = parseFloat(values['navspeed']) * 0.3;
3291			var transDuration2 = parseFloat(values['navspeed']) * 0.8;
3292
3293			$('.owl-item .tmb', $elSelector).css({
3294				'-webkit-transition-delay': transDuration + 'ms',
3295				'-moz-transition-delay': transDuration + 'ms',
3296				'-o-transition-delay': transDuration + 'ms',
3297				'transition-delay': transDuration + 'ms',
3298				'-webkit-transition-duration': transDuration2 + 'ms',
3299				'-moz-transition-duration': transDuration2 + 'ms',
3300				'-o-transition-duration': transDuration2 + 'ms',
3301				'transition-duration': transDuration2 + 'ms',
3302			});
3303
3304			requestTimeout(function() {
3305				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
3306					UNCODE.setRowHeight($owlInsideEqual[i]);
3307				};
3308			}, 300);
3309
3310			$(window).on('load', function(){
3311				var $elCarousel = $elSelector.data('owl.carousel');
3312				if ( typeof $elCarousel !== 'undefined' ) {
3313					$elCarousel.trigger('refreshed');
3314					for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
3315						UNCODE.setRowHeight($owlInsideEqual[i]);
3316					};
3317				}
3318			});
3319
3320			$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
3321				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
3322					$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
3323					$('#' + carousel_id).find('.owl-item').each( function() {
3324						var $item = $(this),
3325							index = ( $item.index() + 1 );
3326						$item.attr('data-index', index);
3327					});
3328				}
3329			});
3330
3331			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3332				window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
3333					if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
3334						$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
3335						$('#' + carousel_id).find('.owl-item').each( function() {
3336							var $item = $(this),
3337								index = ( $item.index() + 1 );
3338							$item.attr('data-index', index);
3339						});
3340					}
3341				});
3342			}
3343
3344		});
3345
3346		function firstLoaded(el, event) {
3347			var el = $(el),
3348			uncode_slider = el.find('.uncode-slider');
3349			el.find('.owl-carousel').css('opacity', 1);
3350			uncode_slider.addClass('slider-loaded');
3351			if (typeof UNCODE.bigText !== 'undefined') {
3352				UNCODE.bigText(el.find('.owl-item.active'));
3353			}
3354			//if (!UNCODE.isMobile) {
3355				requestTimeout(function() {
3356					var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
3357					var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
3358					if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
3359						if (lastDelayElems == undefined) lastDelayElems = 0;
3360						if (lastDelayThumb == undefined) lastDelayThumb = 0;
3361						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
3362						$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
3363						requestTimeout(function() {
3364							$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
3365						}, maxDelay);
3366					}
3367				}, 500);
3368
3369			//}
3370		}
3371
3372		function navHover(el) {
3373			var $owlCont = el,
3374				$owlPrev = $owlCont.find('.owl-prev'),
3375				$owlNext = $owlCont.find('.owl-next'),
3376				$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
3377				$owlPagination = $owlCont.next(),
3378				owlPrevW = $owlPrev.outerWidth(),
3379				owlNextW = $owlNext.outerWidth(),
3380				owlDotsH = $owlDots.innerHeight(),
3381				owlTime = 400,
3382				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
3383			if ( $('body').hasClass('rtl') ) {
3384				$owlPrev.css("margin-right", -owlPrevW);
3385				$owlNext.css("margin-left", -owlNextW);
3386			} else {
3387				$owlPrev.css("margin-left", -owlPrevW);
3388				$owlNext.css("margin-right", -owlNextW);
3389			}
3390			if (!owlNested) $owlDots.css("bottom", -owlDotsH);
3391			$owlCont.mouseenter(function() {
3392				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
3393				$owlPrev.add($owlNext).css({
3394					marginLeft: 0,
3395					marginRight: 0
3396				});
3397				if (!owlNested) {
3398					$owlDots.css({
3399						opacity: 1,
3400						bottom: 0
3401					});
3402				}
3403			}).mouseleave(function() {
3404				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
3405				if ( $('body').hasClass('rtl') ) {
3406					$owlPrev.css("margin-right", -owlPrevW);
3407					$owlNext.css("margin-left", -owlNextW);
3408				} else {
3409					$owlPrev.css("margin-left", -owlPrevW);
3410					$owlNext.css("margin-right", -owlNextW);
3411				}
3412				if (!owlNested) {
3413					$owlDots.css({
3414						opacity: 1,
3415						bottom: -owlDotsH
3416					});
3417				}
3418			});
3419		};
3420
3421		function animate_elems($this) {
3422			var lastDelay;
3423			$.each($('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside), .animate_when_parent_almost_visible:not(.t-inside)', $this), function(index, val) {
3424				var element = $(val),
3425					delayAttr = element.attr('data-delay'),
3426					$first_item = element.closest('.owl-item[data-index="1"]');
3427
3428				if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
3429					return false;
3430				}
3431
3432				if (delayAttr == undefined) delayAttr = 0;
3433				requestTimeout(function() {
3434					element.addClass('start_animation');
3435				}, delayAttr);
3436				lastDelay = delayAttr;
3437			});
3438			return lastDelay;
3439		}
3440
3441		function animate_thumb(items, event) {
3442			var lastDelay,
3443				itemIndex,
3444				thiis = $(event.currentTarget),
3445				tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'),
3446				numActives = $('.owl-item.active', thiis).length,
3447				stagePadding = thiis.data('stagepadding');
3448
3449			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
3450
3451			thiis.data('tempIndex', event.item.index);
3452				$.each(items, function(index, val) {
3453					var parent = $(val).closest('.owl-item');
3454					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3455						return;
3456					}
3457					if (!$(val).hasClass('start_animation')) {
3458						if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
3459							var thumbInView = new Waypoint.Inview({
3460							  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3461							  element: val,
3462							  enter: function(direction) {
3463								var element = $(this.element),
3464										delayAttr = parseInt(element.attr('data-delay')),
3465										itemIndex = element.closest('.owl-item').index() + 1,
3466										diffItem = Math.abs(itemIndex - tempIndex) - 1;
3467									if (itemIndex > tempIndex) {
3468										thiis.data('tempIndex', itemIndex);
3469									}
3470									if (isNaN(delayAttr)) delayAttr = 100;
3471									if (stagePadding) {
3472										var objTimeout = requestTimeout(function() {
3473											element.addClass('start_animation');
3474										}, index * delayAttr);
3475										lastDelay = index * delayAttr;
3476									} else {
3477										$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation');
3478										var objTimeout = requestTimeout(function() {
3479											element.addClass('start_animation');
3480										}, diffItem * delayAttr);
3481										lastDelay = diffItem * delayAttr;
3482									}
3483									parent.data('objTimeout', objTimeout);
3484									if (!UNCODE.isUnmodalOpen) {
3485										this.destroy();
3486									}
3487								}
3488							});
3489						}
3490					}
3491				});
3492				return lastDelay;
3493			}
3494
3495		function setItemsHeight(item) {
3496			$.each($('.owl-item', item), function(index, val) {
3497				var availableThumbHeight = $('.t-inside', $(val)).height(),
3498				innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
3499				difference = availableThumbHeight - innerThumbHeight;
3500				if ($('.tmb-content-under', val).length) {
3501					var visualPart = $('.t-entry-visual', val);
3502					if (visualPart.length) {
3503						difference -= $('.t-entry-visual', val).height();
3504					}
3505				}
3506				if (! $('.tmb-content-lateral', val).length)
3507					$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
3508			});
3509		}
3510
3511		function setItemsRelHeight(item) {
3512			$.each($('.owl-item', item), function(index, val) {
3513				var $rowContainer = $(item).parents('.row-parent').eq(0),
3514					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
3515					$colContainer = $(item).parents('.uncell').eq(0),
3516					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
3517					winHeight = UNCODE.wheight,
3518					multiplier_h = parseInt($(item).attr('data-vp-height')),
3519					data_viewport_h,
3520					consider_menu = $(item).data('vp-menu');
3521
3522				if ( consider_menu ) {
3523					winHeight = winHeight - UNCODE.menuHeight;
3524				}
3525
3526				data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
3527				$('.t-inside', val).css( 'height', data_viewport_h );
3528			});
3529		}
3530
3531		function pauseOnHover(slider) {
3532			$('.owl-dots, .owl-prev, .owl-next', slider).on({
3533				mouseenter: function () {
3534					$(slider).addClass('owl-mouseenter');
3535					$(slider).trigger('stop.owl.autoplay');
3536				},
3537				mouseleave: function () {
3538					$(slider).removeClass('owl-mouseenter');
3539					$(slider).trigger('play.owl.autoplay');
3540				}
3541			});
3542		}
3543	});
3544};
3545
3546UNCODE.owlPlayVideo = function(carousel) {
3547	var player, iframe;
3548	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
3549		var content = $(val).html();
3550		if (content == '') {
3551			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
3552			$(val).append(getCloned);
3553		}
3554		if ($(this).attr('data-provider') == 'vimeo') {
3555			iframe = $(this).find('iframe');
3556			player = $f(iframe[0]);
3557			player.api('play');
3558		} else if ($(this).attr('data-provider') == 'youtube') {
3559			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
3560		} else {
3561			var player = $(this).find('video');
3562			if (player.length) {
3563				$(this).find('video')[0].volume = 0;
3564				$(this).find('video')[0].play();
3565				$(val).css('opacity', 1);
3566			}
3567		}
3568	});
3569};
3570
3571UNCODE.owlStopVideo = function(carousel) {
3572	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
3573		var player, iframe;
3574		if ($(this).attr('data-provider') == 'vimeo') {
3575			iframe = $(this).find('iframe');
3576			player = $f(iframe[0]);
3577			player.api('pause');
3578		} else if ($(this).attr('data-provider') == 'youtube') {
3579			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
3580		} else {
3581			var player = $(this).find('video');
3582			if (player.length) {
3583				$(this).find('video')[0].volume = 0;
3584				$(this).find('video')[0].play();
3585			}
3586		}
3587	});
3588};
3589
3590UNCODE.animations = function() {
3591
3592	var runWaypoints_TO,
3593		runWaypoints_carousel_TO,
3594		runWaypoints_delay = 0,
3595	highlightComplexFunc = function($wrap, ev){
3596
3597		var $lines = $('.heading-line-wrap', $wrap),
3598			not_animate = false;
3599
3600		if ( $wrap.data('animate') === true ) {
3601			not_animate = true;
3602		}
3603
3604		var $rotatingTxt = $('.uncode-rotating-text-start', $wrap);
3605		if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) {
3606			return;
3607		}
3608
3609		$lines.each(function(_key, _value){
3610			var $line = $(_value),
3611				$inners = $('.split-word-inner', $line),
3612				$highlights = $('.heading-text-highlight-inner', $line);
3613
3614			var highlitInnerFunc = function(ev){
3615				var delay = 0;
3616				$highlights.each(function(h_key, high){
3617					var $highlight = $(high),
3618						$split = $highlight.closest('.split-word:not(.uncode-rotating-span)'),
3619						$nextSplit = $split.nextUntil(),
3620						$next = $('.heading-text-highlight-inner', $nextSplit),
3621						countCh = $split.text().length;
3622
3623					$highlight.css({
3624						'-webkit-transition-duration': (30 * countCh) + 'ms',
3625						'-moz-transition-duration': (30 * countCh) + 'ms',
3626						'-o-transition-duration': (30 * countCh) + 'ms',
3627						'transition-duration': (30 * countCh) + 'ms',
3628					});
3629
3630					delay += (30 * countCh);
3631
3632					$next.css({
3633						'-webkit-transition-delay': delay + 'ms',
3634						'-moz-transition-delay': delay + 'ms',
3635						'-o-transition-delay': delay + 'ms',
3636						'transition-delay': delay + 'ms',
3637					});
3638				});
3639				$highlights.removeAttr('data-animated');
3640				if ( _key+1 === $lines.length ) {
3641					$wrap.data('animate', true);
3642				}
3643			};
3644
3645			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
3646				if ( not_animate ) {
3647					$highlights.each(function(h_key, high){
3648						var $highlight = $(high);
3649						$highlight.css({
3650							'-webkit-transition-duration': '0ms',
3651							'-moz-transition-duration': '0ms',
3652							'-o-transition-duration': '0ms',
3653							'transition-duration': '0ms',
3654						});
3655					});
3656					$highlights.removeAttr('data-animated');
3657				} else {
3658					if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) {
3659						highlitInnerFunc();
3660					} else {
3661						$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc);
3662					}
3663				}
3664			}
3665		});
3666	};
3667
3668	$.each($('.header-content-inner'), function(index, val) {
3669		var element = $(val),
3670			transition = '';
3671		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
3672		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
3673		if (element.hasClass('left-t-right')) transition = 'left-t-right';
3674		if (element.hasClass('right-t-left')) transition = 'right-t-left';
3675		if (element.hasClass('zoom-in')) transition = 'zoom-in';
3676		if (element.hasClass('zoom-out')) transition = 'zoom-out';
3677		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
3678		if (transition != '') {
3679			$(val).removeClass(transition);
3680			var container = element,
3681				containerDelay = container.attr('data-delay'),
3682				containerSpeed = container.attr('data-speed'),
3683				items = $('.header-title > *, .post-info', container);
3684			$.each(items, function(index, val) {
3685				var element = $(val),
3686					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
3687					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
3688				if (!element.hasClass('animate_when_almost_visible')) {
3689					delayAttr = Number(delayAttr) + (400 * index);
3690					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
3691					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
3692				}
3693			});
3694			container.css('opacity', 1);
3695		}
3696	});
3697
3698	function animate_css_grids_on_load() {
3699		$('.cssgrid-system').each(function() {
3700			var grid = $(this);
3701			var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false;
3702			UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false);
3703		});
3704	}
3705
3706	window.waypoint_animation = function(ev) {
3707		$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)'), function(index, val) {
3708			if ( $(val).hasClass('el-text-split') || ( ( $(val).closest('.unscroll-horizontal').length || $(val).closest('.index-scroll').length ) && !SiteParameters.is_frontend_editor ) ) {
3709				return true;
3710			}
3711			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3712				return;
3713			}
3714			var run = true,
3715				$carousel = $(val).closest('.owl-carousel');
3716			if ( $carousel.length ) {
3717				run = false;
3718			}
3719			if (run) {
3720				new Waypoint({
3721					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3722					element: val,
3723					handler: function() {
3724						var element = $(this.element),
3725							index = element.index(),
3726							delayAttr = element.attr('data-delay');
3727						if (delayAttr == undefined) delayAttr = 0;
3728						requestTimeout(function() {
3729							element.addClass('start_animation');
3730						}, delayAttr);
3731						if (!UNCODE.isUnmodalOpen) {
3732							this.destroy();
3733						}
3734					},
3735					offset: UNCODE.isFullPage ? '100%' : '90%'
3736				});
3737			}
3738		});
3739		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
3740			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3741				return;
3742			}
3743			var run = true,
3744				$carousel = $(val).closest('.owl-carousel');
3745			if ( $carousel.length ) {
3746				run = false;
3747			}
3748			if (run) {
3749				new Waypoint({
3750					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3751					element: val,
3752					handler: function() {
3753						var $element = $(this.element),
3754							$childs = $('.animate_when_parent_almost_visible', $element);
3755						$childs.each(function(key,el){
3756							var $child = $(el),
3757								delaySpeed = $child.attr('data-speed'),
3758								delayAttr = $child.attr('data-delay'),
3759								intervalAttr = $child.attr('data-interval');
3760							if (delayAttr == undefined) {
3761								delayAttr = 50*key;
3762							}
3763							requestTimeout(function() {
3764								$child.addClass('start_animation');
3765								if ( $child.hasClass('anim-line-checker') ) {
3766									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
3767										var $line = $child.closest('.heading-line-wrap');
3768									});
3769								}
3770								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
3771								highlightComplexFunc($wrapText, ev);
3772								if ( $child.hasClass('anim-tot-checker') ) {
3773									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
3774										if ( $child.hasClass('anim-tot-checker') ) {
3775											$wrapText.addClass('already-animated');
3776											$element.trigger('already-animated');
3777										}
3778									});
3779								}
3780							}, delayAttr );
3781						});
3782						$element.addClass('start_animation');
3783						if (!UNCODE.isUnmodalOpen) {
3784							this.destroy();
3785						}
3786					},
3787					offset: UNCODE.isFullPage ? '100%' : '90%'
3788				});
3789			}
3790		});
3791	}
3792	window.waypoint_carousel_animation = function(ev) {
3793		$.each($('.owl-carousel').find('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .tmb-media .animate_when_almost_visible:not(.start_animation)'), function(index, val) {
3794			if ( $(val).hasClass('el-text-split') ) {
3795				return true;
3796			}
3797			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3798				return;
3799			}
3800			var run = true,
3801				$carousel = $(val).closest('.owl-carousel'),
3802				$first_item = $(val).closest('.owl-item[data-index="1"]'),
3803				$all_first = $('.owl-item[data-index="1"]', $carousel);
3804			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
3805				run = false;
3806			}
3807			if (run) {
3808				new Waypoint({
3809					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3810					element: val,
3811					handler: function() {
3812						var element = $(this.element),
3813							index = element.index(),
3814							delayAttr = element.attr('data-delay');
3815						if (delayAttr == undefined) delayAttr = 0;
3816						requestTimeout(function() {
3817							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
3818								$all_first.attr('data-already-reached', 'true');
3819							}
3820							element.addClass('start_animation');
3821						}, delayAttr);
3822						if (!UNCODE.isUnmodalOpen) {
3823							this.destroy();
3824						}
3825					},
3826					offset: UNCODE.isFullPage ? '100%' : '90%'
3827				});
3828			}
3829		});
3830		$.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) {
3831			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3832				return;
3833			}
3834			var run = true,
3835				$carousel = $(val).closest('.owl-carousel'),
3836				$first_item = $(val).closest('.owl-item[data-index="1"]'),
3837				$all_first = $('.owl-item[data-index="1"]', $carousel);
3838			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
3839				run = false;
3840			}
3841			if (run) {
3842				new Waypoint({
3843					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3844					element: val,
3845					handler: function() {
3846						var $element = $(this.element),
3847							$childs = $('.animate_when_parent_almost_visible', $element);
3848						$childs.each(function(key,el){
3849							var $child = $(el),
3850								delaySpeed = $child.attr('data-speed'),
3851								delayAttr = $child.attr('data-delay'),
3852								intervalAttr = $child.attr('data-interval');
3853							if (delayAttr == undefined) {
3854								delayAttr = 50*key;
3855							}
3856							requestTimeout(function() {
3857								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
3858									$all_first.attr('data-already-reached', 'true');
3859								}
3860								$child.addClass('start_animation');
3861								if ( $child.hasClass('anim-line-checker') ) {
3862									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
3863										var $line = $child.closest('.heading-line-wrap');
3864									});
3865								}
3866								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
3867								highlightComplexFunc($wrapText, ev);
3868								if ( $child.hasClass('anim-tot-checker') ) {
3869									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
3870										if ( $child.hasClass('anim-tot-checker') ) {
3871											$wrapText.addClass('already-animated');
3872										}
3873									});
3874								}
3875							}, delayAttr );
3876						});
3877						$element.addClass('start_animation');
3878						if (!UNCODE.isUnmodalOpen) {
3879							this.destroy();
3880						}
3881					},
3882					offset: UNCODE.isFullPage ? '100%' : '90%'
3883				});
3884			}
3885		});
3886	}
3887
3888	var runWaypoints = function(ev){
3889		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
3890			runWaypoints_delay = 400;
3891		}
3892		clearRequestTimeout(runWaypoints_TO);
3893		runWaypoints_TO = requestTimeout(function() {
3894			window.waypoint_animation(ev);
3895		}, runWaypoints_delay);
3896
3897		clearRequestTimeout(runWaypoints_carousel_TO);
3898		runWaypoints_carousel_TO = requestTimeout(function() {
3899			window.waypoint_carousel_animation(ev);
3900		}, 400);
3901	};
3902	runWaypoints();
3903	animate_css_grids_on_load();
3904
3905	$( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) {
3906		runWaypoints(ev);
3907	});
3908	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3909		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
3910	}
3911};
3912
3913UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) {
3914	var $allItems = elements.length - startIndex,
3915		showed = 0,
3916		index = 0,
3917		use_index = false
3918		;
3919
3920	if (filtering) {
3921		if (sequential) {
3922			use_index = true;
3923		}
3924		sequential = false;
3925	}
3926
3927	$.each(elements, function(index, val) {
3928		var $this = $(val),
3929			elInner = $('> .t-inside', val);
3930
3931		if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3932			return;
3933		}
3934		if (val[0]) val = val[0];
3935
3936		if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
3937			new Waypoint({
3938				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3939				element: val,
3940				handler: function() {
3941					var element = $('> .t-inside', this.element),
3942						parent = $(this.element);
3943					var _index = use_index? index : 0;
3944
3945					var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index),
3946						delayAttr = parseInt(element.attr('data-delay'));
3947					if (isNaN(delayAttr)) delayAttr = 100;
3948					if (sequential || use_index) {
3949						delay -= showed;
3950					}
3951					var objTimeout = requestTimeout(function() {
3952						element.removeClass('zoom-reverse').addClass('start_animation');
3953						showed = index;
3954					}, delay * delayAttr);
3955					parent.data('objTimeout', objTimeout);
3956					if (!UNCODE.isUnmodalOpen) {
3957						this.destroy();
3958					}
3959				},
3960				offset: UNCODE.isFullPage ? '100%' : '90%'
3961			});
3962		}
3963
3964		index++;
3965	});
3966};
3967
3968UNCODE.tapHover = function() {
3969
3970	var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), //.length //html.touch a.btn
3971		elClass = "hover";
3972
3973	$(window).on('click', function() {
3974		$el.removeClass(elClass);
3975	});
3976
3977	$el.on("click", function(e) { // cambia click con touch start 'touchstart'
3978		e.stopPropagation();
3979		var link = $(this);
3980		if ( ! link.hasClass(elClass)) {
3981			e.preventDefault();
3982			link.addClass("hover");
3983			$el.not(this).removeClass(elClass);
3984			return false;
3985		}
3986	});
3987};
3988
3989UNCODE.onePage = function(isMobile) {
3990	var current = 0,
3991		last = 0,
3992		lastScrollTop = 0,
3993		forceScroll = false,
3994		lastScrolled = 0,
3995		isSectionscroller = ($('.main-onepage').length) ? true : false,
3996		isOnePage = false,
3997		getOffset = function () {
3998			var calculateOffset = (($('.menu-sticky .menu-container:not(.menu-hide)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide)').outerHeight() : 0);
3999			return calculateOffset;
4000		}
4001
4002	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
4003	// 	return false;
4004
4005	function init_onepage() {
4006		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
4007			$("<ul class='onepage-pagination'></ul>").prependTo("body");
4008		}
4009		last = $('.onepage-pagination li').last().find('a').data('index');
4010		$.each($('div[data-parent="true"]'), function(index, val) {
4011			$(this).attr('data-section', index);
4012			if (isMobile) return;
4013			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4014				return;
4015			}
4016			var sectionDown = new Waypoint({
4017				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4018				element: val,
4019				handler: function(direction) {
4020					if (direction == 'down') {
4021						changeMenuActive(this.element, index);
4022					}
4023				},
4024				offset: function() {
4025					return 5 + getOffset()
4026				}
4027			});
4028			var sectionUp = new Waypoint({
4029				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4030				element: val,
4031				handler: function(direction) {
4032					if (direction == 'up') {
4033						changeMenuActive(this.element, index);
4034					}
4035				},
4036				offset: function() {
4037					return -5 - getOffset()
4038				}
4039			});
4040
4041			if (isSectionscroller) {
4042				var label;
4043				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
4044				else label = '';
4045				var getName = $(this).attr('data-name');
4046				if (getName == undefined) getName = index;
4047				if (label != '') {
4048					isOnePage = true;
4049					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
4050					$('ul.onepage-pagination').append("<li><a class='one-dot-link' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>");
4051				}
4052			}
4053		});
4054
4055		if (isSectionscroller) {
4056			$.each($('ul.onepage-pagination li'), function(index, val) {
4057				var $this = $(val),
4058					$a = ('a', $this);
4059				$a.on('click', function(evt) {
4060					if ( $('.is-selected', $this).length ) {
4061						return false;
4062					}
4063					if ( $('body').hasClass('uncode-scroll-no-history') ) {
4064						evt.preventDefault();
4065					}
4066					Waypoint.refreshAll();
4067					var el = $('a', evt.currentTarget);
4068					current = lastScrolled = parseInt(el.attr('data-index'));
4069					lastScrolled += 1;
4070					scrollBody(current);
4071				});
4072			});
4073		}
4074
4075		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
4076		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
4077			goToSection = String(window.location.hash).replace(/^#/, "");
4078			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
4079		}
4080
4081		if (typeof goToSection === 'number' && !isNaN(goToSection)) {
4082			current = lastScrolled = goToSection;
4083			$(window).on('load', function(){
4084				if ( $('.owl-carousel').length ) {
4085					requestTimeout(function(){
4086						scrollBody(goToSection);
4087					}, 400);
4088				} else {
4089					scrollBody(goToSection);
4090				}
4091			});
4092		}
4093
4094	}
4095
4096	function changeMenuActive(section, index) {
4097		current = lastScrolled = parseInt($(section).attr('data-section'));
4098		if (isOnePage) {
4099			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
4100			if (newSection.length) {
4101				$('ul.onepage-pagination li a').removeClass('is-selected');
4102				newSection.addClass('is-selected');
4103			}
4104			var getName = $('[data-section="' + index + '"]').attr('data-name');
4105			if (getName != undefined && getName !== '') {
4106				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
4107					var get_href = $(val).attr('href');
4108					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
4109						$(val).closest('.menu-smart').find('.active').removeClass('active');
4110						$(val).parent().addClass('active');
4111					}
4112				});
4113			}
4114		}
4115	}
4116
4117	if (isOnePage) {
4118		$(window).on('scroll', function() {
4119			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
4120			if (bodyTop == 0) {
4121				$('ul.onepage-pagination li a').removeClass('is-selected');
4122				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
4123				var getName = $('[data-section=0]').attr('data-name');
4124				if (getName != undefined && getName !== '') {
4125					$.each($('.menu-container .menu-item > a'), function(i, val) {
4126						var get_href = $(val).attr('href');
4127						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
4128							$(val).closest('ul').find('.active').removeClass('active');
4129							$(val).parent().addClass('active');
4130						}
4131					});
4132				}
4133			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
4134				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
4135				if (lastSection.length) {
4136					$('ul.onepage-pagination li a').removeClass('is-selected');
4137					lastSection.addClass('is-selected');
4138				}
4139			}
4140		});
4141	}
4142
4143	var scrollBody = function(index) {
4144		$('ul.onepage-pagination li a').removeClass('is-selected');
4145		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
4146
4147		var getSection = $('[data-section=' + index + ']'),
4148			scrollTo;
4149
4150		if (getSection == undefined) return;
4151
4152		var body = $("html, body"),
4153			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
4154			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
4155			getOffset = UNCODE.get_scroll_offset(index);
4156		if ( typeof getSection.offset() === 'undefined' )
4157			return;
4158		scrollTo = getSection.offset().top;
4159
4160		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
4161			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
4162			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
4163				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
4164			}
4165
4166			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
4167				if ( index === 0 ) {
4168					scrollTo = 0;
4169				} else {
4170					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
4171				}
4172			} else {
4173				scrollTo -= getOffset;
4174			}
4175		}
4176
4177		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
4178		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
4179
4180		if (index != 0) {
4181			UNCODE.scrolling = true;
4182		}
4183
4184		if (scrollSpeed == 0) {
4185			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
4186			UNCODE.scrolling = false;
4187		} else {
4188			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
4189				$(this).stop();
4190			}).animate({
4191				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
4192			}, scrollSpeed, 'easeInOutCubic', function() {
4193				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
4194				UNCODE.scrolling = false;
4195				if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
4196					if (scrollTo != UNCODE.get_scroll_offset(index)) {
4197						scrollTo = getSection.offset().top;
4198						getOffset = UNCODE.get_scroll_offset(index);
4199						scrollTo -= getOffset;
4200						body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
4201							$(this).stop();
4202						}).animate({
4203							scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
4204							}, scrollSpeed, 'easeInOutCubic', function() {
4205								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
4206								UNCODE.scrolling = false;
4207							}
4208						);
4209					}
4210				}
4211			});
4212		}
4213
4214	};
4215
4216	init_onepage();
4217};
4218
4219UNCODE.stickyElements = function() {
4220	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
4221	if (!isMobile_wide) {
4222
4223		var $pageHeader = $('#page-header'),
4224			$headerRow = $('.vc_row', $pageHeader),
4225			startSticky = false;
4226
4227		if ( $headerRow.hasClass('sticky-element') ) {
4228			$headerRow.removeClass('sticky-element');
4229			$pageHeader.addClass('sticky-element');
4230			startSticky = true;
4231		}
4232
4233		var calculateOffset = function(el) {
4234			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
4235				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
4236				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0;
4237
4238			sideOffset += UNCODE.bodyBorder;
4239
4240			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
4241			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && !$('.menu-wrapper .menu-desktop-transparent').length) {
4242				if ($('.menu-shrink').length) {
4243					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
4244				} else {
4245					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
4246				}
4247			}
4248
4249			return sideOffset;
4250
4251		},
4252
4253		initStickyElement = function() {
4254			$.each($('.sticky-element'), function(index, element) {
4255				$(element).stick_in_parent({
4256					sticky_class: 'is_stucked',
4257					offset_top: calculateOffset(element),
4258					bottoming: true,
4259					inner_scrolling: SiteParameters.sticky_elements === 'on'
4260				});
4261			});
4262		};
4263
4264		requestTimeout(function() {
4265			if ($('.sticky-element').length) {
4266
4267				if ($(window).width() > UNCODE.mediaQuery) {
4268					initStickyElement();
4269
4270					if ( startSticky === true ) {
4271						$('#page-header').trigger('sticky_kit:recalc');
4272					}
4273				}
4274
4275				$(window).on('resize', function(event) {
4276					if ($(window).width() > UNCODE.mediaQuery) {
4277						initStickyElement();
4278					} else {
4279						$(".sticky-element").trigger("sticky_kit:detach");
4280					}
4281				});
4282			}
4283		}, 1000);
4284
4285		var $panels = $('.panel-collapse');
4286		if ( $panels.length ) {
4287			$panels.each(function(){
4288				var $panel = $(this);
4289				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
4290					$(document.body).trigger("sticky_kit:recalc");
4291				});
4292			});
4293		}
4294	}
4295};
4296
4297UNCODE.twentytwenty = function() {
4298
4299  if (!$('.twentytwenty-container').length) return;
4300
4301// DOM.event.move
4302//
4303// 2.0.0
4304//
4305// Stephen Band
4306//
4307// Triggers 'movestart', 'move' and 'moveend' events after
4308// mousemoves following a mousedown cross a distance threshold,
4309// similar to the native 'dragstart', 'drag' and 'dragend' events.
4310// Move events are throttled to animation frames. Move event objects
4311// have the properties:
4312//
4313// pageX:
4314// pageY:     Page coordinates of pointer.
4315// startX:
4316// startY:    Page coordinates of pointer at movestart.
4317// distX:
4318// distY:     Distance the pointer has moved since movestart.
4319// deltaX:
4320// deltaY:    Distance the finger has moved since last event.
4321// velocityX:
4322// velocityY: Average velocity over last few events.
4323
4324
4325(function(fn) {
4326	if (typeof define === 'function' && define.amd) {
4327        define([], fn);
4328    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
4329        module.exports = fn;
4330	} else {
4331		fn();
4332	}
4333})(function(){
4334	var assign = Object.assign || window.jQuery && jQuery.extend;
4335
4336	// Number of pixels a pressed pointer travels before movestart
4337	// event is fired.
4338	var threshold = 8;
4339
4340	// Shim for requestAnimationFrame, falling back to timer. See:
4341	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
4342	var requestFrame = (function(){
4343		return (
4344			window.requestAnimationFrame ||
4345			window.webkitRequestAnimationFrame ||
4346			window.mozRequestAnimationFrame ||
4347			window.oRequestAnimationFrame ||
4348			window.msRequestAnimationFrame ||
4349			function(fn, element){
4350				return window.setTimeout(function(){
4351					fn();
4352				}, 25);
4353			}
4354		);
4355	})();
4356
4357	// Shim for customEvent
4358	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
4359	(function () {
4360		if ( typeof window.CustomEvent === "function" ) return false;
4361		function CustomEvent ( event, params ) {
4362			params = params || { bubbles: false, cancelable: false, detail: undefined };
4363			var evt = document.createEvent( 'CustomEvent' );
4364			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
4365			return evt;
4366		}
4367
4368		CustomEvent.prototype = window.Event.prototype;
4369		window.CustomEvent = CustomEvent;
4370	})();
4371
4372	var ignoreTags = {
4373			textarea: true,
4374			input: true,
4375			select: true,
4376			button: true
4377		};
4378
4379	var mouseevents = {
4380		move:   'mousemove',
4381		cancel: 'mouseup dragstart',
4382		end:    'mouseup'
4383	};
4384
4385	var touchevents = {
4386		move:   'touchmove',
4387		cancel: 'touchend',
4388		end:    'touchend'
4389	};
4390
4391	var rspaces = /\s+/;
4392
4393
4394	// DOM Events
4395
4396	var eventOptions = { bubbles: true, cancelable: true };
4397
4398	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
4399
4400	function createEvent(type) {
4401		return new CustomEvent(type, eventOptions);
4402	}
4403
4404	function getEvents(node) {
4405		return node[eventsSymbol] || (node[eventsSymbol] = {});
4406	}
4407
4408	function on(node, types, fn, data, selector) {
4409		types = types.split(rspaces);
4410
4411		var events = getEvents(node);
4412		var i = types.length;
4413		var handlers, type;
4414
4415		function handler(e) { fn(e, data); }
4416
4417		while (i--) {
4418			type = types[i];
4419			handlers = events[type] || (events[type] = []);
4420			handlers.push([fn, handler]);
4421			node.addEventListener(type, handler);
4422		}
4423	}
4424
4425	function off(node, types, fn, selector) {
4426		types = types.split(rspaces);
4427
4428		var events = getEvents(node);
4429		var i = types.length;
4430		var type, handlers, k;
4431
4432		if (!events) { return; }
4433
4434		while (i--) {
4435			type = types[i];
4436			handlers = events[type];
4437			if (!handlers) { continue; }
4438			k = handlers.length;
4439			while (k--) {
4440				if (handlers[k][0] === fn) {
4441					node.removeEventListener(type, handlers[k][1]);
4442					handlers.splice(k, 1);
4443				}
4444			}
4445		}
4446	}
4447
4448	function trigger(node, type, properties) {
4449		// Don't cache events. It prevents you from triggering an event of a
4450		// given type from inside the handler of another event of that type.
4451		var event = createEvent(type);
4452		if (properties) { assign(event, properties); }
4453		node.dispatchEvent(event);
4454	}
4455
4456
4457	// Constructors
4458
4459	function Timer(fn){
4460		var callback = fn,
4461		    active = false,
4462		    running = false;
4463
4464		function trigger(time) {
4465			if (active){
4466				callback();
4467				requestFrame(trigger);
4468				running = true;
4469				active = false;
4470			}
4471			else {
4472				running = false;
4473			}
4474		}
4475
4476		this.kick = function(fn) {
4477			active = true;
4478			if (!running) { trigger(); }
4479		};
4480
4481		this.end = function(fn) {
4482			var cb = callback;
4483
4484			if (!fn) { return; }
4485
4486			// If the timer is not running, simply call the end callback.
4487			if (!running) {
4488				fn();
4489			}
4490			// If the timer is running, and has been kicked lately, then
4491			// queue up the current callback and the end callback, otherwise
4492			// just the end callback.
4493			else {
4494				callback = active ?
4495					function(){ cb(); fn(); } :
4496					fn ;
4497
4498				active = true;
4499			}
4500		};
4501	}
4502
4503
4504	// Functions
4505
4506	function noop() {}
4507
4508	function preventDefault(e) {
4509		e.preventDefault();
4510	}
4511
4512	function isIgnoreTag(e) {
4513		return !!ignoreTags[e.target.tagName.toLowerCase()];
4514	}
4515
4516	function isPrimaryButton(e) {
4517		// Ignore mousedowns on any button other than the left (or primary)
4518		// mouse button, or when a modifier key is pressed.
4519		return (e.which === 1 && !e.ctrlKey && !e.altKey);
4520	}
4521
4522	function identifiedTouch(touchList, id) {
4523		var i, l;
4524
4525		if (touchList.identifiedTouch) {
4526			return touchList.identifiedTouch(id);
4527		}
4528
4529		// touchList.identifiedTouch() does not exist in
4530		// webkit yet… we must do the search ourselves...
4531
4532		i = -1;
4533		l = touchList.length;
4534
4535		while (++i < l) {
4536			if (touchList[i].identifier === id) {
4537				return touchList[i];
4538			}
4539		}
4540	}
4541
4542	function changedTouch(e, data) {
4543		var touch = identifiedTouch(e.changedTouches, data.identifier);
4544
4545		// This isn't the touch you're looking for.
4546		if (!touch) { return; }
4547
4548		// Chrome Android (at least) includes touches that have not
4549		// changed in e.changedTouches. That's a bit annoying. Check
4550		// that this touch has changed.
4551		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
4552
4553		return touch;
4554	}
4555
4556
4557	// Handlers that decide when the first movestart is triggered
4558
4559	function mousedown(e){
4560		// Ignore non-primary buttons
4561		if (!isPrimaryButton(e)) { return; }
4562
4563		// Ignore form and interactive elements
4564		if (isIgnoreTag(e)) { return; }
4565
4566		on(document, mouseevents.move, mousemove, e);
4567		on(document, mouseevents.cancel, mouseend, e);
4568	}
4569
4570	function mousemove(e, data){
4571		checkThreshold(e, data, e, removeMouse);
4572	}
4573
4574	function mouseend(e, data) {
4575		removeMouse();
4576	}
4577
4578	function removeMouse() {
4579		off(document, mouseevents.move, mousemove);
4580		off(document, mouseevents.cancel, mouseend);
4581	}
4582
4583	function touchstart(e) {
4584		// Don't get in the way of interaction with form elements
4585		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
4586
4587		var touch = e.changedTouches[0];
4588
4589		// iOS live updates the touch objects whereas Android gives us copies.
4590		// That means we can't trust the touchstart object to stay the same,
4591		// so we must copy the data. This object acts as a template for
4592		// movestart, move and moveend event objects.
4593		var data = {
4594			target:     touch.target,
4595			pageX:      touch.pageX,
4596			pageY:      touch.pageY,
4597			identifier: touch.identifier,
4598
4599			// The only way to make handlers individually unbindable is by
4600			// making them unique.
4601			touchmove:  function(e, data) { touchmove(e, data); },
4602			touchend:   function(e, data) { touchend(e, data); }
4603		};
4604
4605		on(document, touchevents.move, data.touchmove, data);
4606		on(document, touchevents.cancel, data.touchend, data);
4607	}
4608
4609	function touchmove(e, data) {
4610		var touch = changedTouch(e, data);
4611		if (!touch) { return; }
4612		checkThreshold(e, data, touch, removeTouch);
4613	}
4614
4615	function touchend(e, data) {
4616		var touch = identifiedTouch(e.changedTouches, data.identifier);
4617		if (!touch) { return; }
4618		removeTouch(data);
4619	}
4620
4621	function removeTouch(data) {
4622		off(document, touchevents.move, data.touchmove);
4623		off(document, touchevents.cancel, data.touchend);
4624	}
4625
4626	function checkThreshold(e, data, touch, fn) {
4627		var distX = touch.pageX - data.pageX;
4628		var distY = touch.pageY - data.pageY;
4629
4630		// Do nothing if the threshold has not been crossed.
4631		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
4632
4633		triggerStart(e, data, touch, distX, distY, fn);
4634	}
4635
4636	function triggerStart(e, data, touch, distX, distY, fn) {
4637		var touches = e.targetTouches;
4638		var time = e.timeStamp - data.timeStamp;
4639
4640		// Create a movestart object with some special properties that
4641		// are passed only to the movestart handlers.
4642		var template = {
4643			altKey:     e.altKey,
4644			ctrlKey:    e.ctrlKey,
4645			shiftKey:   e.shiftKey,
4646			startX:     data.pageX,
4647			startY:     data.pageY,
4648			distX:      distX,
4649			distY:      distY,
4650			deltaX:     distX,
4651			deltaY:     distY,
4652			pageX:      touch.pageX,
4653			pageY:      touch.pageY,
4654			velocityX:  distX / time,
4655			velocityY:  distY / time,
4656			identifier: data.identifier,
4657			targetTouches: touches,
4658			finger: touches ? touches.length : 1,
4659			enableMove: function() {
4660				this.moveEnabled = true;
4661				this.enableMove = noop;
4662				e.preventDefault();
4663			}
4664		};
4665
4666		// Trigger the movestart event.
4667		trigger(data.target, 'movestart', template);
4668
4669		// Unbind handlers that tracked the touch or mouse up till now.
4670		fn(data);
4671	}
4672
4673
4674	// Handlers that control what happens following a movestart
4675
4676	function activeMousemove(e, data) {
4677		var timer  = data.timer;
4678
4679		data.touch = e;
4680		data.timeStamp = e.timeStamp;
4681		timer.kick();
4682	}
4683
4684	function activeMouseend(e, data) {
4685		var target = data.target;
4686		var event  = data.event;
4687		var timer  = data.timer;
4688
4689		removeActiveMouse();
4690
4691		endEvent(target, event, timer, function() {
4692			// Unbind the click suppressor, waiting until after mouseup
4693			// has been handled.
4694			setTimeout(function(){
4695				off(target, 'click', preventDefault);
4696			}, 0);
4697		});
4698	}
4699
4700	function removeActiveMouse() {
4701		off(document, mouseevents.move, activeMousemove);
4702		off(document, mouseevents.end, activeMouseend);
4703	}
4704
4705	function activeTouchmove(e, data) {
4706		var event = data.event;
4707		var timer = data.timer;
4708		var touch = changedTouch(e, event);
4709
4710		if (!touch) { return; }
4711
4712		// Stop the interface from gesturing
4713		e.preventDefault();
4714
4715		event.targetTouches = e.targetTouches;
4716		data.touch = touch;
4717		data.timeStamp = e.timeStamp;
4718
4719		timer.kick();
4720	}
4721
4722	function activeTouchend(e, data) {
4723		var target = data.target;
4724		var event  = data.event;
4725		var timer  = data.timer;
4726		var touch  = identifiedTouch(e.changedTouches, event.identifier);
4727
4728		// This isn't the touch you're looking for.
4729		if (!touch) { return; }
4730
4731		removeActiveTouch(data);
4732		endEvent(target, event, timer);
4733	}
4734
4735	function removeActiveTouch(data) {
4736		off(document, touchevents.move, data.activeTouchmove);
4737		off(document, touchevents.end, data.activeTouchend);
4738	}
4739
4740
4741	// Logic for triggering move and moveend events
4742
4743	function updateEvent(event, touch, timeStamp) {
4744		var time = timeStamp - event.timeStamp;
4745
4746		event.distX =  touch.pageX - event.startX;
4747		event.distY =  touch.pageY - event.startY;
4748		event.deltaX = touch.pageX - event.pageX;
4749		event.deltaY = touch.pageY - event.pageY;
4750
4751		// Average the velocity of the last few events using a decay
4752		// curve to even out spurious jumps in values.
4753		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
4754		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
4755		event.pageX =  touch.pageX;
4756		event.pageY =  touch.pageY;
4757	}
4758
4759	function endEvent(target, event, timer, fn) {
4760		timer.end(function(){
4761			trigger(target, 'moveend', event);
4762			return fn && fn();
4763		});
4764	}
4765
4766
4767	// Set up the DOM
4768
4769	function movestart(e) {
4770		if (e.defaultPrevented) { return; }
4771		if (!e.moveEnabled) { return; }
4772
4773		var event = {
4774			startX:        e.startX,
4775			startY:        e.startY,
4776			pageX:         e.pageX,
4777			pageY:         e.pageY,
4778			distX:         e.distX,
4779			distY:         e.distY,
4780			deltaX:        e.deltaX,
4781			deltaY:        e.deltaY,
4782			velocityX:     e.velocityX,
4783			velocityY:     e.velocityY,
4784			identifier:    e.identifier,
4785			targetTouches: e.targetTouches,
4786			finger:        e.finger
4787		};
4788
4789		var data = {
4790			target:    e.target,
4791			event:     event,
4792			timer:     new Timer(update),
4793			touch:     undefined,
4794			timeStamp: e.timeStamp
4795		};
4796
4797		function update(time) {
4798			updateEvent(event, data.touch, data.timeStamp);
4799			trigger(data.target, 'move', event);
4800		}
4801
4802		if (e.identifier === undefined) {
4803			// We're dealing with a mouse event.
4804			// Stop clicks from propagating during a move
4805			on(e.target, 'click', preventDefault);
4806			on(document, mouseevents.move, activeMousemove, data);
4807			on(document, mouseevents.end, activeMouseend, data);
4808		}
4809		else {
4810			// In order to unbind correct handlers they have to be unique
4811			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
4812			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
4813
4814			// We're dealing with a touch.
4815			on(document, touchevents.move, data.activeTouchmove, data);
4816			on(document, touchevents.end, data.activeTouchend, data);
4817		}
4818	}
4819
4820	on(document, 'mousedown', mousedown);
4821	on(document, 'touchstart', touchstart);
4822	on(document, 'movestart', movestart);
4823
4824
4825	// jQuery special events
4826	//
4827	// jQuery event objects are copies of DOM event objects. They need
4828	// a little help copying the move properties across.
4829
4830	if (!window.jQuery) { return; }
4831
4832	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
4833
4834	function enableMove1(e) { e.enableMove(); }
4835	function enableMove2(e) { e.enableMove(); }
4836	function enableMove3(e) { e.enableMove(); }
4837
4838	function add(handleObj) {
4839		var handler = handleObj.handler;
4840
4841		handleObj.handler = function(e) {
4842			// Copy move properties across from originalEvent
4843			var i = properties.length;
4844			var property;
4845
4846			while(i--) {
4847				property = properties[i];
4848				e[property] = e.originalEvent[property];
4849			}
4850
4851			handler.apply(this, arguments);
4852		};
4853	}
4854
4855	jQuery.event.special.movestart = {
4856		setup: function() {
4857			// Movestart must be enabled to allow other move events
4858			on(this, 'movestart', enableMove1);
4859
4860			// Do listen to DOM events
4861			return false;
4862		},
4863
4864		teardown: function() {
4865			off(this, 'movestart', enableMove1);
4866			return false;
4867		},
4868
4869		add: add
4870	};
4871
4872	jQuery.event.special.move = {
4873		setup: function() {
4874			on(this, 'movestart', enableMove2);
4875			return false;
4876		},
4877
4878		teardown: function() {
4879			off(this, 'movestart', enableMove2);
4880			return false;
4881		},
4882
4883		add: add
4884	};
4885
4886	jQuery.event.special.moveend = {
4887		setup: function() {
4888			on(this, 'movestart', enableMove3);
4889			return false;
4890		},
4891
4892		teardown: function() {
4893			off(this, 'movestart', enableMove3);
4894			return false;
4895		},
4896
4897		add: add
4898	};
4899});
4900
4901  $.fn.twentytwenty = function(options) {
4902    var options = $.extend({
4903      default_offset_pct: 0.5,
4904      orientation: 'horizontal',
4905      before_label: 'Before',
4906      after_label: 'After',
4907      no_overlay: false,
4908      move_slider_on_hover: false,
4909      move_with_handle_only: true,
4910      click_to_move: false
4911    }, options);
4912
4913    return this.each(function() {
4914
4915      var sliderPct = options.default_offset_pct;
4916      var container = $(this);
4917      var sliderOrientation = options.orientation;
4918      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
4919      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
4920
4921
4922      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
4923      if(!options.no_overlay) {
4924        container.append("<div class='twentytwenty-overlay'></div>");
4925        var overlay = container.find(".twentytwenty-overlay");
4926        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
4927        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
4928      }
4929      var beforeImg = container.find("img:first");
4930      var afterImg = container.find("img:last");
4931      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
4932      var slider = container.find(".twentytwenty-handle");
4933      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
4934      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
4935      container.addClass("twentytwenty-container");
4936      beforeImg.addClass("twentytwenty-before");
4937      afterImg.addClass("twentytwenty-after");
4938
4939      var calcOffset = function(dimensionPct) {
4940        var w = beforeImg.width();
4941        var h = beforeImg.height();
4942        return {
4943          w: w+"px",
4944          h: h+"px",
4945          cw: (dimensionPct*w)+"px",
4946          ch: (dimensionPct*h)+"px"
4947        };
4948      };
4949
4950      var adjustContainer = function(offset) {
4951      	if (sliderOrientation === 'vertical') {
4952          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
4953          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
4954      	}
4955      	else {
4956          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
4957          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
4958    	}
4959        container.css("height", offset.h);
4960      };
4961
4962      var adjustSlider = function(pct) {
4963        var offset = calcOffset(pct);
4964        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
4965        adjustContainer(offset);
4966      };
4967
4968      // Return the number specified or the min/max number if it outside the range given.
4969      var minMaxNumber = function(num, min, max) {
4970        return Math.max(min, Math.min(max, num));
4971      };
4972
4973      // Calculate the slider percentage based on the position.
4974      var getSliderPercentage = function(positionX, positionY) {
4975        var sliderPercentage = (sliderOrientation === 'vertical') ?
4976          (positionY-offsetY)/imgHeight :
4977          (positionX-offsetX)/imgWidth;
4978
4979        return minMaxNumber(sliderPercentage, 0, 1);
4980      };
4981
4982
4983      $(window).on("resize.twentytwenty", function(e) {
4984        adjustSlider(sliderPct);
4985      });
4986
4987      var offsetX = 0;
4988      var offsetY = 0;
4989      var imgWidth = 0;
4990      var imgHeight = 0;
4991      var onMoveStart = function(e) {
4992        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
4993          e.preventDefault();
4994        }
4995        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
4996          e.preventDefault();
4997        }
4998        container.addClass("active");
4999        offsetX = container.offset().left;
5000        offsetY = container.offset().top;
5001        imgWidth = beforeImg.width();
5002        imgHeight = beforeImg.height();
5003      };
5004      var onMove = function(e) {
5005        if (container.hasClass("active")) {
5006          sliderPct = getSliderPercentage(e.pageX, e.pageY);
5007          adjustSlider(sliderPct);
5008        }
5009      };
5010      var onMoveEnd = function() {
5011          container.removeClass("active");
5012      };
5013
5014      var moveTarget = options.move_with_handle_only ? slider : container;
5015      moveTarget.on("movestart",onMoveStart);
5016      moveTarget.on("move",onMove);
5017      moveTarget.on("moveend",onMoveEnd);
5018
5019      if (options.move_slider_on_hover) {
5020        container.on("mouseenter", onMoveStart);
5021        container.on("mousemove", onMove);
5022        container.on("mouseleave", onMoveEnd);
5023      }
5024
5025      slider.on("touchmove", function(e) {
5026        e.preventDefault();
5027      });
5028
5029      container.find("img").on("mousedown", function(event) {
5030        event.preventDefault();
5031      });
5032
5033      if (options.click_to_move) {
5034        container.on('click', function(e) {
5035          offsetX = container.offset().left;
5036          offsetY = container.offset().top;
5037          imgWidth = beforeImg.width();
5038          imgHeight = beforeImg.height();
5039
5040          sliderPct = getSliderPercentage(e.pageX, e.pageY);
5041          adjustSlider(sliderPct);
5042        });
5043      }
5044
5045      $(window).trigger("resize.twentytwenty");
5046    });
5047  };
5048
5049
5050  $(window).on("load", function(e) {
5051    $('.twentytwenty-container').twentytwenty();
5052    $('.twentytwenty-container img').on('async-done', function(){
5053    	$(this).closest('.twentytwenty-container').twentytwenty();
5054    });
5055  });
5056}
5057
5058UNCODE.justifiedGallery = function() {
5059
5060	var breakPointMe = function( val ) {
5061		val = parseInt( val );
5062		if ( isNaN(val) ) {
5063			return false;
5064		}
5065		if ( val >= 1500 ) {
5066			return 1;
5067		} else if ( val < 1500 && val >= 960 ) {
5068			return 2;
5069		} else if ( val < 960 && val >= 570 ) {
5070			return 3;
5071		} else if ( val < 570 ) {
5072			return 4;
5073		}
5074	}
5075
5076	var gutterByBreakpoint = function( bp, gutter ) {
5077		var ret;
5078		switch(gutter) {
5079		    case 'no-gutter':
5080		    	ret = 0;
5081		        break;
5082		    case 'px-gutter':
5083		    	ret = 1;
5084		        break;
5085		    case 'half-gutter':
5086		    	ret = 18;
5087		        break;
5088		    case 'double-gutter':
5089				switch(bp) {
5090				    case 3:
5091				    case 4:
5092				    	ret = 36;
5093				        break;
5094				    default:
5095				    	ret = 72;
5096				        break;
5097				}
5098		        break;
5099		    case 'triple-gutter':
5100				switch(bp) {
5101				    case 3:
5102				    case 4:
5103				    	ret = 36;
5104				        break;
5105				    default:
5106				    	ret = 108;
5107				        break;
5108				}
5109		        break;
5110		    case 'quad-gutter':
5111				switch(bp) {
5112				    case 2:
5113				    	ret = 108;
5114				        break;
5115				    case 3:
5116				    	ret = 72;
5117				        break;
5118				    case 4:
5119				    	ret = 36;
5120				        break;
5121				    default:
5122				    	ret = 144;
5123				        break;
5124				}
5125		        break;
5126		    default:
5127		    	ret = 36;//single-gutter
5128		}
5129		return ret;
5130	}
5131
5132	if ($('.justified-layout').length > 0) {
5133		var justifiedContainersArray = [],
5134			typeGridArray = [],
5135			layoutGridArray = [],
5136			transitionDuration = [],
5137			$filterItems = [],
5138			$filters = $('.justified-system .isotope-filters'),
5139			$itemSelector = '.tmb',
5140			$items,
5141			itemMargin,
5142			correctionFactor = 0,
5143			firstLoad = true,
5144			isOriginLeft = $('body').hasClass('rtl') ? false : true,
5145			prevW = breakPointMe(UNCODE.wwidth);
5146		$('[class*="justified-container"]').each(function() {
5147			var isoData = $(this).data();
5148			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
5149			if (isoData.type == 'metro') typeGridArray.push(true);
5150			else typeGridArray.push(false);
5151			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
5152			else layoutGridArray.push('justified');
5153			justifiedContainersArray.push($(this));
5154		});
5155		var init_justifiedGallery = function() {
5156			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
5157				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
5158					justifiedId = justifiedSystem.attr('id'),
5159					$layoutMode = layoutGridArray[i],
5160					gutter = $(justifiedContainersArray[i]).data('gutter'),
5161					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
5162					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
5163					lastRow = $(justifiedContainersArray[i]).data('last-row'),
5164					margins;
5165
5166				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
5167				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
5168				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
5169
5170				margins = gutterByBreakpoint(prevW, gutter);
5171
5172				$(justifiedContainersArray[i]).justifiedGallery({
5173					rowHeight: rowHeight,
5174					maxRowHeight: maxRowHeight,
5175					margins: margins,
5176					cssAnimation: true,
5177					lastRow: lastRow,
5178					waitThumbnailsLoad: false
5179				}).one('jg.complete', function(){ onLayout($(this), 0); } );
5180
5181				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
5182					$(justifiedContainersArray[i]).infinitescroll({
5183							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
5184							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
5185							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
5186							animate: false,
5187							behavior: 'local',
5188							debug: false,
5189							loading: {
5190								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
5191								speed: 0,
5192								finished: undefined,
5193								msg: $('#' + justifiedId + ' .loadmore-button'),
5194							},
5195							errorCallback: function() {
5196								var justified_system = $(this).closest('.justified-system');
5197								$('.loading-button', justified_system).hide();
5198								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
5199							}
5200						},
5201						// append the new items to galleryJustified on the infinitescroll callback function.
5202						function(newElements, opts) {
5203							var $galleryJustified = $(this),
5204								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
5205								filters = new Array(),
5206								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
5207								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
5208								$numPages = $('a', $infinite_button).data('pages'),
5209								delay = 300;
5210							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
5211							$infinite_button.show();
5212							$loading_button.hide();
5213							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
5214							$('> li', $galleryJustified).remove();
5215							$.each($(newElements), function(index, val) {
5216								$(val).addClass('tmb-iso');
5217								if ($(val).is("li")) {
5218									filters.push($(val)[0]);
5219								}
5220							});
5221							newElements = newElements.filter(function(x) {
5222								return filters.indexOf(x) < 0
5223							});
5224							$.each($(filters), function(index, val) {
5225								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
5226							});
5227							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
5228							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
5229								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
5230								if (typeof getLightbox === 'object') {
5231									getLightbox.refresh();
5232								} else {
5233									UNCODE.lightbox();
5234								}
5235							}
5236							if ( typeof twttr !== 'undefined' )
5237								twttr.widgets.load(justifiedContainersArray[i]);
5238
5239							requestTimeout(function() {
5240								$galleryJustified.trigger('more-items-loaded');
5241							}, 1000);
5242						});
5243					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
5244						var $infinite_justified = $(justifiedContainersArray[i]),
5245							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
5246						$infinite_justified.infinitescroll('pause');
5247						$infinite_button.on('click', function(event) {
5248							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
5249								$.each(UNCODE.lightboxArray, function(index, val) {
5250									UNCODE.lightboxArray[index].destroy();
5251								});
5252							}
5253							event.preventDefault();
5254							var $justified_system = $(event.target).closest('.justified-system'),
5255							$infinite_justified = $justified_system.find('.justified-container'),
5256							justifiedId = $justified_system.attr('id');
5257							$(event.currentTarget).html(SiteParameters.loading);
5258							$infinite_justified.infinitescroll('resume');
5259							$infinite_justified.infinitescroll('retrieve');
5260							$infinite_justified.infinitescroll('pause');
5261							$infinite_justified.trigger('more-items-loaded');
5262						});
5263					}
5264				}
5265			}
5266		},
5267		onLayout = function(justifiedObj, startIndex) {
5268			justifiedObj.css('opacity', 1);
5269			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
5270			$('.tmb', justifiedObj).addClass('justified-object-loaded');
5271
5272			requestTimeout(function() {
5273				// window.dispatchEvent(UNCODE.boxEvent);
5274				UNCODE.adaptive();
5275				if (SiteParameters.dynamic_srcset_active === '1') {
5276					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
5277				}
5278				if (typeof MediaElement === "function") {
5279					$(justifiedObj).find('audio,video').each(function() {
5280						$(this).mediaelementplayer({
5281								pauseOtherPlayers: false,
5282						});
5283					});
5284				}
5285				if ($(justifiedObj).find('.nested-carousel').length) {
5286					if (typeof UNCODE.carousel !== 'undefined') {
5287						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
5288					}
5289					requestTimeout(function() {
5290						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
5291						justifiedObj.addClass('justified-gallery-finished')
5292						Waypoint.refreshAll();
5293					}, 200);
5294				} else {
5295					requestTimeout(function() {
5296						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
5297						justifiedObj.addClass('justified-gallery-finished')
5298						Waypoint.refreshAll();
5299					}, 300);
5300				}
5301			}, 100);
5302
5303		},
5304		boxAnimation = function(items, startIndex, sequential, container) {
5305			var $allItems = items.length - startIndex,
5306				showed = 0,
5307				index = 0;
5308			if (container.closest('.owl-item').length == 1) return false;
5309			$.each(items, function(index, val) {
5310				var elInner = $('> .t-inside', val);
5311				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5312					return;
5313				}
5314				if (val[0]) val = val[0];
5315				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
5316					new Waypoint({
5317						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5318						element: val,
5319						handler: function() {
5320							var element = $('> .t-inside', this.element),
5321								parent = $(this.element),
5322								currentIndex = parent.index();
5323							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
5324								delayAttr = parseInt(element.attr('data-delay'));
5325							if (isNaN(delayAttr)) delayAttr = 100;
5326							delay -= showed;
5327							var objTimeout = requestTimeout(function() {
5328								element.removeClass('zoom-reverse').addClass('start_animation');
5329								showed = parent.index();
5330							}, delay * delayAttr);
5331							parent.data('objTimeout', objTimeout);
5332							if (!UNCODE.isUnmodalOpen) {
5333								this.destroy();
5334							}
5335						},
5336						offset: '100%'
5337					})
5338				} else {
5339					elInner.removeClass('animate_when_almost_visible');
5340					$(val).addClass('no-waypoint-animation');
5341					/*if (elInner.hasClass('force-anim')) {
5342						elInner.addClass('start_animation');
5343					} else {
5344						elInner.css('opacity', 1);
5345					}*/
5346				}
5347				index++;
5348			});
5349		};
5350		$filters.on('click', 'a[data-filter]', function(evt) {
5351			var $filter = $(this),
5352				filterContainer = $filter.closest('.isotope-filters'),
5353				filterValue = $filter.attr('data-filter'),
5354				container = $filter.closest('.justified-system').find($('.justified-layout')),
5355				lastRow = container.data('last-row'),
5356				transitionDuration = 0,
5357				delay = 300,
5358				filterItems = [];
5359
5360			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
5361
5362			var filter_items = function(){
5363				if (filterValue !== undefined) {
5364					$.each($('> .tmb > .t-inside', container), function(index, val) {
5365						var parent = $(val).parent(),
5366							objTimeout = parent.data('objTimeout');
5367						if (objTimeout) {
5368							$(val).removeClass('zoom-reverse');
5369							clearRequestTimeout(objTimeout);
5370						}
5371						if (transitionDuration == 0) {
5372							if ($(val).hasClass('animate_when_almost_visible')) {
5373								$(val).addClass('zoom-reverse').removeClass('start_animation');
5374							} else {
5375								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
5376							}
5377						}
5378					});
5379
5380					requestTimeout(function() {
5381						var $block,
5382							selector,
5383							lightboxElements,
5384							$boxes;
5385
5386						if ( filterValue !== '' && filterValue !== '*' ) {
5387							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
5388							selector = '.' + filterValue;
5389							$.each($(selector, container), function(index, block) {
5390								lightboxElements = $('[data-lbox^=ilightbox]', block);
5391								if (lightboxElements.length) {
5392									lightboxElements.removeClass('lb-disabled');
5393									container.data('lbox', $(lightboxElements[0]).data('lbox'));
5394								}
5395								filterItems.push(block);
5396							});
5397							container.justifiedGallery({
5398								filter: selector,
5399								lastRow: 'nojustify'
5400							});
5401						} else {
5402							container.justifiedGallery({
5403								filter: false,
5404								lastRow: lastRow
5405							});
5406							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
5407							filterItems = $('> .tmb', container);
5408						}
5409						container.trigger('more-items-loaded');
5410
5411						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
5412						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
5413							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
5414							if (typeof getLightbox === 'object') {
5415								getLightbox.refresh();
5416							} else {
5417								UNCODE.lightbox();
5418							}
5419						}
5420
5421						if (transitionDuration == 0) {
5422							requestTimeout(function() {
5423								boxAnimation(filterItems, 0, false, container);
5424							}, 100);
5425						}
5426						requestTimeout(function() {
5427							Waypoint.refreshAll();
5428							container.trigger('more-items-loaded');
5429						}, 2000);
5430
5431					}, delay);
5432				} else {
5433					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
5434						$.each(UNCODE.lightboxArray, function(index, val) {
5435							UNCODE.lightboxArray[index].destroy();
5436						});
5437					}
5438					$.each($('> .tmb > .t-inside', container), function(index, val) {
5439						var parent = $(val).parent(),
5440							objTimeout = parent.data('objTimeout');
5441						if (objTimeout) {
5442							$(val).removeClass('zoom-reverse').removeClass('start_animation')
5443							clearRequestTimeout(objTimeout);
5444						}
5445						if (transitionDuration == 0) {
5446							if ($(val).hasClass('animate_when_almost_visible')) {
5447								$(val).addClass('zoom-reverse').removeClass('start_animation');
5448							} else {
5449								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
5450							}
5451						}
5452					});
5453					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
5454						UNCODE.lightbox();
5455					}
5456					container.parent().addClass('justified-loading');
5457					container.trigger('more-items-loaded');
5458				}
5459			};
5460
5461			if (!$filter.hasClass('active')) {
5462				/** Scroll top with filtering */
5463				if (filterContainer.hasClass('filter-scroll')) {
5464                    var calc_scroll = container.closest('.row-parent').offset().top;
5465                    calc_scroll -= UNCODE.get_scroll_offset();
5466
5467					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5468						delta = bodyTop - calc_scroll,
5469						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
5470						filterTolerance = false,
5471						filter_timeout;
5472					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
5473
5474					if ( !UNCODE.isFullPage ) {
5475						if (scrollSpeed == 0) {
5476							$('html, body').scrollTop(calc_scroll);
5477							UNCODE.scrolling = false;
5478							filter_items();
5479						} else {
5480
5481							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
5482								filter_items();
5483								filterTolerance = true;
5484							}
5485
5486							$('html, body').animate({
5487								scrollTop: calc_scroll
5488							},{
5489								easing: 'easeInOutQuad',
5490								duration: scrollSpeed,
5491								complete: function(){
5492									UNCODE.scrolling = false;
5493									if ( !filterTolerance ) {
5494										filter_timeout = setTimeout(function(){
5495											clearTimeout(filter_timeout);
5496											filter_items();
5497										}, 200);
5498									}
5499								}
5500							});
5501						}
5502					}
5503				} else {
5504					filter_items();
5505				}
5506			}
5507			evt.preventDefault();
5508		});
5509
5510		$filters.each(function(i, buttonGroup) {
5511			var $buttonGroup = $(buttonGroup);
5512			$buttonGroup.on('click', 'a', function() {
5513				$buttonGroup.find('.active').removeClass('active');
5514				$(this).addClass('active');
5515			});
5516
5517			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
5518				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
5519				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
5520			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
5521				e.preventDefault();
5522				$cats_filters.slideToggle(400, 'easeInOutCirc');
5523			});
5524		});
5525		window.addEventListener('boxResized', function(e) {
5526			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
5527				prevW = breakPointMe(UNCODE.wwidth);
5528				$.each($('.justified-layout'), function(index, val) {
5529					var gutter = $(this).data('gutter'),
5530						margins = gutterByBreakpoint( prevW, gutter);
5531					$(this).justifiedGallery({
5532						margins: margins
5533					});
5534					$(this).find('.mejs-video,.mejs-audio').each(function() {
5535						$(this).trigger('resize');
5536					});
5537				});
5538			}
5539		}, false);
5540
5541		init_justifiedGallery();
5542	};
5543};
5544
5545UNCODE.cssGrid = function() {
5546	if ($('.cssgrid-layout').length > 0) {
5547		var cssGridContainersArray = [];
5548		var transitionDuration = [];
5549		var $filters = $('.cssgrid-system .cssgrid-filters');
5550
5551		$('[class*="cssgrid-container"]').each(function() {
5552			cssGridContainersArray.push($(this));
5553			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
5554		});
5555
5556		var init_cssGridAjax = function() {
5557			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
5558				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
5559					cssGridId = cssGridSystem.attr('id');
5560
5561				cssGridSystem.data('transitionDuration', transitionDuration[i]);
5562
5563				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
5564					$(cssGridContainersArray[i]).infinitescroll({
5565						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
5566						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
5567						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li', // selector for all items you'll retrieve
5568						animate: false,
5569						behavior: 'local',
5570						debug: false,
5571						loading: {
5572							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
5573							speed: 0,
5574							finished: undefined,
5575							msg: $('#' + cssGridId + ' .loadmore-button'),
5576						},
5577						errorCallback: function() {
5578							var cssgrid_system = $(this).closest('.cssgrid-system');
5579							$('.loading-button', cssgrid_system).hide();
5580							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
5581						}
5582					},
5583					// append the new items to cssGrid on the infinitescroll callback function.
5584					function(newElements, opts) {
5585						var $cssGrid = $(this),
5586							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
5587							cssGridId = cssGridSystemCont.attr('id'),
5588							filters = new Array(),
5589							$loading_button = $cssGrid.closest('.cssgrid-system').find('.loading-button'),
5590							$infinite_button = $cssGrid.closest('.cssgrid-system').find('.loadmore-button'),
5591							$numPages = $('a', $infinite_button).data('pages'),
5592							delay = 300;
5593						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
5594						$infinite_button.show();
5595						$loading_button.hide();
5596						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
5597						$('> li', $cssGrid).remove();
5598						$.each($(newElements), function(index, val) {
5599							$(val).addClass('tmb-grid');
5600							if ($(val).is("li")) {
5601								filters.push($(val)[0]);
5602							}
5603						});
5604						newElements = newElements.filter(function(x) {
5605							return filters.indexOf(x) < 0
5606						});
5607						$.each($(filters), function(index, val) {
5608							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
5609						});
5610
5611						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
5612						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
5613						if (filterValue !== undefined && filterValue != '*') {
5614							$(newElements).hide();
5615							var els_to_show = $();
5616							$(newElements).each(function() {
5617								var el = $(this);
5618								if (el.hasClass(filterValue)) {
5619									els_to_show = els_to_show.add(el);
5620									el.show();
5621								}
5622							});
5623							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
5624						} else {
5625							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
5626						}
5627
5628						UNCODE.adaptive();
5629						if (SiteParameters.dynamic_srcset_active === '1') {
5630							UNCODE.refresh_dynamic_srcset_size($cssGrid);
5631						}
5632						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
5633							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
5634							if (typeof getLightbox === 'object') {
5635								getLightbox.refresh();
5636							} else {
5637								UNCODE.lightbox();
5638							}
5639						}
5640						if ( typeof twttr !== 'undefined' ) {
5641							twttr.widgets.load(cssGridContainersArray[i]);
5642						}
5643
5644						requestTimeout(function() {
5645							$cssGrid.trigger('more-items-loaded');
5646						}, 1000);
5647
5648					});
5649					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
5650						var $cssgrid_el = $(cssGridContainersArray[i]),
5651							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
5652						$cssgrid_el.infinitescroll('pause');
5653						$infinite_button.on('click', function(event) {
5654							event.preventDefault();
5655							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
5656							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
5657							cssGridId = $cssgrid_system.attr('id');
5658							$(event.currentTarget).html(SiteParameters.loading);
5659							$cssgrid_el.infinitescroll('resume');
5660							$cssgrid_el.infinitescroll('retrieve');
5661							$cssgrid_el.infinitescroll('pause');
5662						});
5663					}
5664				}
5665			}
5666		};
5667
5668		init_cssGridAjax();
5669
5670		if ($('.cssgrid-pagination').length > 0) {
5671			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
5672				evt.preventDefault();
5673
5674                var container = $(this).closest('.cssgrid-system'),
5675                	calc_scroll = container.closest('.row-parent').offset().top;
5676
5677                calc_scroll -= UNCODE.get_scroll_offset();
5678
5679				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5680					delta = bodyTop - calc_scroll,
5681					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
5682				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
5683
5684				if ( !UNCODE.isFullPage ) {
5685					if (scrollSpeed == 0) {
5686						$('html, body').scrollTop(calc_scroll);
5687					} else {
5688						$('html, body').animate({
5689							scrollTop: calc_scroll
5690						},{
5691							easing: 'easeInOutQuad',
5692							duration: scrollSpeed,
5693							complete: function(){
5694								UNCODE.scrolling = false;
5695							}
5696						});
5697					}
5698				}
5699
5700				loadCssGrid($(this));
5701				evt.preventDefault();
5702			});
5703		}
5704
5705		$filters.on('click', 'a.grid-nav-link', function(evt) {
5706			if ($(this).hasClass('no-grid-filter')) {
5707				return;
5708			}
5709			var $filter = $(this),
5710				filterContainer = $filter.closest('.cssgrid-filters'),
5711				filterValue = $filter.attr('data-filter'),
5712				containerSystem = $filter.closest('.cssgrid-system'),
5713				container = containerSystem.find($('.cssgrid-layout')),
5714				transitionDuration = containerSystem.data('transitionDuration'),
5715				delay = 300,
5716				filterItems = [],
5717				all_thumbs = container.find('.tmb-grid');
5718
5719			var filter_items = function(){
5720				if (filterValue !== undefined) {
5721					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
5722						var parent = $(val).parent(),
5723							objTimeout = parent.data('objTimeout');
5724						if (objTimeout) {
5725							$(val).removeClass('zoom-reverse').removeClass('start_animation')
5726							clearRequestTimeout(objTimeout);
5727						}
5728						if (transitionDuration == 0) {
5729							if ($(val).hasClass('animate_when_almost_visible')) {
5730								$(val).addClass('zoom-reverse').removeClass('start_animation');
5731							} else {
5732								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
5733							}
5734						}
5735					});
5736					requestTimeout(function(){
5737						if ( filterValue == '*' ) {
5738							all_thumbs.show();
5739							all_thumbs.each(function(index, val) {
5740								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
5741								filterItems.push($(this));
5742							});
5743						} else {
5744							all_thumbs.each(function() {
5745								var _tmb = $(this);
5746								if (_tmb.hasClass(filterValue)) {
5747									_tmb.show();
5748									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
5749									filterItems.push(_tmb);
5750								} else {
5751									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
5752									_tmb.hide();
5753								}
5754							});
5755						}
5756
5757						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
5758
5759						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
5760						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
5761						var lightboxElements = $('[data-lbox^=ilightbox]', container);
5762						if (lightboxElements.length) {
5763							container.data('lbox', $(lightboxElements[0]).data('lbox'));
5764							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
5765								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
5766								if (typeof getLightbox === 'object') {
5767									getLightbox.refresh();
5768								} else {
5769									UNCODE.lightbox();
5770								}
5771							}
5772						}
5773						container.trigger('more-items-loaded');
5774					}, delay);
5775				} else {
5776					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
5777						var parent = $(val).parent(),
5778							objTimeout = parent.data('objTimeout');
5779						if (objTimeout) {
5780							$(val).removeClass('zoom-reverse').removeClass('start_animation')
5781							clearRequestTimeout(objTimeout);
5782						}
5783						if (transitionDuration == 0) {
5784							if ($(val).hasClass('animate_when_almost_visible')) {
5785								$(val).addClass('zoom-reverse').removeClass('start_animation');
5786							} else {
5787								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
5788							}
5789						}
5790					});
5791					loadCssGrid($filter);
5792				}
5793			};
5794
5795			if (!$filter.hasClass('active')) {
5796				/** Scroll top with filtering */
5797				if (filterContainer.hasClass('filter-scroll')) {
5798                    var calc_scroll = container.closest('.row-parent').offset().top;
5799                    calc_scroll -= UNCODE.get_scroll_offset();
5800
5801					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5802						delta = bodyTop - calc_scroll,
5803						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
5804						filterTolerance = false,
5805						filter_timeout;
5806					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
5807
5808					if ( !UNCODE.isFullPage ) {
5809						if (scrollSpeed == 0) {
5810							$('html, body').scrollTop(calc_scroll);
5811							UNCODE.scrolling = false;
5812							filter_items();
5813						} else {
5814
5815							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
5816								filter_items();
5817								filterTolerance = true;
5818							}
5819
5820							$('html, body').animate({
5821								scrollTop: calc_scroll
5822							},{
5823								easing: 'easeInOutQuad',
5824								duration: scrollSpeed,
5825								complete: function(){
5826									UNCODE.scrolling = false;
5827									if ( !filterTolerance ) {
5828										filter_timeout = setTimeout(function(){
5829											clearTimeout(filter_timeout);
5830											filter_items();
5831										}, 200);
5832									}
5833								}
5834							});
5835						}
5836					}
5837				} else {
5838					filter_items();
5839				}
5840			}
5841			evt.preventDefault();
5842		});
5843
5844		$(window).on("popstate", function(e) {
5845			if (e.originalEvent.state === null) {
5846				return;
5847			}
5848			var params = {};
5849			if (location.search) {
5850				var parts = location.search.substring(1).split('&');
5851				for (var i = 0; i < parts.length; i++) {
5852					var nv = parts[i].split('=');
5853					if (!nv[0]) {
5854						continue;
5855					}
5856					params[nv[0]] = nv[1] || true;
5857				}
5858			}
5859			if (params.id === undefined) {
5860				$.each($('.cssgrid-system'), function(index, val) {
5861					loadCssGrid($(val));
5862				});
5863			} else {
5864				loadCssGrid($('#' + params.id));
5865			}
5866		});
5867
5868		var loadCssGrid = function($href) {
5869			var href = ($href.is("a") ? $href.attr('href') : location),
5870				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
5871				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
5872				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
5873				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
5874				cssgridId = cssgridSystem.attr('id');
5875			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
5876				history.pushState({
5877					myCSSgrid: true
5878				}, document.title, href);
5879			}
5880			cssgridWrapper.addClass('cssgrid-loading');
5881			$.ajax({
5882				url: href
5883			}).done(function(data) {
5884				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
5885					$resultPagination = $(data).find('#' + cssgridId + ' .pagination');
5886				requestTimeout(function() {
5887					cssgridContainer.html($resultItems);
5888					cssgridWrapper.removeClass('cssgrid-loading');
5889					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
5890					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, false, false);
5891					UNCODE.adaptive();
5892					if (SiteParameters.dynamic_srcset_active === '1') {
5893						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
5894					}
5895					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
5896						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
5897						if (typeof getLightbox === 'object') {
5898							getLightbox.refresh();
5899						} else {
5900							UNCODE.lightbox();
5901						}
5902					}
5903					cssgridContainer.trigger('more-items-loaded');
5904				}, 300);
5905
5906				$('.pagination', cssgridFooter).remove();
5907				cssgridFooter.append($resultPagination);
5908			});
5909		};
5910
5911		$filters.each(function(i, buttonGroup) {
5912			var $buttonGroup = $(buttonGroup);
5913			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
5914				$buttonGroup.find('.active').removeClass('active');
5915				$(this).addClass('active');
5916
5917			});
5918
5919			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
5920				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
5921				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
5922			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
5923				e.preventDefault();
5924				$cats_filters.slideToggle(400, 'easeInOutCirc');
5925			});
5926
5927		});
5928	};
5929};
5930
5931UNCODE.preventDoubleTransition = function() {
5932	$('.sticky-element .animate_when_almost_visible').each(function(){
5933		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
5934			$el.addClass('do_not_reanimate');
5935		});
5936	});
5937};
5938
5939UNCODE.checkScrollForTabs = function(){
5940	var goToSection = window.location.hash.replace('#', ''),
5941		$index;
5942
5943	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
5944	goToSection = encodeURIComponent(goToSection);
5945	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
5946
5947	$index.attr('data-parent', 'parent-' + goToSection);
5948
5949	if (window.location.hash != undefined && window.location.hash != '') {
5950		requestTimeout(function() {
5951			scrollBody('parent-' + goToSection);
5952		}, 500);
5953	}
5954
5955	$('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
5956		var hash = (e.currentTarget).hash,
5957			index = (e.currentTarget).closest('.uncode-tabs');
5958		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
5959			$('a[href="' + hash + '"][data-tab-history]').click();
5960			scrollBody(index);
5961		}
5962	});
5963
5964	var scrollBody = function(index) {
5965
5966		var getSection = $('a[href="' + index + '"][data-tab-history]'),
5967			scrollTo;
5968
5969		if ( ! getSection.length ) {
5970			getSection = $('div[data-parent="' + index + '"]');
5971
5972			if ( getSection.attr('data-target') == 'row' ) {
5973				getSection = getSection.closest('.vc_row');
5974			}
5975		}
5976
5977		if (typeof getSection === 'undefined' || ! getSection.length ) {
5978			return;
5979		}
5980
5981		var body = $("html, body"),
5982		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5983		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
5984		getOffset = UNCODE.get_scroll_offset();
5985		if ( typeof getSection.offset() === 'undefined' )
5986			return;
5987		scrollTo = getSection.offset().top - 27;
5988		scrollTo -= getOffset;
5989
5990		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
5991		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
5992
5993		if (index != 0) {
5994			UNCODE.scrolling = true;
5995		}
5996
5997		if (scrollSpeed == 0) {
5998			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
5999			UNCODE.scrolling = false;
6000		} else {
6001			body.animate({
6002				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
6003			}, scrollSpeed, 'easeInOutQuad', function() {
6004				requestTimeout(function() {
6005					UNCODE.scrolling = false;
6006					if (getOffset != UNCODE.get_scroll_offset()) {
6007						scrollBody(index);
6008					}
6009				}, 100);
6010			});
6011		}
6012
6013	};
6014};
6015
6016UNCODE.printScreen = function() {
6017	var inlineMediaStyle = null,
6018		setResize;
6019
6020    function changeMediaStyle() {
6021		clearRequestTimeout(setResize);
6022		setResize = requestTimeout(function(){
6023	        var $head = document.getElementsByTagName('head')[0],
6024	        	$newStyle = document.createElement('style'),
6025	        	winW = window.innerWidth,
6026	        	printH = window.innerHeight;
6027
6028	        $newStyle.setAttribute('type', 'text/css');
6029	        $newStyle.setAttribute('media', 'print');
6030	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
6031
6032	        if (inlineMediaStyle != null) {
6033	            $head.replaceChild($newStyle, inlineMediaStyle)
6034	        } else {
6035	            $head.appendChild($newStyle);
6036	        }
6037	        inlineMediaStyle = $newStyle;
6038	    }, 1000);
6039    }
6040
6041    changeMediaStyle();
6042    window.addEventListener('resize', changeMediaStyle);
6043};
6044
6045UNCODE.fullPage = function() {
6046	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
6047		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
6048		return false;
6049	} else {
6050		requestTimeout(function() {
6051			window.scrollTo(0, 0);
6052		}, 10);
6053	}
6054
6055	var $masthead = $('#masthead'),
6056		$logo = $('#logo-container-mobile'),
6057		$logolink = $('[data-minheight]', $logo),
6058		logoMinScale = $logolink.data('minheight'),
6059		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
6060		$mainWrapper = $('.main-wrapper')[0],
6061		$container = $('.main-container .post-content'),
6062		$mobileMenuWrapper = $('.menu-wrapper'),
6063		mobMenuPos,
6064		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
6065		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
6066		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
6067		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
6068		headerWithOpacity = $('.header-scroll-opacity', $header).length,
6069		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
6070		menuHeight = $masthead.hasClass('menu-transparent') || menuHidden ? 0 : UNCODE.menuHeight,
6071		footerAdd = ( $('body').hasClass('hmenu') && $('body').hasClass('uncode-fp-menu-shrink') && !$masthead.hasClass('menu-transparent') ) ? -18 : 0,
6072		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
6073		$scrollTop = $('.scroll-top'),
6074		scrollBar = true,
6075		effect,
6076		animationEndTimeOut,
6077		fp_anim_time = 900,
6078		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
6079		is_scrolling = false,
6080		dataNames = [],
6081		is_first = true,
6082		no_history = $('body').hasClass('uncode-scroll-no-history'),
6083		theres_footer = true;
6084
6085	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
6086		$('> div', $footer).each(function(index, el){
6087			if ( $(el).outerHeight() < 2 )
6088				theres_footer = false;
6089			else
6090				theres_footer = true;
6091		});
6092	}
6093
6094	if ( !$footer.length )
6095		theres_footer = false;
6096
6097	if ( !UNCODE.isFullPageSnap ) {
6098		/*if ( theres_footer )
6099			$footer.css({ marginTop: ( menuHeight + footerAdd + UNCODE.bodyBorder ) * -1 })*/
6100
6101		if ( $('body').hasClass('uncode-fullpage-zoom') )
6102			effect = 'scaleDown';
6103		else if ( $('body').hasClass('uncode-fullpage-parallax') )
6104			effect = 'moveparallax';
6105		else
6106			effect = 'movecurtain';
6107	}
6108
6109	if ( $('body').hasClass('uncode-fullpage-trid') )
6110		fp_anim_time = fp_anim_time*2;
6111
6112	if ( $header.length ) {
6113		if ( headerName !== '' )
6114			$header.attr('data-name', headerName);
6115		if ( headerLabel !== '' )
6116			$header.attr('data-label', headerLabel);
6117		$container.prepend($header);
6118	}
6119	if ( theres_footer ) {
6120		$container.append($footer);
6121		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
6122		$('aside.widget ul', $footer).addClass('no-list');
6123	}
6124
6125	var $all = $rows.add($header);
6126
6127	if ( theres_footer )
6128		$all = $all.add($footer);
6129
6130	$all.each(function(index, row) {
6131		if( index === 0 )
6132			$(row).addClass('uncode-scroll-active');
6133	});
6134
6135	if ( !UNCODE.isMobile && !$('body').hasClass('uncode-scroll-no-dots') )
6136		$("<ul class='onepage-pagination'></ul>").prependTo("body");
6137
6138	$all.each(function(index, val) {
6139		var getName = $(val).data('name'),
6140			label;
6141
6142		if (typeof getName == 'undefined' || getName == 'undefined')
6143			getName = SiteParameters.slide_name + '-' + index;
6144
6145		//if ( dataNames.includes(getName) ) {
6146		if ( dataNames.indexOf(getName) > 0 ) {
6147			getName += '_' + index;
6148			$(val).data('name', getName);
6149		}
6150
6151		dataNames.push(getName);
6152
6153		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
6154
6155		if (typeof $(val).attr('data-label') !== 'undefined')
6156			label = $(val).attr('data-label');
6157		else label = '';
6158
6159		if ( $(val).is($footer) )
6160			return;
6161
6162		if (label != '' ) {
6163			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
6164			$('ul.onepage-pagination').append("<li><a class='one-dot-link' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>");
6165		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
6166			$('ul.onepage-pagination').append("<li><a class='one-dot-link' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span></a></li>");
6167		}
6168
6169	});
6170
6171	var checkVisible = function( el, off ) {
6172		if (typeof jQuery === "function" && el instanceof jQuery) {
6173			el = el[0];
6174		}
6175
6176		off = typeof off=='undefined' ? 50 : off;
6177
6178		var rect = el.getBoundingClientRect();
6179
6180		return (
6181			(
6182				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
6183				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
6184				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
6185			)
6186		);
6187	};
6188
6189	var animationEndAction = function( index, nextIndex ) {
6190		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
6191			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
6192			player, iframe;
6193
6194		if ( !$nextSlide.is($footer) ) {
6195			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
6196		}
6197
6198		if ( !UNCODE.isFullPageSnap ) {
6199			activateKBurns( nextIndex );
6200		}
6201
6202		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
6203			if ($(this).attr('data-provider') == 'vimeo') {
6204				iframe = $(this).find('iframe');
6205				player = $f(iframe[0]);
6206				player.api('pause');
6207			} else if ($(this).attr('data-provider') == 'youtube') {
6208				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
6209			} else {
6210				if ($(this).is('video')) {
6211					$(this)[0].volume = 0;
6212					$(this)[0].pause();
6213				}
6214			}
6215		});
6216
6217		if ( ! UNCODE.isMobile && headerWithOpacity ) {
6218			if ( $nextSlide.is($header) )
6219				$header.removeClass('header-scrolled');
6220		}
6221
6222		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
6223		$otherEl.each(function(){
6224			var $otherThis = $(this),
6225				$bgwrapperOther = $('.background-inner', $otherThis);
6226			if ( !checkVisible($otherThis) )
6227				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
6228
6229		});
6230
6231		if ( !checkVisible($currentSlide) ) {
6232			$currentSlide.removeClass('uncode-scroll-visible');
6233			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
6234			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
6235				currentScroll.scrollTo(0, 0, 0);
6236		}
6237
6238		clearRequestTimeout(animationEndTimeOut);
6239		animationEndTimeOut = requestTimeout(function(){
6240			Waypoint.refreshAll();
6241			$( document.body ).trigger('uncode_waypoints');
6242			var eventFP = new CustomEvent('fp-slide-changed');
6243			window.dispatchEvent(eventFP);
6244			is_scrolling = false;
6245
6246			if ( is_first ) {
6247				$('ul.onepage-pagination a').removeClass('is-selected');
6248				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
6249				is_first = false;
6250			}
6251
6252		}, 500);
6253	};
6254
6255	var postLeaveActions = function( nextIndex ){
6256		if ( menuHidden && ! UNCODE.isMobile )
6257			return false;
6258
6259		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
6260			$cols = $('.uncol', $el),
6261			anchor = $el.data('anchor');
6262
6263		if ( ! UNCODE.isFullPageSnap ) {
6264			$.each($cols, function(index, val){
6265				if ( $(val).hasClass('style-light') ){
6266					$masthead.removeClass('style-dark-override').addClass('style-light-override');
6267					return false;
6268				} else if ( $(val).hasClass('style-dark') ) {
6269					$masthead.removeClass('style-light-override').addClass('style-dark-override');
6270					return false;
6271				}
6272			});
6273		}
6274
6275		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
6276			$('.menu-item' ).removeClass('active');
6277			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
6278		}
6279
6280		if ( !UNCODE.isFullPageSnap ) {
6281			activateBackWash( nextIndex );
6282		}
6283	};
6284
6285	var activateBackWash = function( nextIndex ){
6286		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
6287			$bgwrapper;
6288
6289		if ( $el.length ) {
6290			if ( $el.hasClass('with-zoomout') ) {
6291				$bgwrapper = $('.background-inner:nth-child(1)', $el);
6292			} else if ( $('.with-zoomout', $el).length ) {
6293				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
6294			} else {
6295				return false;
6296			}
6297		} else {
6298			return false;
6299		}
6300
6301		$bgwrapper.addClass('uncode-zoomout');
6302
6303	};
6304
6305	var activateKBurns = function( nextIndex ){
6306		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
6307			$bgwrapper;
6308
6309		if ( $el.length ) {
6310			if ( $el.hasClass('with-kburns') ) {
6311				$bgwrapper = $('.background-inner:nth-child(1)', $el);
6312			} else if ( $('.with-kburns', $el).length ) {
6313				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
6314			} else {
6315				return false;
6316			}
6317		} else {
6318			return false;
6319		}
6320
6321		$bgwrapper.addClass('uncode-kburns');
6322
6323	};
6324
6325	var activateParallax = function( nextIndex, direction ){
6326
6327		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
6328			$cell = $('.fp-tableCell', $el),
6329			animationEnd = 'webkitAnimationEnd animationend',
6330			cellAnim;
6331
6332		switch( direction ) {
6333			case 'up':
6334				cellAnim = 'moveFromTopInner';
6335				break;
6336			default:
6337				cellAnim = 'moveFromBottomInner';
6338		}
6339
6340		$cell.css({
6341			'animation-name': cellAnim,
6342			'animation-duration': fp_anim_time + 'ms',
6343			'animation-delay': '',
6344			'animation-timing-function': fp_easing,
6345			'animation-fill-mode': 'both',
6346		}).off(animationEnd)
6347		.on(animationEnd, function(event) {
6348			if ( event.originalEvent.animationName === cellAnim ) {
6349				$cell
6350					.css({
6351						'animation-name': '',
6352						'animation-duration': '',
6353						'animation-delay': '',
6354						'animation-timing-function': '',
6355						'animation-fill-mode': '',
6356					});
6357			}
6358		});
6359	};
6360
6361	var scrollHashes = function(){
6362		var hash = window.location.hash.replace('#', '').split('/'),
6363			hashInd;
6364		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
6365			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
6366				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
6367				$.fn.fullpage.moveTo(hashInd+1);
6368			}
6369		} else if( hash[0] === '' ) {
6370			$.fn.fullpage.moveTo(1);
6371		}
6372	};
6373
6374	var hideMenu = function( index, nextIndex ){
6375		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
6376			return false;
6377
6378		var hMenu = UNCODE.menuHeight,
6379			transTime = hMenu * 2;
6380
6381		if ( index === 1 && nextIndex > 1 ) {
6382			hMenu = hMenu * -1;
6383		} else if  ( index !== 1 && nextIndex === 1 ) {
6384			hMenu = 0;
6385		} else {
6386			return false;
6387		}
6388
6389		$masthead.css({
6390			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
6391			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
6392			'-webkit-transition': 'transform 0.5s ease-in-out',
6393			'transition': 'transform 0.5s ease-in-out'
6394		});
6395	};
6396
6397	var shrinkMenu = function( index, nextIndex ){
6398		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
6399			return false;
6400
6401		if ( index === 1 && nextIndex > 1 ) {
6402			$logo.addClass('shrinked');
6403			$('div', $logo).each(function(index, val){
6404				$(val).css({
6405					'height': logoMinScale,
6406					'line-height': logoMinScale
6407				});
6408				if ($(val).hasClass('text-logo')) {
6409					$(val).css({
6410						'font-size': logoMinScale + 'px'
6411					});
6412				}
6413			});
6414			requestTimeout(function() {
6415				UNCODE.menuMobileHeight = $masthead.outerHeight();
6416			}, 300);
6417		} else if ( index !== 1 && nextIndex === 1 ) {
6418			$logo.removeClass('shrinked');
6419			$('div', $logo).each(function(index, val){
6420				$(val).css({
6421					'height': logoMaxScale,
6422					'line-height': logoMaxScale
6423				});
6424				if ($(val).hasClass('text-logo')) {
6425					$(val).css({
6426						'font-size': logoMaxScale + 'px'
6427					});
6428				}
6429			});
6430			requestTimeout(function() {
6431				UNCODE.menuMobileHeight = $masthead.outerHeight();
6432			}, 300);
6433		} else {
6434			return false;
6435		}
6436
6437	};
6438
6439	var anchorLink = function(){
6440
6441		$container.add('.menu-item').find('a[href*="#"]').click(function(e) {
6442			var $this = $(e.currentTarget),
6443				hash = e.currentTarget.href.split('#'),
6444				current = window.location.href.split('#'),
6445				ind,
6446				currentMenuOpened = UNCODE.menuOpened,
6447				go = false;
6448
6449			var hash_url = hash[0].replace(/\/?$/, '/'),
6450				current_url = current[0].replace(/\/?$/, '/');
6451
6452			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
6453				hash = '#'+hash[1];
6454				e.preventDefault();
6455				go = true;
6456			}
6457
6458			if ( go ) {
6459
6460				if ( $(hash).length ) {
6461					ind = $(hash).closest('.fp-section').index();
6462				} else {
6463					hash = hash.slice(1);
6464					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
6465				}
6466
6467				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
6468					ind = $this.closest('.fp-section').index();
6469
6470				UNCODE.menuOpened = false;
6471
6472				$.fn.fullpage.moveTo(ind+1);
6473
6474				UNCODE.menuOpened = currentMenuOpened;
6475				if (UNCODE.menuOpened) {
6476					if (UNCODE.wwidth < UNCODE.mediaQuery) {
6477						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
6478					} else {
6479						$('.mmb-container-overlay .overlay-close').trigger('click');
6480						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
6481					}
6482				}
6483
6484			}
6485
6486		});
6487
6488		$('.header-scrolldown').on('click', function(event) {
6489			event.preventDefault();
6490			var scrollDown = $(this),
6491				ind = scrollDown.closest('.fp-section').index();
6492
6493			$.fn.fullpage.moveTo(ind+2);
6494		});
6495
6496		var anchor = $('.fp-section.active').data('anchor');
6497
6498		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
6499			$('.menu-item').removeClass('active');
6500			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
6501		}
6502
6503	};
6504
6505	var slideLeave = function( index, nextIndex, direction ) {
6506		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
6507			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
6508			animationEnd = 'webkitAnimationEnd animationend',
6509			transitionEnd = 'webkitTransitionEnd transitionend',
6510			animOut = effect != 'scaleDown' ? effect + direction : effect,
6511			animIn,
6512			animInDelay = effect == 'scaleDown' ? 0 : 0,
6513			isFooter = false,
6514			isFooterNext = false,
6515			isHeader = false,
6516			isHeaderNext = false,
6517			containerOff = $container.offset().top,
6518			footerH = $footer.outerHeight(),
6519			timeout,
6520			dataHash = $nextSlide.attr('data-anchor'),
6521			player, iframe,
6522			footerCoeff;
6523		switch( direction ) {
6524			case 'up':
6525				animIn = 'moveFromTop';
6526				break;
6527			default:
6528				animIn = 'moveFromBottom';
6529		}
6530
6531		if ( $('body').hasClass('uncode-fullpage-trid') ) {
6532			animOut = animIn + 'trid';
6533			animIn = animOut + 'In';
6534		} else if ( UNCODE.isFullPageSnap ) {
6535			animIn = animOut = 'none';
6536		}
6537
6538		hideMenu(index, nextIndex);
6539		shrinkMenu(index, nextIndex);
6540
6541		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
6542			if ($(this).attr('data-provider') == 'vimeo') {
6543				iframe = $(this).find('iframe');
6544				player = $f(iframe[0]);
6545				player.api('pause');
6546			} else if ($(this).attr('data-provider') == 'youtube') {
6547				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
6548			} else {
6549				if ($(this).is('video')) {
6550					$(this)[0].volume = 0;
6551					$(this)[0].pause();
6552				}
6553			}
6554		});
6555
6556		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
6557			if ($(this).attr('data-provider') == 'vimeo') {
6558				iframe = $(this).find('iframe');
6559				player = $f(iframe[0]);
6560				player.api('play');
6561			} else if ($(this).attr('data-provider') == 'youtube') {
6562				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
6563			} else {
6564				if ($(this).is('video')) {
6565					$(this)[0].volume = 0;
6566					$(this)[0].play();
6567				}
6568			}
6569		});
6570
6571		if ( $currentSlide.is($footer) )
6572			isFooter = true;
6573
6574		if ( $nextSlide.is($footer) )
6575			isFooterNext = true;
6576
6577		// if ( typeof dataHash && dataHash && !no_history && dataHash != SiteParameters.slide_footer )
6578		// 	window.location.hash = '#' + dataHash;
6579
6580		if ( ! UNCODE.isMobile && headerWithOpacity ) {
6581			if ( $currentSlide.is($header) )
6582				$header.addClass('header-scrolled');
6583		}
6584
6585		footerCoeff = footerH;
6586
6587		if ( UNCODE.isFullPageSnap ) {
6588			postLeaveActions( nextIndex );
6589			activateBackWash( nextIndex );
6590			activateKBurns( nextIndex );
6591			requestTimeout(function(){
6592				animationEndAction( index, nextIndex );
6593			}, fp_anim_time+150);
6594		} else {
6595			if ( isFooterNext ) {
6596
6597				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
6598				$iscrollWrapper.addClass('no-scrolloverflow');
6599
6600				$nextSlide
6601				.add($currentSlide)
6602				.addClass('uncode-scroll-front')
6603				.addClass('uncode-scroll-active')
6604				.addClass('uncode-scroll-visible');
6605				$container.css({
6606					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
6607					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
6608					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
6609					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
6610				}).off(transitionEnd)
6611				.one(transitionEnd, function(){
6612					animationEndAction( index, nextIndex );
6613				});
6614
6615			} else if ( isFooter ) {
6616
6617				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
6618				.add($currentSlide)
6619				.addClass('uncode-scroll-front')
6620				.addClass('uncode-scroll-active')
6621				.addClass('uncode-scroll-visible');
6622				$container.css({
6623					'-webkit-transform': 'translate3d(0, 0, 0)',
6624					'transform': 'translate3d(0, 0, 0)',
6625					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
6626					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
6627				})
6628				.one(transitionEnd, function(){
6629					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
6630						clearRequestTimeout(timeout);
6631						timeout = requestTimeout(function(){
6632							$.fn.fullpage.moveTo(nextIndex);
6633							slideLeave( index-1, nextIndex, 'up' );
6634							$container.off(transitionEnd);
6635						}, 50);
6636					}
6637					animationEndAction( index, nextIndex );
6638				});
6639
6640			} else {
6641
6642				postLeaveActions( nextIndex );
6643
6644				if ( !$('body').hasClass('uncode-fullpage-trid') )
6645					activateParallax( nextIndex, direction );
6646
6647				var $outBg = $('.background-wrapper', $currentSlide);
6648
6649				$nextSlide
6650				.addClass('uncode-scroll-front')
6651				.addClass('uncode-scroll-active')
6652				.addClass('uncode-scroll-visible')
6653				.addClass('uncode-scroll-animating-in')
6654				.css({
6655					'z-index':4,
6656					'animation-name': animIn,
6657					'animation-duration': fp_anim_time + 'ms',
6658					'animation-delay': '',
6659					'animation-timing-function': fp_easing,
6660					'animation-fill-mode': 'both',
6661					'transition': 'initial',
6662				}).off(animationEnd)
6663				.on(animationEnd, function(event) {
6664					if ( event.originalEvent.animationName === animIn ) {
6665						$(this)
6666							.addClass('uncode-scroll-already')
6667							.removeClass('uncode-scroll-front')
6668							.removeClass('uncode-scroll-animating-in')
6669							.css({
6670								'animation-name': '',
6671								'animation-duration': '',
6672								'animation-delay': '',
6673								'animation-timing-function': '',
6674								'animation-fill-mode': '',
6675								'transition': 'initial',
6676							});
6677
6678						$currentSlide
6679							.removeClass('uncode-scroll-active')
6680							.add($outBg)
6681							.css({
6682								'animation-name': '',
6683								'animation-duration': '',
6684								'animation-delay': '',
6685								'animation-timing-function': '',
6686								'animation-fill-mode': '',
6687								'transition': 'initial',
6688							});
6689
6690						animationEndAction( index, nextIndex );
6691
6692					}
6693
6694					if ( nextIndex > 1 )
6695						$('body').addClass('window-scrolled');
6696					else
6697						$('body').removeClass('window-scrolled');
6698				});
6699
6700				$currentSlide
6701					.addClass('uncode-scroll-animating-out')
6702					.removeClass('uncode-scroll-front')
6703					.css({
6704						'z-index':'1',
6705						'animation-name': animOut,
6706						'animation-duration': fp_anim_time + 'ms',
6707						'animation-delay': '',
6708						'animation-timing-function': fp_easing,
6709						'animation-fill-mode': 'both',
6710						'transition': 'initial',
6711						'will-change': 'auto'
6712					}).off(animationEnd)
6713					.on(animationEnd, function(event) {
6714						if ( event.originalEvent.animationName === animOut ) {
6715							$currentSlide.removeClass('uncode-scroll-animating-out');
6716						}
6717					});
6718
6719				if ( $('body').hasClass('uncode-fp-opacity') ) {
6720					$currentSlide.find('> div').css({
6721						'animation-name': 'opacityout',
6722						'animation-duration': fp_anim_time + 'ms',
6723						'animation-delay': '',
6724						'animation-timing-function': fp_easing,
6725						'animation-fill-mode': 'both',
6726						'transition': 'initial',
6727					}).off(animationEnd)
6728					.on(animationEnd, function(event) {
6729						if ( event.originalEvent.animationName === 'opacityout' ) {
6730							$(event.currentTarget).css({
6731								'animation-name': '',
6732								'animation-duration': '',
6733								'animation-delay': '',
6734								'animation-timing-function': '',
6735								'animation-fill-mode': '',
6736								'transition': '',
6737							});
6738						}
6739					});
6740				}
6741			}
6742		}
6743
6744		$('.scroll-top').on('click', function(e){
6745			$.fn.fullpage.moveTo(1);
6746			return false;
6747		});
6748
6749	};
6750
6751	var init_fullPage = function(mode){
6752
6753		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
6754		// 	scrollBar = false;
6755		// }
6756
6757		var checkFPeffects;
6758
6759		$container.fullpage({
6760			sectionSelector: '.uncode-scroll-lock',
6761			scrollOverflow: true,
6762			scrollOverflowOptions: {
6763				click: false,
6764				preventDefaultException: { tagName:/.*/ }
6765			},
6766			navigation: false,
6767			scrollBar: scrollBar,
6768			scrollingSpeed: fp_anim_time,
6769			verticalCentered: true,
6770			anchors: no_history ? false : dataNames,
6771			recordHistory: !no_history,
6772			afterRender: function(){
6773				$('body').removeClass('fp-waiting');
6774				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
6775					var $invisible = $(this).addClass('hidden-scroll');//,
6776				});
6777				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
6778					var $visible = $(this).addClass('uncode-scroll-visible'),
6779						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
6780					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
6781				});
6782
6783				$('ul.onepage-pagination a').on('click', function(e){
6784					e.preventDefault();
6785					var $a = $(this),
6786						toIndex = $a.data('index');
6787
6788					$.fn.fullpage.moveTo(toIndex+1);
6789				});
6790
6791				requestTimeout(function(){
6792					scrollHashes();
6793				}, 1000);
6794
6795				$(window).on('hashchange', function(e){
6796					requestTimeout(function(){
6797						scrollHashes();
6798					}, 500);
6799				});
6800
6801				anchorLink();
6802
6803				if ( $('body').hasClass('uncode-fp-opacity') ) {
6804					$all.each(function(index, row) {
6805						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
6806							classBg;
6807
6808						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
6809							classBg = testmatch[0];
6810							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
6811						}
6812					});
6813				}
6814
6815				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
6816					$(window).on('menuOpen gdprOpen', function(){
6817						$.fn.fullpage.setAutoScrolling(false);
6818					}).on('menuClose gdprClose', function(){
6819						$.fn.fullpage.setAutoScrolling(true);
6820					});
6821				}
6822
6823				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
6824					requestTimeout(function(){
6825						$.fn.fullpage.setAutoScrolling(false);
6826					}, 1000);
6827				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
6828					$.fn.fullpage.setAutoScrolling(true);
6829				});
6830
6831				if ( !UNCODE.isFullPageSnap ) {
6832					clearRequestTimeout(checkFPeffects);
6833					checkFPeffects = requestTimeout(function(){
6834						activateBackWash( 1 );
6835						activateKBurns( 1 );
6836					}, 100);
6837				}
6838
6839			},
6840			onLeave: function( index, nextIndex, direction ){
6841
6842				if ( UNCODE.menuOpened || is_scrolling )
6843					return false;
6844
6845				is_scrolling = true;
6846
6847				var event = new CustomEvent('fp-slide-leave');
6848				window.dispatchEvent(event);
6849
6850				slideLeave( index, nextIndex, direction );
6851
6852				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
6853					if ( direction === 'up' ) {
6854						$.fn.fullpage.moveTo(nextIndex-1);
6855					} else {
6856						$.fn.fullpage.moveTo(nextIndex+1);
6857					}
6858					return false;
6859				}
6860
6861				$('ul.onepage-pagination a').removeClass('is-selected');
6862				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
6863
6864			}
6865		});
6866	};
6867
6868	init_fullPage();
6869	$(window).on('load', function(){
6870		requestTimeout(function(){
6871			$.fn.fullpage.reBuild();
6872		}, 3000);
6873	});
6874
6875	var addScrollingClass,
6876		removeScrollingClass;
6877
6878	window.addEventListener("fp-slide-scroll", function(){
6879		addScrollingClass = requestTimeout( function(){
6880			$('body').addClass('fp-slide-scrolling');
6881		}, 10 );
6882
6883		clearRequestTimeout(removeScrollingClass);
6884		removeScrollingClass = requestTimeout( function(){
6885			$('body').removeClass('fp-slide-scrolling');
6886		}, 150 );
6887
6888		Waypoint.refreshAll();
6889	}, false);
6890
6891	var setFPheight = function(){
6892		var $body = document.body,
6893			$footer = document.getElementById('colophon'),
6894			$maincontainer = document.querySelector('.main-wrapper'),
6895			$boxcontainer = document.querySelector('.box-container'),
6896			rect = $maincontainer.getBoundingClientRect(),
6897			rect2 = $boxcontainer.getBoundingClientRect();
6898		$body.style.height = UNCODE.wheight + 'px';
6899		if ( theres_footer )
6900			$footer.style.top = (rect.height || rect2.height) + 'px';
6901	};
6902
6903	setFPheight();
6904
6905	window.addEventListener('resize', setFPheight, false);
6906	window.addEventListener('orientationchange', setFPheight, false);
6907
6908};
6909
6910UNCODE.particles = function() {
6911	$(".vc-particles-background").each(function() {
6912		var $particle = $(this);
6913		var $parent = $particle.closest('[data-parent]');
6914
6915		$parent.prepend($particle);
6916		// $(window).trigger('resize');
6917	})
6918};
6919
6920
6921UNCODE.filters = function() {
6922	var $isotopes = $('.isotope-system');
6923
6924	$isotopes.each(function(index, val){
6925		var $isotope = $(this),
6926			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $isotope),
6927			$widgets = $('.widgetized-cb-wrapper', $isotope),
6928			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $isotope),
6929			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $isotope),
6930			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $isotope),
6931			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $isotope);
6932
6933		if ($isotope.hasClass('isotope-processed')) {
6934			return;
6935		}
6936
6937		$cats_trigger.on('click', function(e) {
6938			if ( ! $('html').hasClass('screen-sm') ) {
6939				// $widgets.add($sorting_dd).slideUp(400);
6940				e.preventDefault();
6941				$widgets.slideUp(400, 'easeInOutCirc');
6942			}
6943		});
6944
6945		$('.filters-toggle-trigger', $isotope).on('click', function(e) {
6946			e.preventDefault();
6947			var $filters = $('.isotope-filters .menu-horizontal', $isotope);
6948			$filters.slideToggle(400, 'easeInOutCirc');
6949			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
6950		});
6951
6952		$widget_trgr.on('click', function(e) {
6953			e.preventDefault();
6954			$widgets.slideToggle(400, 'easeInOutCirc');
6955			if (!$('html').hasClass('screen-sm')) {
6956				$cats_filters.slideUp(400, 'easeInOutCirc');
6957			}
6958			window.dispatchEvent(new CustomEvent('boxResized'));
6959		});
6960
6961		$sorting_trgr.on('click', function(e) {
6962			e.preventDefault();
6963			if (!$('html').hasClass('screen-sm')) {
6964				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
6965			}
6966		});
6967
6968		$isotope.addClass('isotope-processed');
6969	})
6970
6971};
6972
6973UNCODE.widgets = function() {
6974	var widget_titles = $('.widget-mobile-collapse').find('.widget-title');
6975	var widgets = widget_titles.closest('.widget');
6976
6977	widgets.each(function() {
6978		var _this = $(this);
6979		var content = _this.children().not('.widget-title');
6980
6981		if (_this.hasClass('widget-mobile-done')) {
6982			return;
6983		}
6984
6985		content.wrapAll( '<div class="widget-collapse-content"></div> ');
6986		_this.removeClass('collapse-init');
6987		_this.addClass('widget-mobile-done');
6988	});
6989
6990	var widgets_without_title = $('.collapse-init');
6991
6992	widgets_without_title.removeClass('collapse-init');
6993
6994	widget_titles.on('click', function() {
6995		var _this = $(this);
6996		var content = _this.closest('.widget').find('.widget-collapse-content');
6997
6998		// Get content of :after element (+ icon) to check the visibility
6999		var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
7000
7001		if (icon_content === 'none' || !icon_content) {
7002			return false;
7003		}
7004
7005		_this.toggleClass('open');
7006		content.slideToggle(400, 'easeInOutCirc');
7007
7008		return false;
7009	});
7010};
7011
7012UNCODE.unmodal = function() {
7013	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
7014		$('.unmodal-overlay').fadeIn();
7015		$('.unmodal-overlay').addClass('loading');
7016		$('body').addClass('uncode-unmodal-overlay-visible');
7017		$(window).trigger('unmodal-open');
7018	});
7019
7020	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
7021		$('.unmodal-overlay').fadeOut();
7022		$('.unmodal').fadeOut();
7023		$('body').removeClass('uncode-unmodal-overlay-visible');
7024		$('body').removeClass('uncode-unmodal-open');
7025		$('html').removeClass('uncode-unmodal-body-disable-scroll');
7026		$(document).trigger('unmodal-close');
7027		UNCODE.isUnmodalOpen = false;
7028	});
7029
7030	$(document).on('uncode-unmodal-show-content', function() {
7031		$('.unmodal-overlay').removeClass('loading');
7032		$('.unmodal').show();
7033		$('.unmodal').addClass('show-unmodal-with-animation');
7034		$('.unmodal-content')[0].scrollTop = 0;
7035		$('body').addClass('uncode-unmodal-open');
7036		UNCODE.isUnmodalOpen = true;
7037
7038		if ($('body').hasClass('qw-body-scroll-disabled')) {
7039			$('html').addClass('uncode-unmodal-body-disable-scroll');
7040		}
7041
7042		if ($('.unmodal').hasClass('auto-height')) {
7043			set_modal_height();
7044		}
7045	});
7046
7047	var set_modal_height = function() {
7048		var modal = $('.unmodal');
7049		var window_height = $(window).outerHeight();
7050		var modal_height = modal.outerHeight();
7051
7052		modal.css('height', 'auto');
7053
7054		if (modal_height > window_height) {
7055			modal.outerHeight(window_height);
7056		}
7057	}
7058
7059	if ($('.unmodal').hasClass('auto-height')) {
7060		var setCTA;
7061
7062		$(window).on('resize', function() {
7063			clearRequestTimeout(setCTA);
7064			setCTA = requestTimeout(function() {
7065				set_modal_height();
7066			}, 100);
7067		});
7068	}
7069};
7070
7071UNCODE.bgChanger = function() {
7072	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
7073		$bg_first = $('.vc_row[data-bg-remove]'),
7074		bg_remove = $bg_first.attr('data-bg-remove'),
7075		$first = $bg_changers.first(),
7076		$last = $bg_changers.last(),
7077		$bg_wrapper = $('#changer-back-color'),
7078		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
7079		setCTA, localH = UNCODE.wheight,
7080		isScrolling;
7081
7082	$bg_first.removeClass(bg_remove);
7083
7084	var bgChange = function($col, bgColor, skin, tmbskin){
7085		$bg_wrapper.attr( 'class', bgColor );
7086		var menuskin;
7087		if ( typeof skin !== 'undefined' ) {
7088			menuskin = skin.replace('style', 'menu')
7089		}
7090
7091		if ( $col.length ) {
7092			$('.uncol[data-skin-change]').each(function(){
7093				var $isoFooter = $('.isotope-footer', this);
7094				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
7095				if ( menuskin !== '' ) {
7096					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
7097				}
7098			});
7099
7100			$('.tmb[data-skin-change]').each(function(){
7101				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
7102			});
7103		}
7104	};
7105
7106	var $masthead = $('#masthead'),
7107		transDesktop,
7108		transMobile,
7109		changeSkin,
7110
7111	checkTransparencyAndChange = function( skin ){
7112		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
7113		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
7114		changeSkin = $masthead.hasClass('menu-change-skin');
7115
7116		if ( ! transDesktop && ! transMobile ) {
7117			return false;
7118		}
7119
7120		if ( ! changeSkin ) {
7121			return false;
7122		}
7123
7124		if ( skin === 'style-light' ){
7125			$masthead.removeClass('style-dark-override').addClass('style-light-override');
7126			return false;
7127		} else if ( skin === 'style-dark' ) {
7128			$masthead.removeClass('style-light-override').addClass('style-dark-override');
7129			return false;
7130		}
7131	};
7132
7133	var bg_waypoints = function(){
7134		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
7135
7136			$.each($bg_changers, function(index, row) {
7137
7138				var $row = $(row),
7139					$col = $('.uncol[data-skin-change]', $row).eq(0),
7140					skin,
7141					$tmbs,
7142					tmbskin,
7143					bgColor = $row.attr('data-bg-color');
7144
7145				if ( ! $row.is(':visible') ) {
7146					return false;
7147				}
7148
7149				if ( $col.length ) {
7150					skin = $col.attr('data-skin-change');
7151					$tmbs = $('.tmb[data-skin-change]', $row);
7152					tmbskin = skin.replace('style', 'tmb');
7153				}
7154
7155				if ( ! $row.hasClass('unscroll-horizontal') ) {
7156					$row.waypoint(function( dir ) {
7157						if ( dir === 'down' ) {
7158							bgChange($col, bgColor, skin, tmbskin);
7159							checkTransparencyAndChange(skin);
7160						} else {
7161							return;
7162						}
7163					}, {
7164						offset: '50%'
7165		  			});
7166
7167					$row.waypoint(function( dir ) {
7168						if ( dir === 'up' ) {
7169							bgChange($col, bgColor, skin, tmbskin);
7170							checkTransparencyAndChange(skin);
7171						} else {
7172							return;
7173						}
7174					}, {
7175						offset: function() {
7176							var clH = this.element.clientHeight,
7177								wH = window.innerHeight,
7178								ret = clH > 200 ? -100 : clH * -0.5;
7179							return ( wH / 2 ) - clH;
7180						}
7181					});
7182				}
7183
7184			});
7185
7186			$('body').addClass('bg-changer-init');
7187
7188		}
7189	};
7190
7191	var body = document.body,
7192	edges = false;
7193
7194	var throttle = function(fn, wait) {
7195		var time = Date.now();
7196		return function() {
7197			if ((time + wait - Date.now()) < 0) {
7198				fn();
7199				time = Date.now();
7200			}
7201		}
7202	}
7203
7204	var $wrapper = document.querySelector(".main-wrapper"),
7205		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
7206
7207	var $title = document.querySelector('#rotating');
7208	if ( $title !== null ) {
7209		$title.style.whiteSpace = 'nowrap';
7210		$title.style.transition = 'transform 200ms linear';
7211	}
7212
7213	window.addEventListener( 'scroll', throttle( function() {
7214		window.clearRequestTimeout( isScrolling );
7215
7216		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
7217
7218			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
7219				body = document.body,
7220				html = document.documentElement,
7221				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
7222				$row = false,
7223				firstOff,
7224				lastOff;
7225
7226			if ( scrolled < 100 && $first.length ) {
7227				firstOff = $first.offset().top;
7228				if ( firstOff < 100 ) {
7229					var $row = $first;
7230				}
7231			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
7232				lastOff = $last.offset().top + $last.outerHeight();
7233				if ( lastOff > ( docH - 100 ) ) {
7234					var $row = $last;
7235				}
7236			}
7237
7238			if ( $row.length ) {
7239				var $col = $('.uncol[data-skin-change]', $row).eq(0),
7240					skin,
7241					$tmbs,
7242					tmbskin,
7243					bgColor = $row.attr('data-bg-color');
7244
7245				if ( $col.length ) {
7246					skin = $col.attr('data-skin-change');
7247					$tmbs = $('.tmb[data-skin-change]', $row);
7248					tmbskin = skin.replace('style', 'tmb');
7249				}
7250
7251				bgChange($col, bgColor, skin, tmbskin);
7252				checkTransparencyAndChange(skin);
7253				edges = true;
7254			}
7255
7256		}, 150);
7257
7258		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
7259			bg_waypoints();
7260			Waypoint.refreshAll();
7261			edges = false;
7262		}
7263
7264	}, 100), false);
7265
7266	$(window).on('resize', function() {
7267		clearRequestTimeout(setCTA);
7268		setCTA = requestTimeout(function() {
7269			if ( localH != UNCODE.wheight ) {
7270				localH = UNCODE.wheight;
7271				bg_waypoints();
7272				Waypoint.refreshAll();
7273			}
7274		}, 100);
7275	});
7276
7277	bg_waypoints();
7278
7279};
7280
7281UNCODE.skewIt = function() {
7282
7283	if ( $('body').hasClass('compose-mode') ) {
7284		return;
7285	}
7286
7287	var justscrolled = false;
7288
7289	var loadSkewIt = function(){
7290
7291		var $pageHeader = $('#page-header'),
7292			$page_body = $('.page-body'),
7293			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
7294
7295		if ( $header_skew.length ) {
7296			$pageHeader.addClass('uncode-skew').css({
7297				position: 'relative',
7298				zIndex: 1
7299			});
7300			$header_skew.removeClass('uncode-skew');
7301			$page_body.css({
7302				position: 'relative',
7303				zIndex: 0
7304			});
7305		}
7306
7307		var $skew = $('.uncode-skew'),
7308			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
7309			horizontal = $horizontal.length,
7310			stopSkewing,
7311			lastOffset = 0,
7312			lastDate = Date.now();
7313
7314		if ( ! $skew.length ) {
7315			return;
7316		}
7317
7318		var dropSkew = function(){
7319			if ( UNCODE.wwidth < UNCODE.mediaQuery )
7320				return;
7321
7322			$skew.each(function(){
7323				var $this = $(this),
7324					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
7325
7326				if ( $drop.length ) {
7327					$this.css({
7328						'transform': 'skew(0)'
7329					});
7330					var bound = $this[0].getBoundingClientRect();
7331					$drop.css({
7332						left: bound.x * -1,
7333						top: bound.y * -1,
7334					});
7335				}
7336			});
7337		};
7338		dropSkew();
7339
7340		$(window).on('resize', dropSkew);
7341
7342		window.addEventListener( 'scroll', function() {
7343
7344			if ( justscrolled !== true ) {
7345				justscrolled = true;
7346				return;
7347			}
7348
7349			window.clearRequestTimeout( stopSkewing );
7350
7351			var now = Date.now(),
7352				delayInMs = now - lastDate,
7353				offset = window.pageYOffset || window.document.documentElement.scrollTop,
7354				newOffset = offset - lastOffset,
7355				speed = Math.pow((newOffset / delayInMs), 3) * -1,
7356				body = document.body,
7357				html = document.documentElement,
7358				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
7359				wait = 50,
7360				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
7361
7362			if ((lastDate + wait - now) < 0) {
7363
7364				lastDate = now;
7365				lastOffset = offset;
7366
7367				if ( speed > 6 ) {
7368					speed = 6;
7369				} else if ( speed < -6 ) {
7370					speed = -6;
7371				}
7372
7373				if ( speed > 2 && offset < UNCODE.wheight ) {
7374					speed = 2;
7375				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
7376					speed = -2;
7377				}
7378
7379				var speedY = speed,
7380					speedX = speed * 1.25;
7381
7382				if ( horizontal ) {
7383					speedY = 0;
7384					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
7385						speedX = 0;
7386						return;
7387					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
7388						speedX = 0;
7389						return;
7390					}
7391				} else {
7392					speedX = 0;
7393				}
7394
7395				if ( ! $skew.closest('.enter-st').length ) {
7396					speedX = 0;
7397				}
7398
7399				gsap.killTweensOf($skew);
7400				gsap.to( $skew, {
7401					duration: 0.2,
7402					skewY: (speedY * maxSpeed) + "deg",
7403					skewX: (speedX * maxSpeed) + "deg",
7404					ease: Power0.easeNone,
7405					transformOrigin: 'center',
7406				});
7407
7408			}
7409
7410			stopSkewing = requestTimeout(function() {
7411				gsap.killTweensOf($skew);
7412				gsap.to( $skew, {
7413					duration: 0.5,
7414					skewY: "0deg",
7415					skewX: "0deg",
7416					transformOrigin: 'center',
7417					ease: Expo.easeOut,
7418				});
7419
7420				$skew.each(function(){
7421					var $this = $(this),
7422						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
7423
7424					if ( $drop.length ) {
7425						var bound = $this[0].getBoundingClientRect()
7426						$drop.css({
7427							left: bound.x * -1,
7428							top: bound.y * -1,
7429						});
7430					}
7431				});
7432
7433			}, 200);
7434
7435		}, false);
7436
7437	};
7438
7439	$(window).on('load', loadSkewIt);
7440
7441};
7442
7443UNCODE.rotateIt = function() {
7444
7445	if ( $('body').hasClass('compose-mode') ) {
7446		return;
7447	}
7448
7449	var loadRotateIt = function(){
7450
7451		var $toRotate = $('.uncode-rotate');
7452
7453		$toRotate.each(function(){
7454			var $rotate = $(this),
7455				deg = 0,
7456				dir = true,
7457				coeff = 1,
7458				lastOffset = 0,
7459				lastDate = Date.now();
7460
7461			var checkScroll = function($rotate){
7462				// if ( ! $rotate.length ) {
7463				// 	return;
7464				// }
7465
7466				var now = Date.now(),
7467					delayInMs = now - lastDate,
7468					offset = window.pageYOffset || window.document.documentElement.scrollTop,
7469					newOffset = offset - lastOffset,
7470					speed = (newOffset / delayInMs) * 5,
7471					body = document.body,
7472					html = document.documentElement,
7473					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
7474
7475				lastDate = now;
7476				lastOffset = offset;
7477
7478				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
7479					deg = 0;
7480				}
7481
7482				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
7483					deg = parseFloat(deg) + parseFloat(speed);
7484				}
7485
7486				if ( $rotate.hasClass('uncode-rotate-hover') ) {
7487					$rotate.hover(function(){
7488						coeff = 1.75;
7489					}, function(){
7490						coeff = 1;
7491					});
7492				}
7493
7494				// if ( speed > 0 ) {
7495				// 	dir = true
7496				// } else if ( speed < 0 ) {
7497				// 	dir = false
7498				// }
7499
7500				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
7501					deg = deg+coeff;
7502					// if ( dir ) {
7503					// 	deg = deg+coeff;
7504					// } else {
7505					// 	deg = deg-coeff;
7506					// }
7507				}
7508
7509				$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
7510
7511				requestAnimationFrame(function() {
7512					checkScroll($rotate);
7513				});
7514
7515			};
7516
7517			checkScroll($rotate);
7518
7519		});
7520
7521	};
7522
7523	$(window).on('load', loadRotateIt);
7524
7525};
7526
7527var marqueeAttempts = 0,
7528	marqueeTO;
7529
7530UNCODE.textMarquee = function( $titles ) {
7531
7532	if ( typeof $titles == 'undefined' ) {
7533		$titles = $('.un-text-marquee');
7534	}
7535
7536	if ( ! $titles.length ) {
7537		return;
7538	}
7539
7540	$titles.each(function(){
7541		var $title = $(this),
7542			$span = $('> span', $title),
7543			txt,
7544			first = true,
7545			newW = UNCODE.wwidth;
7546
7547		$('.marquee-clone-wrap', $title).remove();
7548
7549		txt = $title.text();
7550
7551		if ( ! $('.marquee-original-core', $span).length ) {
7552			$span = $('> span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
7553		}
7554
7555		var checkResize,
7556			spanW,
7557			$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
7558			$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
7559			clearSpeed,
7560			speed = 10;
7561
7562		$span.prepend($prepended);
7563		$span.append($appended);
7564
7565		var continuousTextMarquee = function(){
7566			var bound = $title.css({
7567					'transform': 'none',
7568					'opacity': 0
7569				}).offset();
7570
7571			var xStrt = first || $title.hasClass('un-marquee-infinite') ? 0 : UNCODE.wwidth - bound.left,
7572				xEnd = $title.hasClass('un-marquee-infinite') ? spanW : ( spanW + bound.left ),
7573				xSpeed = $title.hasClass('un-marquee-infinite') ? ( spanW + bound.left ) : ( xStrt + ( UNCODE.wwidth + bound.left ) ),
7574				direction = $title.hasClass('un-marquee-opposite') ? 1 : -1;
7575
7576			var marqueeTL = new TimelineMax({paused:true, reversed:true});
7577
7578			var inViewElement = $title.closest('.sticky-trigger').length || $title.closest('.pin-spacer').length ? $title.closest('.vc_row')[0] : $title[0];
7579
7580			var inview = new Waypoint.Inview({
7581				element: inViewElement,
7582				enter: function(direction) {
7583					marqueeTL.play();
7584				},
7585				exited: function(direction) {
7586					marqueeTL.pause();
7587				}
7588			});
7589
7590			//gsap.killTweensOf($title);
7591			marqueeTL.fromTo( $title, {
7592				opacity: 1,
7593				x: xStrt
7594			},
7595			{
7596				duration: xSpeed / UNCODE.wwidth * speed,
7597				x: xEnd * direction,
7598				onComplete: function(){
7599					first = false;
7600					continuousTextMarquee();
7601				},
7602				ease: Linear.easeNone
7603			});
7604		};
7605
7606		var runTextMarquee = function(){
7607			var time = Date.now();
7608
7609			var textMarqueeScroll = function(){
7610				var $row = $title.closest('.vc_row'),
7611					$bound = $title.closest('.pin-spacer').length ? $row : $title,
7612					bound = $bound[0].getBoundingClientRect(),
7613					wait = 100,
7614					direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1;
7615
7616				if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 &&
7617					bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 &&
7618					marqueeAttempts < 2 ) {
7619
7620					clearRequestTimeout(marqueeTO);
7621
7622					marqueeTO = requestTimeout(function(){
7623						marqueeAttempts++;
7624						UNCODE.textMarquee();
7625					}, 100);
7626				}
7627
7628				//if ((time + wait - Date.now()) < 0) {
7629					//if ( bound.top > ( bound.height * -4 ) && ( bound.top - bound.height ) < UNCODE.wheight * 2 ) {
7630						// $title[0].style.transform = 'translateX(' + ( UNCODE.wheight * 0.5 - bound.top ) * 0.75 + 'px)';
7631						gsap.killTweensOf($title);
7632						gsap.to( $title, {
7633							duration: 0.24,
7634							x: ( UNCODE.wheight * 0.35 - bound.top ) * 0.5 * direction,
7635							//ease: Expo.easeOut,
7636						});
7637					//}
7638					//time = Date.now();
7639				//}
7640			};
7641
7642			textMarqueeScroll();
7643			$(window).on( 'load scroll', function() {
7644				textMarqueeScroll();
7645			});
7646
7647		};
7648
7649		var cloneSpan = function($_title, cntnt){
7650
7651			if ( $_title.hasClass('un-marquee-infinite') ) {
7652				$('> span.marquee-clone-wrap', $_title).text('');
7653			}
7654
7655			gsap.to( $_title, {
7656				duration: 0,
7657				x: 0
7658			});
7659			spanW = $span.outerWidth();
7660
7661			if ( !spanW ) {
7662				return;
7663			}
7664
7665			var part = Math.ceil( UNCODE.wwidth / spanW ) * 2;
7666
7667			if ( $_title.hasClass('un-marquee-infinite') ) {
7668
7669				for ( var i = 0; i < part; i++ ) {
7670					$prepended[0].textContent += cntnt + "\u00A0";
7671					$appended[0].textContent += cntnt + "\u00A0";
7672				}
7673			}
7674
7675			if ( $('body').hasClass('compose-mode') ) {
7676				return;
7677			}
7678
7679			if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
7680				continuousTextMarquee();
7681			}
7682
7683			if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
7684				runTextMarquee();
7685			}
7686
7687		};
7688
7689		var marqueResize = function(){
7690			clearRequestTimeout(checkResize);
7691			checkResize = requestTimeout(function(){
7692				if ( newW !== UNCODE.wwidth ) {
7693					gsap.killTweensOf($title);
7694					UNCODE.textMarquee();
7695					newW = UNCODE.wwidth;
7696				}
7697			}, 1000);
7698		};
7699
7700		$(window).off('resize', marqueResize)
7701		.on( 'resize', marqueResize);
7702
7703		cloneSpan($title, txt);
7704
7705		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
7706			window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
7707				// imageHover();
7708				var $_titles = $('.un-text-marquee',e.view.$el);
7709				UNCODE.textMarquee($_titles);
7710			});
7711		}
7712	});
7713
7714};
7715
7716UNCODE.parallax = function() {
7717	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
7718		if ($('.parallax-el').length > 0) {
7719			var parallax_elements = new Rellax('.parallax-el');
7720			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
7721		}
7722	}
7723};
7724
7725UNCODE.magicCursor = function(){
7726	var $customCursor = $('#uncode-custom-cursor'),
7727		$customPilot = $('#uncode-custom-cursor-pilot'),
7728		$postLists = $('.uncode-post-titles'),
7729		currentCursor = 'auto',
7730		setTime,
7731		isScrolling,
7732		mouseEvent;
7733
7734	function delayChangeCursor(cursorType, delayt_time){
7735		clearRequestTimeout(setTime);
7736		setTime = requestTimeout(function() {
7737			$customCursor.attr('data-cursor', cursorType);
7738			if ( $customPilot.length ) {
7739				$customPilot.attr('data-cursor', cursorType);
7740			}
7741			currentCursor = cursorType;
7742		}, delayt_time);
7743	}
7744
7745	function changeCursor($wrap){
7746		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
7747		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href]',
7748			$href = $wrap.find(href),
7749			cursorType,
7750			setTime, set_delay;
7751
7752		$href.hover(function(e) {
7753			var $this = $(this),
7754				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
7755				is_frontend_editor = $this.closest('.vc_controls').length,
7756				hasSrcOrClck = $('[src]', $this).length || $this.closest('.tmb-click-row').length,
7757				$parent_cursor = $this.closest('[class*="custom-cursor"]');
7758			if ( is_frontend_editor ) {
7759				cursorType = 'auto';
7760			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
7761				cursorType = data_cursor;
7762			} else if ( $parent_cursor.length ) {
7763				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
7764					cursorType = 'icon-light';
7765				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
7766					cursorType = 'icon-diff';
7767				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
7768					cursorType = 'icon-accent';
7769				} else {
7770					cursorType = 'icon-dark';
7771				}
7772			} else {
7773				cursorType = 'pointer';
7774			}
7775			delayChangeCursor(cursorType, 0);
7776		}, function(){
7777			delayChangeCursor('auto', 150);
7778		});
7779
7780		$(window).on('disable-hover', function(event) {
7781			document.addEventListener("mousemove", function(e) {
7782				mouseEvent = e;
7783			});
7784			delayChangeCursor('auto', 0);
7785		});
7786
7787		$(window).on('enable-hover', function(event) {
7788			if ( typeof mouseEvent !== 'undefined' ) {
7789				var x = mouseEvent.clientX,
7790					y = mouseEvent.clientY;
7791
7792				var elements = document.elementsFromPoint(x, y),
7793					$element = $(elements[0]);
7794
7795				$element.closest(href).trigger('mouseenter');
7796			}
7797		});
7798
7799	}
7800
7801	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
7802		changeCursor();
7803	});
7804
7805	$(document).ajaxComplete(function( event, xhr, settings ) {
7806		changeCursor();
7807	});
7808
7809	$('.isotope-container').on('isotope-layout-complete', function() {
7810		var $this = $(this);
7811		changeCursor($this);
7812	});
7813
7814};
7815
7816UNCODE.magneticCursor = function(){
7817	function magneticCursor($wrap){
7818		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
7819		var $magnetics = $wrap.find('.tmb-image-anim-magnetic .t-entry-visual').has('img:not(.avatar), .t-background-cover, .dummy.secondary-dummy-image, .t-secondary-background-cover').add($('.magnetic').has('.background-inner, .header-bg'));
7820
7821		$magnetics.on('mousemove', function(e){
7822			var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this),
7823				bound = e.currentTarget.getBoundingClientRect(),
7824				coeff = 30,
7825				hor = (bound.width / 2) - (e.clientX - bound.left),
7826				ver = (bound.height / 2) - (e.clientY - bound.top),
7827				toX = hor / bound.width * coeff,
7828				toY = ver / bound.height * coeff,
7829				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
7830				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
7831				toScale = Math.max(scaleX, scaleY);
7832
7833			gsap.killTweensOf($el);
7834			gsap.to( $el, {
7835				duration: 0.75,
7836				x: toX,
7837				y: toY,
7838				scale: toScale,
7839				ease: Power1.easeOut,
7840				transformPerspective: 900,
7841				transformOrigin: 'center',
7842				force3D: true
7843			});
7844		}).on('mouseout', function(e){
7845			var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this);
7846			gsap.killTweensOf($el);
7847			gsap.to( $el, {
7848				duration: 0.6,
7849				y: 0,
7850				x: 0,
7851				scale: 1,
7852				ease: Power1.easeOut,
7853				transformPerspective: 900,
7854				transformOrigin: 'center',
7855				force3D: true
7856			});
7857		});
7858	};
7859
7860	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
7861		magneticCursor();
7862	});
7863
7864	$(document).ajaxComplete(function( event, xhr, settings ) {
7865		magneticCursor();
7866	});
7867
7868	$('.isotope-container').on('isotope-layout-complete', function() {
7869		var $this = $(this);
7870		magneticCursor($this);
7871	});
7872
7873};
7874
7875UNCODE.dropImage = function() {
7876
7877	/****************************
7878	 * Image hover *
7879	****************************/
7880	function imageHover(){
7881		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
7882			return;
7883		}
7884
7885		var $postLists = $('.uncode-post-titles');
7886		$postLists.each(function(){
7887			var $list = $(this),
7888				timing = parseFloat( $list.attr('data-timing') ),
7889				default_image = $list.hasClass('uncode-post-titles-default-image'),
7890				default_title = $list.hasClass('uncode-post-titles-default-title'),
7891				$tmbs = $('.tmb', $list),
7892				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
7893				clientX,
7894				clientY,
7895				$row_parent = $list.closest('.vc_row'),
7896				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
7897				$col_parent = $list.closest('.uncell'),
7898				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
7899				setCTA;
7900
7901			timing *= 0.001;
7902
7903			var drop_bgs = function(){
7904				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
7905					var $drop = $(this),
7906						srcset = $drop.attr('data-bgset'),
7907						setArr = srcset.split(","),
7908						setArrOrder = [],
7909						biggest = 0,
7910						checkBg = false;
7911
7912					if ( SiteParameters.uncode_adaptive == true ) {
7913						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
7914							$drop.css({
7915								'background-image' : 'url(' + setArr[0] + ')'
7916							});
7917						}
7918					} else {
7919						for ( var i = 0; i < setArr.length; i++ ) {
7920							var setLoop = setArr[i].trim().split(" ");
7921							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
7922								var parseSet = parseFloat(setLoop[1]);
7923								if ( biggest < parseSet ) {
7924									biggest = parseSet;
7925								}
7926								setArrOrder[parseSet] = setLoop[0];
7927								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
7928									checkBg = true;
7929									$drop.css({
7930										'background-image' : 'url(' + setLoop[0] + ')'
7931									});
7932								}
7933							}
7934						}
7935
7936						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
7937							$drop.css({
7938								'background-image' : 'url(' + setArrOrder[biggest] + ')'
7939							});
7940						}
7941					}
7942
7943				});
7944			};
7945
7946			drop_bgs();
7947
7948			var dropMovesSize = function(){
7949				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
7950					return;
7951				}
7952				$drop_moves.each(function(){
7953					var $drop_move = $(this),
7954						dataW = $drop_move.attr('data-w'),
7955						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
7956					if ( typeof dataW !== 'undefined' && dataW !== null ) {
7957						dataW = screenInfo.width / 12 * parseFloat( dataW );
7958					}
7959					$drop_moves.css({
7960						width: dataW
7961					});
7962
7963					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
7964						$anim_parent.on('animationend', function(){
7965							var bound = $anim_parent[0].getBoundingClientRect();
7966							$drop_move.css({
7967								left: bound.x * -1,
7968								top: bound.y * -1,
7969							});
7970						});
7971					}
7972				});
7973
7974
7975			};
7976
7977			dropMovesSize();
7978
7979			$(window).on( 'resize', function(){
7980				clearRequestTimeout(setCTA);
7981				setCTA = requestTimeout( function() {
7982					drop_bgs();
7983					dropMovesSize();
7984				}, 100 );
7985			});
7986
7987			if ( $drop_row_parents.length ) {
7988				$row_parent.addClass( 'drop-added' );
7989			}
7990
7991			$drop_row_parents.each(function(index, val){
7992				var $drop = $(val);
7993				$row_parent.prepend($drop);
7994				manageVideos($drop, false);
7995				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
7996					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
7997				}
7998				if ( default_image && index == 0 ) {
7999					manageVideos($drop, true);
8000					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
8001						image_ph = new Image();
8002					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
8003						image_ph.onload = function() {
8004							$drop.addClass('active');
8005							if ( default_title ) {
8006								$list.addClass('drop-hover');
8007								$tmbs.first().addClass('drop-active');
8008							}
8009						};
8010						image_ph.src = bg_img;
8011					}
8012				}
8013			});
8014
8015			if ( $drop_col_parents.length ) {
8016				$col_parent.addClass( 'drop-added' );
8017			}
8018
8019			$drop_col_parents.each(function(index, val){
8020				var $drop = $(this);
8021				$col_parent.prepend($drop);
8022				manageVideos($drop, false);
8023				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
8024					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
8025				}
8026				if ( default_image && index == 0 ) {
8027					manageVideos($drop, true);
8028					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
8029						image_ph = new Image();
8030					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
8031						image_ph.onload = function() {
8032							$drop.addClass('active');
8033							if ( default_title ) {
8034								$list.addClass('drop-hover');
8035								$tmbs.first().addClass('drop-active');
8036							}
8037						};
8038						image_ph.src = bg_img;
8039					}
8040				}
8041			});
8042
8043			function manageVideos( $el, start ) {
8044				var videoElem = $('video', $el),
8045					$iframe = $('iframe', $el),
8046					iframeID = $iframe.attr('id');
8047				if ( videoElem.length ) {
8048					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
8049						if ( start ) {
8050							videoElem[0].setCurrentTime(0);
8051							videoElem[0].play();
8052						} else {
8053							videoElem[0].pause();
8054							videoElem[0].setCurrentTime(0);
8055						}
8056					} else {
8057						if ( start ) {
8058							videoElem[0].currentTime = 0;
8059							videoElem[0].play();
8060						} else {
8061							videoElem[0].pause();
8062							videoElem[0].currentTime = 0;
8063						}
8064					}
8065				}
8066
8067				$el.data('active', start);
8068
8069				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
8070					var iframeIDv = iframeID.replace('okplayer-', ''),
8071						optionsV = $(window).data('okoptions-' + iframeIDv),
8072						vimeo = $iframe[0],
8073						playerV = $f(vimeo), // `$f` is froogaloop, assumed is loaded
8074						timeV = 0;
8075
8076					if (optionsV.time != null) {
8077						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
8078						for ( var i = 0; i < timeArr.length; i++ ) {
8079							if ( timeArr[i] === 'h' ) {
8080								timeV += parseFloat(timeArr[i-1]) * 3600;
8081							} else if ( timeArr[i] === 'm' ) {
8082								timeV += parseFloat(timeArr[i-1]) * 60;
8083							} else if ( timeArr[i] === 's' ) {
8084								timeV += parseFloat(timeArr[i-1]);
8085							}
8086						}
8087					}
8088					playerV.api('seekTo', timeV);
8089					if ( start ) {
8090						playerV.api('play');
8091					} else {
8092						playerV.api('pause');
8093					}
8094				} else if ( $el.attr('data-provider') === 'youtube' ) {
8095					if ( start ) {
8096						$el.trigger('uncode-resume');
8097					} else {
8098						$el.trigger('uncode-pause');
8099					}
8100				}
8101
8102			}
8103
8104			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
8105
8106				document.addEventListener("mousemove", function(e) {
8107					$drop_moves.each(function(){
8108						var $drop_move = $(this),
8109							duration = 0.4;
8110
8111						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
8112							duration = 0.8;
8113						}
8114
8115						clientX = e.clientX;
8116						clientY = e.clientY;
8117
8118						gsap.to( $drop_move, {
8119							duration: duration,
8120							x: clientX,
8121							y: clientY,
8122							ease: Power1.easeOut,
8123						});
8124					});
8125				});
8126
8127			} else {
8128
8129				$(window).on("touchend scroll", function(e) {
8130					$list.removeClass('drop-hover');
8131					$drop_moves.removeClass('active');
8132					$tmbs.removeClass('drop-active');
8133				});
8134
8135				$drop_moves.each(function(){
8136					var $drop_move = $(this),
8137						$tmb = $drop_move.closest('.tmb'),
8138						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
8139
8140					if ( $anim_parent.hasClass('uncode-skew') ) {
8141						$anim_parent.css({
8142							'transform': 'skew(0)'
8143						});
8144					}
8145
8146					$tmb.on('touchend', function(e){
8147						e.stopPropagation();
8148
8149						$drop_moves.removeClass('active');
8150						$tmbs.removeClass('drop-active');
8151
8152						$list.addClass('drop-hover');
8153						$tmb.addClass('drop-active');
8154						$drop_move.addClass('active');
8155						manageVideos($drop_move, true);
8156						clientX = e.changedTouches[0].clientX;
8157						clientY = e.changedTouches[0].clientY;
8158
8159						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
8160							var bound = $anim_parent[0].getBoundingClientRect();
8161							clientX = clientX - bound.x;
8162							clientY = clientY - bound.y;
8163						}
8164
8165						$drop_move.css({
8166							left: clientX,
8167							top: clientY
8168						});
8169					});
8170				});
8171
8172			}
8173
8174			$tmbs.each(function(e){
8175				var $tmb = $(this),
8176					// $trgr = $('a', $tmb),
8177					$trgr = $tmb,
8178					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
8179					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
8179(.t-inside), .parallax-el'),
8180					$video = $('video', $tmb),
8181					$iframe = $('iframe', $tmb),
8182					$entryTxt = $('.t-entry-text', $tmb),
8183					stopBounding;
8184
8185				$entryTxt.add($drop_move).css({
8186					'transition-duration': timing + 's'
8187				});
8188
8189				if ( $video.length ) {
8190					var vidH = $video[0].videoHeight,
8191						vidW = $video[0].videoWidth;
8192					$video.css({
8193						'height': vidH,
8194						'width': vidW
8195					});
8196				}
8197
8198				if ( $iframe.length ) {
8199					var vidH = $drop_move.attr('data-height'),
8200						vidW = $drop_move.attr('data-width');
8201					$iframe.css({
8202						'height': vidH,
8203						'width': vidW
8204					});
8205				}
8206
8207				$iframe.each(function(){
8208					var $video = $(this),
8209						vidH = $video[0].videoHeight,
8210						vidW = $video[0].videoWidth;
8211					$video.css({
8212						'height': vidH,
8213						'width': vidW
8214					});
8215				});
8216
8217				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
8218					$trgr.on('mouseenter',function(e){
8219						$list.addClass('drop-hover');
8220						$tmbs.removeClass('drop-active');
8221						$tmb.addClass('drop-active');
8222						$drop_move.addClass('active');
8223						manageVideos($drop_move, true);
8224
8225						var clientX = e.clientX,
8226							clientY = e.clientY;
8227						$drop_move.css({
8228							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
8229						});
8230
8231					})
8232					.on('mouseleave', function(e){
8233						$list.removeClass('drop-hover');
8234						$drop_move.css({
8235							'transition-duration': ( timing*1.25 ) + 's'
8236						});
8237						$drop_move.removeClass('active');
8238						$tmb.removeClass('drop-active');
8239						$drop_move.on('transitionend', function(e){
8240							$drop_move.off('transitionend');
8241							$drop_move.css({
8242								'transition-duration': timing + 's'
8243							});
8244							manageVideos($drop_move,false);
8245						});
8246					});
8247
8248					document.addEventListener('visibilitychange', function(){
8249						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
8250							$drop_move.css({
8251								'transition-duration': '0s'
8252							});
8253							$drop_move.removeClass('active');
8254							manageVideos($drop_move, false);
8255						}
8256					});
8257
8258					document.addEventListener('scroll', function(){
8259						window.clearRequestTimeout( stopBounding );
8260
8261						if ( $drop_move.hasClass('active') ) {
8262							$list.removeClass('drop-hover');
8263							$tmbs.removeClass('drop-active');
8264							$drop_move.removeClass('active');
8265							$drop_move.on('transitionend', function(e){
8266								$drop_move.off('transitionend');
8267								$drop_move.css({
8268									'transition-duration': timing + 's'
8269								});
8270								manageVideos($drop_move,false);
8271							});
8272						}
8273
8274						stopBounding = requestTimeout(function() {
8275							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
8276								var bound = $anim_parent[0].getBoundingClientRect();
8277								$drop_move.css({
8278									left: bound.x * -1,
8279									top: bound.y * -1,
8280								});
8281							}
8282						}, 200);
8283
8284					});
8285				}
8286
8287				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
8288					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
8289
8290				$drop.css({
8291					'transition-duration': timing + 's'
8292				});
8293
8294				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
8295					$trgr.on('mouseenter',function(e){
8296						$row_parent.add($col_parent).addClass('drop-list-loaded');
8297						$list.addClass('drop-hover');
8298
8299						if ( !$tmb.hasClass('drop-active') ) {
8300							$tmbs.removeClass('drop-active');
8301							$tmb.addClass('drop-active');
8302							if ( default_image && !$drop.hasClass('active') ) {
8303								var $prev = $('[data-drop].active', $row_parent);
8304								$prev.css({
8305									'transition-duration': (timing*1.5) + 's'
8306								});
8307								$prev.removeClass('active');
8308								$prev.on('transitionend', function(e){
8309									$prev.off('transitionend');
8310									manageVideos($prev,false);
8311								});
8312							}
8313							$drop.css({
8314								'transition-duration': timing + 's'
8315							});
8316							$drop.off('transitionend');
8317							$drop.addClass('active');
8318							manageVideos($drop, true);
8319						}
8320					})
8321					.on('mouseleave', function(e){
8322						if ( ( default_image && !default_title ) || !default_image ) {
8323							$list.removeClass('drop-hover');
8324							$tmb.removeClass('drop-active');
8325						}
8326						if ( ! default_image ) {
8327							$drop.css({
8328								'transition-duration': (timing*1.5) + 's'
8329							});
8330							$drop.removeClass('active');
8331
8332							$drop.on('transitionend', function(e){
8333								$drop.off('transitionend');
8334								manageVideos($drop,false);
8335							});
8336						}
8337					});
8338
8339					document.addEventListener('visibilitychange', function(){
8340						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
8341							$drop.css({
8342								'transition-duration': '0s'
8343							});
8344							$drop.removeClass('active');
8345							manageVideos($drop, false);
8346						}
8347					});
8348				}
8349			});
8350
8351		});
8352	};
8353
8354	$(window).on('load', function(event) {
8355		imageHover();
8356	});
8357
8358	var drop_wp_animation = function() {
8359		var $postLists = $('.uncode-post-titles');
8360		$postLists.each(function(){
8361			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
8362				new Waypoint({
8363					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
8364					element: val,
8365					handler: function() {
8366						var element = $(this.element),
8367							parent = element.closest('.tmb'),
8368							currentIndex = parent.index(),
8369							delay = currentIndex,
8370							delayAttr = parseInt(element.attr('data-delay'));
8371						if (isNaN(delayAttr)) delayAttr = 100;
8372						var objTimeout = requestTimeout(function() {
8373							element.addClass('start_animation');
8374
8375							var nextTimeout = requestTimeout(function() {
8376								$('.drop-image-separator', parent).addClass('start_animation');
8377							}, 50);
8378
8379						}, delay * delayAttr);
8380						if (!UNCODE.isUnmodalOpen) {
8381							this.destroy();
8382						}
8383					},
8384					offset: UNCODE.isFullPage ? '100%' : '90%'
8385				})
8386			});
8387		});
8388	}
8389
8390	var runWaypoints_TO,
8391		runWaypoints_delay = 0;
8392
8393	var runWaypoints = function(){
8394		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
8395			runWaypoints_delay = 400;
8396		}
8397		clearRequestTimeout(runWaypoints_TO);
8398		runWaypoints_TO = requestTimeout(function() {
8399			drop_wp_animation();
8400		}, runWaypoints_delay);
8401	};
8402	runWaypoints();
8403	$( document.body ).on( 'uncode_waypoints', runWaypoints );
8404	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
8405		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
8406			// imageHover();
8407			runWaypoints();
8408		});
8409	}
8410};
8411
8412UNCODE.postTable = function() {
8413
8414	var clickRow = function(){
8415		var $postLists = $('.uncode-post-table');
8416
8417		$postLists.each(function(){
8418			var $postList = $(this),
8419				$tmbClicks = $('.tmb.tmb-click-row', $postList);
8420
8421			$tmbClicks.each(function(){
8422				var $tmb = $(this),
8423					$click = $('.table-click-row', $tmb);
8424				$('*:not(.table-click-row)', $tmb).on('click', function(e){
8425					e.preventDefault();
8426					e.stopPropagation();
8427					$click[0].click();
8428					return false;
8429				});
8430			});
8431
8432		})
8433	};
8434
8435	clickRow();
8436
8437	var hoverRow = function(){
8438		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
8439
8440		$postLists.on('mouseenter', function(){
8441			$(this).addClass('post-table-hover');
8442		});
8443		$postLists.on('mouseleave', function(){
8444			$(this).removeClass('post-table-hover');
8445		});
8446	}
8447
8448	hoverRow();
8449
8450	var drop_wp_animation = function() {
8451		var $postLists = $('.uncode-post-table');
8452		$postLists.each(function(){
8453			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
8454				new Waypoint({
8455					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
8456					element: val,
8457					handler: function() {
8458						var element = $(this.element),
8459							parent = element.closest('.tmb'),
8460							currentIndex = parent.index(),
8461							delay = currentIndex,
8462							delayAttr = parseInt(element.attr('data-delay'));
8463						if (isNaN(delayAttr)) delayAttr = 100;
8464						var objTimeout = requestTimeout(function() {
8465							element.addClass('start_animation');
8466						}, delay * delayAttr);
8467						if (!UNCODE.isUnmodalOpen) {
8468							this.destroy();
8469						}
8470					},
8471					offset: UNCODE.isFullPage ? '100%' : '90%'
8472				})
8473			});
8474		});
8475	}
8476
8477	var runWaypoints_TO,
8478		runWaypoints_delay = 0;
8479
8480	var runWaypoints = function(){
8481		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
8482			runWaypoints_delay = 400;
8483		}
8484		clearRequestTimeout(runWaypoints_TO);
8485		runWaypoints_TO = requestTimeout(function() {
8486			drop_wp_animation();
8487		}, runWaypoints_delay);
8488	};
8489	runWaypoints();
8490	$( document.body ).on( 'uncode_waypoints', runWaypoints );
8491	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
8492		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
8493			runWaypoints();
8494			// clickRow();
8495		});
8496	}
8497};
8498
8499UNCODE.rotatingTxt = function($ctxt) {
8500
8501	if ( $('body').hasClass('compose-mode') ) {
8502		return;
8503	}
8504
8505	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
8506	var setCTA;
8507
8508	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
8509		var $heading = $(this),
8510			// debug = 0,
8511			cycle = 0,
8512			$trgt,
8513			$toMove,
8514			$highl,
8515			$col = $heading.closest('.uncont'),
8516			txt,
8517			arrTxt,
8518			textFadeIn, textFadeOut,
8519			removeWraps;
8520
8521		var defineObjs = function() {
8522			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
8523				var $rtx = $(this),
8524					fx = $rtx.attr('data-fx'),
8525					wait = $rtx.attr('data-wait'),
8526					$prev = $(this).prev().addClass('prev-rotating-start'),
8527					splitToMove = [],
8528					splitArray = [],
8529					lineArray = [],
8530					lineIndex = 0,
8531					lineStart = true,
8532					lineEnd = false,
8533					startSplit = false,
8534					$line_wrap = $rtx.closest('.heading-line-wrap'),
8535					same_line = true,
8536					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
8537					indexRtx = $splits.index($rtx);
8538
8539				fx = typeof fx === 'undefined' ? '' : fx;
8540				wait = typeof wait === 'undefined' ? '' : wait;
8541
8542				$splits.each(function(key, val){
8543					var $split = $(this),
8544						$new_line_wrap = $split.closest('.heading-line-wrap');
8545
8546					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
8547						splitArray.push( $split );
8548					}
8549
8550					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
8551						startSplit = false;
8552					}
8553
8554					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
8555						splitArray.push( $split );
8556
8557						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
8558							same_line = true;
8559						} else {
8560							same_line = false;
8561						}
8562					}
8563
8564					if ( key == indexRtx ) {
8565						if ( /\S/.test($split.text()) ) {
8566							startSplit = true;
8567							$line_wrap = $split.closest('.heading-line-wrap');
8568							splitArray.push( $split );
8569						} else {
8570							indexRtx++;
8571						}
8572					}
8573
8574					$line_wrap = $new_line_wrap;
8575				});
8576
8577				$toMove = $($.map(splitToMove, function(el){return el.get();}));
8578				$trgt = $($.map(splitArray, function(el){return el.get();}));
8579
8580				if ( same_line ) {
8581					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
8582					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
8583				}
8584
8585				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
8586					$prev.addClass('empty-span-hidden');
8587				}
8588
8589				$highl = $('.heading-text-highlight-inner', $trgt);
8590
8591				$rtx.attr('data-animated', 'true');
8592				if ( cycle == 0 ) {
8593					$( document.body ).trigger('defer-highlights');
8594					cycle++;
8595					defineObjs();
8596					return;
8597				}
8598				cycle++;
8599
8600				txt = $rtx.attr('data-text');
8601				arrTxt = txt.split("|");
8602
8603				textFadeOut($trgt);
8604
8605			});
8606		};
8607
8608		removeWraps = function(){
8609
8610			// if ( debug == 1 ) return;
8611			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
8612			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
8613
8614
8615				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
8616					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
8617
8618				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
8619
8620				$splitFlow.each(function(){
8621					$(this).append($temp_highl);
8622				});
8623
8624				var $line_wrap = $wraps[wrap_k];
8625				var $parent_wrap = $line_wrap.parentNode;
8626				if ( $parent_wrap !== null ) {
8627					while ( $line_wrap.firstChild ) {
8628						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
8629					}
8630					$parent_wrap.removeChild($line_wrap);
8631				}
8632			}
8633			// debug++;
8634			defineObjs();
8635		};
8636
8637		var loop = 0;
8638		textFadeIn = function($trgt){
8639			var word = arrTxt[loop].split(" "),
8640				worsSpan = '',
8641				$wrap = $trgt.closest('.uncode-rotating-wrap'),
8642				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
8643				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
8644
8645			for (var w = 0; w < word.length; w++) {
8646				var highl;
8647				if ( $highl.length ) {
8648					highl = $highl[0].outerHTML;
8649				} else {
8650					highl = '';
8651				}
8652
8653				if ( w > 0 ) {
8654					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
8655				}
8656				var charachters = word[w].split('');
8657				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
8658				for (var c = 0; c < charachters.length; c++) {
8659					worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
8660				}
8661				worsSpan += '</span>' + highl + '</span></span>';
8662			}
8663
8664			if ( $wrap.length && $wrap_inner.length ) {
8665				var words_w = $wrap_inner.outerWidth();
8666				$wrap.css({
8667					width: words_w
8668				});
8669
8670				$highl = $('.heading-text-highlight-inner', $wrap);
8671				$highl.prependTo($wrap);
8672
8673				$wrap_inner.css({
8674					opacity: 0
8675				});
8676
8677				$wrap_inner.html(worsSpan);
8678				$('.heading-text-highlight-inner', $wrap_inner).remove();
8679				words_w = $wrap_inner.innerWidth();
8680
8681				var duration = 0.45;
8682
8683				$heading.removeClass('auto-width');
8684				if ( words_w > $col.width() ) {
8685					$heading.addClass('auto-width');
8686					words_w = 'auto';
8687					duration = 0;
8688				}
8689
8690				$wrap.css({
8691					'width': words_w,
8692					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
8693				});
8694
8695				var $word_inner = $('.split-word-inner', $wrap_inner),
8696					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
8697
8698				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
8699
8700				if ( !$target_fx.length ) {
8701					return;
8702				}
8703
8704				gsap.killTweensOf($target_fx);
8705
8706				if ( fx !== 'zoom' ) {
8707					gsap.fromTo( $target_fx, {
8708						y: fx === 'opacity' ? '0%' : '-10%'
8709					},{
8710						delay: duration,
8711						duration: 0.25,
8712						y: '0%',
8713						ease: Circ.easeOut,
8714					});
8715
8716					if ( !$wrap_inner.length ) {
8717						return;
8718					}
8719
8720					gsap.fromTo( $wrap_inner, {
8721						opacity: 0,
8722					},{
8723						delay: duration,
8724						duration: 0.25,
8725						opacity: 1,
8726						ease: Circ.easeOut,
8727						onComplete: function(){
8728							$('> .heading-text-highlight-inner', $wrap).remove();
8729							$wrap_inner.html(worsSpan);
8730							removeWraps();
8731						}
8732					})
8733
8734				} else {
8735					gsap.fromTo( $target_fx, {
8736						transformOrigin: '50%',
8737						opacity: 0,
8738						scale: 0.875,
8739					},{
8740						opacity: 1,
8741						delay: duration,
8742						duration: 0.25,
8743						scale: 1,
8744						ease: Circ.easeOut,
8745						onComplete: function(){
8746							$('> .heading-text-highlight-inner', $wrap).remove();
8747							$wrap_inner.html(worsSpan);
8748							removeWraps();
8749						}
8750					});
8751				}
8752
8753			} else {
8754
8755				if ( !$wrap_inner.length ) {
8756					return;
8757				}
8758
8759				gsap.to( $wrap_inner, {
8760					duration: 0.4,
8761					opacity: 0,
8762					ease: Power1.easeOut,
8763					onComplete: function(){
8764						$wrap_inner.html(worsSpan);
8765						words_w = $wrap_inner.innerWidth();
8766
8767						gsap.to( $wrap_inner, {
8768							duration: 0.2,
8769							opacity: 1,
8770							ease: Power1.easeOut,
8771							onComplete: function(){
8772								$('> .heading-text-highlight-inner', $wrap).remove();
8773								$wrap_inner.html(worsSpan);
8774								removeWraps();
8775							}
8776						})
8777					}
8778				});
8779			}
8780
8781			if ( loop < arrTxt.length-1 ) {
8782				loop++;
8783			} else {
8784				loop = 0;
8785			}
8786
8787		};
8788
8789		textFadeOut = function($trgt){
8790			var $word_inner = $('.split-word-inner', $trgt),
8791				$wrap = $trgt.closest('.uncode-rotating-wrap'),
8792				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
8793				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
8794				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
8795
8796			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
8797
8798			var gsap_param = {
8799					delay: wait,
8800					duration: 0.25,
8801					y: fx === '' ? '10%' : '0%',
8802					opacity: 0,
8803					ease: Circ.easeOut,
8804					onStart: function(){
8805						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
8806							$highl = $('.heading-text-highlight-inner', $wrap);
8807							$highl.prependTo($wrap);
8808						}
8809					},
8810					onComplete: textFadeIn,
8811					onCompleteParams: [$trgt]
8812				};
8813
8814			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
8815
8816			if ( fx === '' ) {
8817				gsap_param.y = '10%';
8818			} else if ( fx === 'zoom' ) {
8819				gsap_param.scale = '1.045';
8820			}
8821
8822			if ( !$target_fx.length ) {
8823				return;
8824			}
8825
8826			if ( $heading.data('waypoint') !== true ) {
8827				var textInView = new Waypoint.Inview({
8828					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
8829					element: $heading[0],
8830					enter: function(direction) {
8831						$heading.data('waypoint',true);
8832						gsap.fromTo( $target_fx, {
8833							transformOrigin: '50%'
8834						}, gsap_param );
8835					}
8836				});
8837			} else {
8838				gsap.fromTo( $target_fx, {
8839					transformOrigin: '50%'
8840				}, gsap_param );
8841			}
8842		};
8843
8844		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
8845			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
8846				var $el = model.view.$el,
8847					shortcode = model.attributes.shortcode;
8848
8849				UNCODE.rotatingTxt($el);
8850			});
8851		} else {
8852			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
8853				$heading.on('already-animated', function(){
8854					removeWraps();
8855					window.addEventListener('removeOldLines', function(){
8856						clearRequestTimeout(setCTA);
8857						setCTA = requestTimeout( removeWraps, 150 );
8858					});
8859				});
8860			} else {
8861				$(window).on('load', function(){
8862					removeWraps();
8863					window.addEventListener('removeOldLines', function(){
8864						clearRequestTimeout(setCTA);
8865						setCTA = requestTimeout( removeWraps, 150 );
8866					});
8867				});
8868			}
8869		}
8870	});
8871
8872};
8873
8874UNCODE.verticalText = function() {
8875	$(window).on('menuCanvasOpen', function(){
8876		$('.vertical-text--fixed').fadeOut(500);
8877		$('.horizontal-text--fixed').fadeOut(500);
8878	}).on('menuCanvasClose', function(){
8879		$('.vertical-text--fixed').fadeIn(500);
8880		$('.horizontal-text--fixed').fadeIn(500);
8881	});
8882
8883	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
8884	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
8885	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
8886	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
8887
8888	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
8889		window.addEventListener('scroll', function(e) {
8890			var totalPageHeight = document.body.scrollHeight;
8891			var scrollPoint = window.scrollY + window.innerHeight;
8892
8893			if (window.scrollY > 0) {
8894				showOnTopVerticalTexts.fadeOut();
8895				showOnTopHorizontalTexts.fadeOut();
8896			} else {
8897				showOnTopVerticalTexts.fadeIn();
8898				showOnTopHorizontalTexts.fadeIn();
8899			}
8900
8901			if (scrollPoint >= totalPageHeight) {
8902				hideOnBottomVerticalTexts.fadeOut();
8903				hideOnBottomHorizontalTexts.fadeOut();
8904			} else {
8905				hideOnBottomVerticalTexts.fadeIn();
8906				hideOnBottomHorizontalTexts.fadeIn();
8907			}
8908		}, false);
8909	}
8910};
8911
8912UNCODE.stickyScroll = function( $el ) {
8913	if ( typeof $el === 'undefined' || $el === null ) {
8914		$el = $('body');
8915	}
8916	var checkVisible = function( el, dir ) {
8917		if (typeof jQuery === "function" && el instanceof jQuery) {
8918			el = el[0];
8919		}
8920
8921		var off = 50;
8922		dir = typeof dir=='undefined' ? 'right' : dir;
8923		var rect = el.getBoundingClientRect();
8924
8925		return (
8926			(
8927				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8928				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8929				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
8930			) &&
8931			(
8932				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
8933				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
8934				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
8935				( rect.right <= window.innerWidth && rect.left >= 0 )
8936			)
8937		);
8938	};
8939
8940	var setItemsRelHeight = function(reset) {
8941		var $_el = $el;
8942		if ( $el.is('.index-scroll') ) {
8943			var $_el = $el.closest('.uncont');
8944		}
8945		$('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
8946			$.each($('.tmb', item), function(index, val) {
8947				if ( reset === true ) {
8948					$(val).css( 'visibility', 'hidden' );
8949				} else {
8950					$(val).css( 'visibility', 'visible' );
8951				}
8952			});
8953		});
8954		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
8955			$.each($('.tmb', item), function(index, val) {
8956				if ( reset === true ) {
8957					$(val).css( 'visibility', 'hidden' );
8958					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
8959				} else {
8960					var $rowParent = $(item).closest('.row-parent'),
8961						rowRatio = $rowParent.attr('data-height-ratio'),
8962						$rowInner = $(item).closest('.row-child'),
8963						rowRatioInner = $rowInner.attr('data-height'),
8964						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
8965						$colContainer = $(item).closest('.uncell'),
8966						$uncont = $(item).closest('.uncont'),
8967						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
8968						safe_heigth = $(item).data('safe-height'),
8969						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
8970						offSet = $(item).offset().top - $uncont.offset().top,
8971						multiplier_h,
8972						data_viewport_h,
8973						body_border = $('.body-borders .top-border').outerHeight() * 2,
8974						remove_menu = $(item).data('vp-menu');
8975
8976					if ( rowRatio === 'full' || rowRatio === '' ) {
8977						rowRatio = 1;
8978					} else {
8979						rowRatio = rowRatio / 100;
8980					}
8981
8982					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
8983						rowRatio = rowRatio;
8984					} else {
8985						rowRatio = rowRatio * rowRatioInner / 100;
8986					}
8987
8988					winHeight = winHeight * rowRatio;
8989
8990					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
8991						multiplier_h = parseInt($(item).attr('data-vp-height'));
8992					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
8993						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
8994					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
8995						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
8996					}
8997
8998					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
8999						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
9000						if ( remove_menu === true ) {
9001							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
9002						}
9003						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
9004					} else {
9005						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
9006					}
9007
9008				}
9009			});
9010		});
9011		$('.index-scroll', $_el).each(function(i, item){
9012			var $uncoltable = $(item).closest('.uncoltable'),
9013				$rowParent = $(item).closest('.row-parent'),
9014				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
9015				body_border = $('.body-borders .top-border').outerHeight() * 2,
9016				$index_row = $('.index-row', item),
9017				safe_heigth = $index_row.data('safe-height'),
9018				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
9019			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
9020				var data_viewport_h = winHeight - ( paddingRow + body_border );
9021				$uncoltable.css({
9022					'min-height': data_viewport_h
9023				});
9024			} else {
9025				$uncoltable.css({
9026					'min-height': 'auto'
9027				});
9028			}
9029		});
9030
9031	}
9032	setItemsRelHeight();
9033
9034	var $index_scrolls = $('.index-scroll', $el);
9035
9036	$index_scrolls.each(function(key, value){
9037		var $index = $(this),
9038			$parent_row = $index.closest('.vc_row[data-parent]'),
9039			$index_row = $('.index-row', $index),
9040			dir = $index_row.attr('data-direction');
9041		dir = typeof dir === 'undefined' ? 'right' : dir;
9042
9043		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
9044	});
9045
9046	var $horScrolls = $('.unscroll-horizontal', $el);
9047
9048	if ( $horScrolls.length ) {
9049
9050		$('body').addClass('scrolling-trigger');
9051
9052		$horScrolls.each(function(key, value){
9053			var $section = $(this),
9054				$index_scroll = $('.index-scroll', $section),
9055				$index_row = $('.index-row', $index_scroll),
9056				dir = $section.attr('data-direction'),
9057				wrap = $index_row.attr('data-wrap'),
9058				$pinWrap,
9059				$pinTrigger;
9060
9061			dir = typeof dir === 'undefined' ? 'right' : dir;
9062			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
9063			$pinWrap = $('<div class="pin-wrap" />');
9064			if ( SiteParameters.is_frontend_editor ) {
9065				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
9066				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
9067			} else {
9068				if ( wrap === 'column' ) {
9069					$index_scroll.wrapInner( $pinWrap );
9070				} else {
9071					$('> .row', $section).wrap( $pinWrap );
9072				}
9073				$section.wrapInner( $pinTrigger );
9074			}
9075
9076		});
9077
9078		var $pinWraps = $('.pin-wrap', $el);
9079
9080		var horScrollSizes = function(){
9081
9082			$pinWraps.each(function(key, val){
9083				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
9084					$pinTrigger = $pinWrap.closest('.pin-trigger'),
9085					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
9086					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
9087					$boxContainer = $('.box-container'),
9088					box_m = $boxContainer.css('margin-left'),
9089					st_active = true;
9090
9091				var setHorW,
9092				horWidth = function(){
9093					$index_scroll.each(function(){
9094						var $this = $(this),
9095							$index_row = $('.index-row', $this),
9096							$rowContainer = $index_row.closest('.vc_row'),
9097							$rowInner = $index_row.closest('.wpb_row'),
9098							$rowParent = $index_row.closest('.row-parent'),
9099							$tmbs = $('.tmb', $index_row),
9100							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
9101							$uncont = $index_row.closest('.uncont'),
9102							$parent_col = $index_row.closest('.wpb_column'),
9103							col_w = $uncont.width(),
9104							data_lg = parseFloat( $index_row.attr('data-lg') ),
9105							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
9106							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
9107							tmb_w;
9108
9109						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
9110						tmb_w = ( col_w + padding_tmb ) / data_lg;
9111
9112						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
9113							tmb_w = ( col_w + padding_tmb ) / data_sm;
9114						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
9115							tmb_w = ( col_w + padding_tmb ) / data_md;
9116						}
9117
9118						if ( !isNaN(tmb_w) ) {
9119							$tmbs.css({
9120								'width': tmb_w
9121							});
9122						}
9123
9124						$tmbs.css({
9125							'visibility': 'visible'
9126						});
9127
9128					});
9129				};
9130
9131				horWidth();
9132				clearRequestTimeout(setHorW);
9133				setHorW = requestTimeout( function(){
9134					setItemsRelHeight();
9135					horWidth();
9136				}, 100 );
9137
9138				if ( SiteParameters.is_frontend_editor ) {
9139					return;
9140				}
9141
9142				var $vmenu = $('body.vmenu .vmenu-container'),
9143					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
9144					winWidth = window.innerWidth - vmenuW,
9145					$tmb = $('.tmb', $index_scroll).eq(0),
9146					paddingRight = parseFloat( $tmb.css('padding-right') ),
9147					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_scroll.width() + paddingRight ) ),
9148					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
9149					scroll_anim;
9150
9151				if ( $('body').hasClass('rtl') ) {
9152					if ( dir === 'left' ) {
9153						scroll_anim = gsap.fromTo( $pinWrap, {
9154							x: stickyScrollLength
9155						},{
9156							x: 0,
9157							ease: "none"
9158						});
9159					} else {
9160						scroll_anim = gsap.fromTo( $pinWrap, {
9161							x: 0
9162						},{
9163							x: stickyScrollLength,
9164							ease: "none"
9165						});
9166					}
9167				} else {
9168					if ( dir === 'left' ) {
9169						scroll_anim = gsap.fromTo( $pinWrap, {
9170							x: -stickyScrollLength
9171						},{
9172							x: 0,
9173							ease: "none"
9174						});
9175					} else {
9176						scroll_anim = gsap.fromTo( $pinWrap, {
9177							x: 0
9178						},{
9179							x: -stickyScrollLength,
9180							ease: "none"
9181						});
9182					}
9183				}
9184
9185				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
9186					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
9187				}
9188
9189				var animationIncrease;
9190
9191				var checkForAnimations = function(){
9192					animationIncrease = 0
9193					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
9194						var _this = this,
9195							isScrolling;
9196						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
9197							var delayAttr = parseFloat( $(_this).attr('data-delay') );
9198							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
9199							requestTimeout(function() {
9200								$(_this).addClass('start_animation');
9201							}, delayAttr + animationIncrease);
9202							animationIncrease += 150;
9203						}
9204					});
9205				};
9206				checkForAnimations();
9207
9208				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
9209				var start = 0;
9210
9211				var horST = ScrollTrigger.create({
9212					id: "stickySectionScrolling" + key,
9213					scrub: true,
9214					trigger: $pinTrigger[0],
9215					pin: true,
9216					anticipatePin: 1,
9217					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
9218					end: function() { return "+="+stickyScrollLength; },
9219					animation: scroll_anim,
9220					ease: Sine.easeOut,
9221					onUpdate: checkForAnimations,
9222					invalidateOnRefresh: true,
9223					onEnter: function(){
9224						$pinTrigger.addClass('enter-st');
9225					},
9226					onEnterBack: function(){
9227						$pinTrigger.addClass('enter-st');
9228					},
9229					onLeave: function(){
9230						$pinTrigger.removeClass('enter-st');
9231					},
9232					onLeaveBack: function(){
9233						$pinTrigger.removeClass('enter-st');
9234					}
9235				});
9236
9237				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
9238				window.dispatchEvent(new CustomEvent('boxResized'));
9239
9240				var testSecondTrigger = function(){
9241					animationIncrease = 0
9242					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
9243						var _this = this;
9244						if ( checkVisible(_this) ) {
9245							var delayAttr = parseFloat( $(_this).attr('data-delay') );
9246							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
9247							requestTimeout(function() {
9248								$(_this).addClass('start_animation');
9249							}, delayAttr + animationIncrease);
9250							animationIncrease += 150;
9251						}
9252					});
9253
9254				};
9255
9256				var verST = ScrollTrigger.create({
9257					id: "verticalSectionScrolling" + key,
9258					trigger: $pinTrigger[0],
9259					start: "top center",
9260					end: function() { return "+="+UNCODE.wheight; },
9261					onUpdate: testSecondTrigger,
9262					invalidateOnRefresh: true
9263				});
9264
9265				var setCTA,
9266
9267				dis_enable_ST = function(){
9268					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
9269						horST.kill();
9270						verST.kill();
9271						$pinTrigger.addClass('disabled');
9272						st_active = false;
9273					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
9274						horST.kill();
9275						verST.kill();
9276						$pinTrigger.addClass('disabled');
9277						st_active = false;
9278					}
9279				};
9280
9281				$(window).on('resize load', function() {
9282					clearRequestTimeout(setCTA);
9283					setCTA = requestTimeout(function() {
9284						dis_enable_ST();
9285						checkForAnimations();
9286					}, 500);
9287				});
9288
9289			});
9290		};
9291
9292		$(window).on( 'load', function(){
9293			horScrollSizes();
9294		});
9295		var setResize,
9296			doubleResize = true,
9297			oldW = UNCODE.wwidth;
9298		$(window).on( 'resize orientationchange uncode.re-layout', function(){
9299			if ( UNCODE.wwidth < UNCODE.mediaQuery && oldW === UNCODE.wwidth ) {
9300				return;
9301			} else {
9302				oldW = UNCODE.wwidth;
9303			}
9304			setItemsRelHeight(true);
9305			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
9306			Array.prototype.forEach.call($row_inners, function(el) {
9307				el.style.height = '';
9308				el.style.marginBottom = '';
9309			});
9310			clearRequestTimeout(setResize);
9311			setResize = requestTimeout( function(){
9312				setItemsRelHeight();
9313				horScrollSizes();
9314				ScrollTrigger.refresh();
9315				if ( doubleResize === true ) {
9316					window.dispatchEvent(new Event('resize'));
9317					doubleResize = false;
9318				} else {
9319					doubleResize = true;
9320				}
9321				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true);
9322			}, 100 );
9323		});
9324
9325	}
9326
9327};
9328
9329UNCODE.stickyTrigger = function( $el ) {
9330	if ( SiteParameters.is_frontend_editor ) {
9331		return false;
9332	}
9333
9334	var stickyTrigger = function(){
9335		var stickyTrick = $('.sticky-trigger').each(function(){
9336			var $sticky = $(this),
9337				$inside = $('> div', $sticky),
9338				insideH = $inside.outerHeight(),
9339				$row = $sticky.closest('.vc_row'),
9340				$uncont = $sticky.closest('.uncont'),
9341				rowBottom,
9342				uncontBottom ,
9343				diffBottom;
9344
9345			ScrollTrigger.create({
9346				trigger: $sticky,
9347				start: function(){ return "top center-=" + insideH/2; },
9348				endTrigger: $row,
9349				end:  function(){
9350					rowBottom = $row.offset().top + $row.outerHeight();
9351					uncontBottom = $uncont.offset().top + $uncont.outerHeight();
9352					diffBottom = rowBottom - uncontBottom;
9353					return "bottom center+=" + ( insideH/2 + diffBottom );
9354				},
9355				anticipatePin: true,
9356				pin: true,
9357				pinSpacing: false,
9358				scrub: true,
9359				invalidateOnRefresh: true,
9360			});
9361
9362		});
9363	},
9364	setResizeSticky;
9365
9366	$(window).on( 'load', function(){
9367		stickyTrigger();
9368	});
9369	$(window).on( 'resize', function(){
9370		clearRequestTimeout(setResizeSticky);
9371		setResizeSticky = requestTimeout( function(){
9372			stickyTrigger();
9373			ScrollTrigger.refresh();
9374		}, 1000 );
9375	});
9376
9377};
9378
9379UNCODE.revslider = function() {
9380	$(window).on("load", function() {
9381		$('.rev_slider_wrapper, rs-module-wrap').each(function(){
9382			var $this = jQuery(this),
9383			id_array = $this.attr("id").split("_"),
9384			id = id_array[2];
9385			if (id != undefined && id != '') {
9386				$.globalEval('revapi'+id+'.bind("revolution.slide.onloaded",function (e, data) { if (jQuery(e.currentTarget).closest(".header-revslider").length) { var style = jQuery(e.currentTarget).find("li, rs-slide").eq(0).attr("data-skin"), scrolltop = jQuery(document).scrollTop(); if (style != undefined) UNCODE.switchColorsMenu(scrolltop, style);}})');
9387				$.globalEval('revapi'+id+'.bind("revolution.slide.onchange",function (e,data) { if (jQuery(e.currentTarget).closest(".header-revslider").length) { var style = jQuery(e.currentTarget).find("li, rs-slide").eq(data.slideIndex - 1).attr("data-skin"), scrolltop = jQuery(document).scrollTop(); if (style != undefined) UNCODE.switchColorsMenu(scrolltop, style);}})');
9388			}
9389		});
9390	});
9391};
9392
9393UNCODE.layerslider = function() {
9394	$(window).on("load", function() {
9395
9396		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
9397
9398			var slideData = slider.slides.current.data,
9399				scrolltop = $(document).scrollTop();
9400			if( slideData && slideData.skin ) {
9401
9402				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
9403
9404			}
9405		});
9406
9407	});
9408};
9409
9410	UNCODE.init = function() {
9411		var wfl_check = false, wfl_request, waypoint_request;
9412		UNCODE.preventDoubleTransition();
9413		UNCODE.utils();
9414		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
9415			UNCODE.changeSkinOnScroll();
9416		}
9417		if (typeof UNCODE.share !== 'undefined') {
9418			UNCODE.share();
9419		}
9420		if (typeof UNCODE.tooltip !== 'undefined') {
9421			UNCODE.tooltip();
9422		}
9423		if (typeof UNCODE.counters !== 'undefined') {
9424			UNCODE.counters();
9425		}
9426		if (typeof UNCODE.countdowns !== 'undefined') {
9427			UNCODE.countdowns();
9428		}
9429		if (typeof UNCODE.tabs !== 'undefined') {
9430			UNCODE.tabs();
9431		}
9432		if (typeof UNCODE.collapse !== 'undefined') {
9433			UNCODE.collapse();
9434		}
9435		if (typeof UNCODE.bigText !== 'undefined') {
9436			UNCODE.bigText();
9437		}
9438		UNCODE.menuSystem();
9439		if (typeof UNCODE.bgChanger !== 'undefined') {
9440			UNCODE.bgChanger();
9441		}
9442		if (typeof UNCODE.magicCursor !== 'undefined') {
9443			UNCODE.magicCursor();
9444		}
9445		if (typeof UNCODE.magneticCursor !== 'undefined') {
9446			UNCODE.magneticCursor();
9447		}
9448		if (typeof UNCODE.dropImage !== 'undefined') {
9449			UNCODE.dropImage();
9450		}
9451		if (typeof UNCODE.postTable !== 'undefined') {
9452			UNCODE.postTable();
9453		}
9454		if (typeof UNCODE.rotatingTxt !== 'undefined') {
9455			UNCODE.rotatingTxt();
9456		}
9457		if (typeof UNCODE.okvideo !== 'undefined') {
9458			UNCODE.okvideo();
9459		}
9460		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
9461			UNCODE.backgroundSelfVideos();
9462		}
9463		UNCODE.tapHover();
9464		if (typeof UNCODE.isotopeLayout !== 'undefined') {
9465			UNCODE.isotopeLayout();
9466		}
9467		if (typeof UNCODE.justifiedGallery !== 'undefined') {
9468			UNCODE.justifiedGallery();
9469		}
9470		if (typeof UNCODE.cssGrid !== 'undefined') {
9471			UNCODE.cssGrid();
9472		}
9473		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
9474			UNCODE.lightbox();
9475		}
9476		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
9477			$(window).on('load',function(){
9478				UNCODE.lightgallery();
9479			});
9480		}
9481		if (typeof UNCODE.carousel !== 'undefined') {
9482			UNCODE.carousel($('body'));
9483		}
9484		if (typeof UNCODE.lettering !== 'undefined') {
9485			UNCODE.lettering();
9486		}
9487		UNCODE.animations();
9488		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
9489			UNCODE.stickyElements();
9490		}
9491		if (typeof UNCODE.twentytwenty !== 'undefined') {
9492			UNCODE.twentytwenty();
9493		}
9494		UNCODE.disableHoverScroll();
9495		UNCODE.printScreen();
9496		if (typeof UNCODE.particles !== 'undefined') {
9497			UNCODE.particles();
9498		}
9499		if (typeof UNCODE.filters !== 'undefined') {
9500			UNCODE.filters();
9501		}
9502		if (typeof UNCODE.widgets !== 'undefined') {
9503			UNCODE.widgets();
9504		}
9505		if (typeof UNCODE.unmodal !== 'undefined') {
9506			UNCODE.unmodal();
9507		}
9508		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
9509			if ( !UNCODE.isFullPage ) {
9510				UNCODE.checkScrollForTabs();
9511			}
9512		}
9513		if (typeof UNCODE.onePage !== 'undefined') {
9514			UNCODE.onePage(UNCODE.isMobile);
9515		}
9516		if (typeof UNCODE.fullPage !== 'undefined') {
9517			$(document).ready(function(){
9518				UNCODE.fullPage();
9519			});
9520		}
9521		if (typeof UNCODE.skewIt !== 'undefined') {
9522			UNCODE.skewIt();
9523		}
9524		if (typeof UNCODE.rotateIt !== 'undefined') {
9525			UNCODE.rotateIt();
9526		}
9527		if (typeof UNCODE.textMarquee !== 'undefined') {
9528			UNCODE.textMarquee();
9529		}
9530		if (typeof UNCODE.stickyScroll !== 'undefined') {
9531			UNCODE.stickyScroll();
9532		}
9533		if (typeof UNCODE.stickyTrigger !== 'undefined') {
9534			UNCODE.stickyTrigger();
9535		}
9536		if (typeof UNCODE.verticalText !== 'undefined') {
9537			UNCODE.verticalText();
9538		}
9539		if (typeof UNCODE.revslider !== 'undefined') {
9540			UNCODE.revslider();
9541		}
9542		if (typeof UNCODE.layerslider !== 'undefined') {
9543			UNCODE.layerslider();
9544		}
9545		$(window).on('load',function(){
9546			clearRequestTimeout(waypoint_request);
9547			waypoint_request = requestTimeout( function(){
9548				Waypoint.refreshAll();
9549			}, 1000);
9550
9551			if (typeof UNCODE.parallax !== 'undefined') {
9552				UNCODE.parallax();
9553			}
9554		});
9555	}
9556
9557	if ( ! SiteParameters.is_frontend_editor ) {
9558		UNCODE.init();
9559	}
9560
9561
9562})(jQuery);

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.