PageSourceSearch

https://extension.org/wp-content/themes/enfold/js/avia.js?ver=5.7

js extension.org collected 2026-09-24 08:26:24 UTC 58,014 bytes, 1,963 lines download raw bytes

1/**
2 * Polyfill for older browsers https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
3 *
4 * @since 4.8
5 * @return boolean
6 */
7if ( ! Array.isArray )
8{
9	Array.isArray = function( arg )
10	{
11		return Object.prototype.toString.call( arg ) === '[object Array]';
12	};
13}
14
15/**
16 * hack to catch and reroute jQuery custom events (default browser events seem to work even when triggered with jQuery)
17 * As events with '-' cannot be monotored with on.... we rename them to avoid possible conflicts
18 *
19 * https://stackoverflow.com/questions/11132553/how-to-catch-the-jquery-event-trigger
20 * https://stackoverflow.com/questions/36914912/how-to-get-jquery-to-trigger-a-native-custom-event-handler
21 * https://stackoverflow.com/questions/40915156/listen-for-jquery-event-with-vanilla-js
22 *
23 * @since 5.6
24 */
25(function($)
26{
27	"use strict";
28
29	const opt = {
30				'bubbles':		true,
31				'cancelable':	true
32			};
33
34	//	event is always bound to window
35	$( window ).on( 'av-height-change', function( e )
36	{
37		const event = new CustomEvent( 'avia_height_change', opt );
38		window.dispatchEvent( event );
39	});
40
41	//	event is always bound to window
42	$( 'body' ).on( 'av_resize_finished', function( e )
43	{
44		const event = new CustomEvent( 'avia_resize_finished', opt );
45		document.body.dispatchEvent( event );
46	});
47
48})( jQuery );
49
50
51(function($)
52{
53	"use strict";
54
55	$( function()
56	{
57		$.avia_utilities = $.avia_utilities || {};
58
59		AviaBrowserDetection( 'html' );
60		AviaDeviceDetection( 'html' );
61
62		//show scroll top but1ton
63		avia_scroll_top_fade();
64
65		//calculate width of content
66		aviaCalcContentWidth();
67
68		//creates search tooltip
69		new $.AviaTooltip({
70					"class": 'avia-search-tooltip',
71					data: 'avia-search-tooltip',
72					event: 'click',
73					position: 'bottom',
74					scope: "body",
75					attach: 'element',
76					within_screen: true,
77					close_keys: 27
78				});
79
80        //creates relate posts tooltip
81        new $.AviaTooltip({
82					"class": 'avia-related-tooltip',
83					data: 'avia-related-tooltip',
84					scope: ".related_posts, .av-share-box",
85					attach: 'element',
86					delay: 0
87				});
88
89        //creates ajax search
90        new $.AviaAjaxSearch({scope:'#header, .avia_search_element'});
91
92		// actiavte portfolio sorting
93		if( $.fn.avia_iso_sort )
94		{
95			$('.grid-sort-container').avia_iso_sort();
96		}
97
98		// Checks height of content and sidebar and applies shadow class to the higher one
99        AviaSidebarShadowHelper();
100
101        $.avia_utilities.avia_ajax_call();
102
103		// Add single post/portfolio swipe support (in BETA since 5.5)
104		$.avia_utilities.postSwipeSupport();
105    });
106
107	$.avia_utilities = $.avia_utilities || {};
108
109
110	$.avia_utilities.postSwipeSupport = function()
111	{
112		if( ! $.fn.avia_swipe_trigger )
113		{
114			return;
115		}
116
117		const	body = document.getElementsByTagName( 'body' ),
118				methods = {};
119
120		methods.beforeTrigger = function( slider, direction )
121		{
122			const loader = $.avia_utilities.loading();
123			loader.show();
124		};
125
126		methods.afterTrigger = function( slider, direction )
127		{
128			let body = document.getElementsByTagName( 'body' );
129			if( ! body.length )
130			{
131				return;
132			}
133
134			let dir = direction == 'prev' ? 'swiped-ltr' : 'swiped-rtl';
135			body[0].classList.add( 'av-post-swiped-overlay', dir );
136		};
137
138		if( ! body.length || ! body[0].classList.contains( 'avia-post-nav-swipe-enabled' ) )
139		{
140			return;
141		}
142
143		/**
144		 * Add swipe to posts and portfolio
145		 *
146		 * @since 5.5
147		 */
148		let single = document.querySelector( '.single #main' );
149		if( single == null )
150		{
151			return;
152		}
153
154		let prev = document.querySelector( '#wrap_all .avia-post-nav.avia-post-prev' ),
155			next = document.querySelector( '#wrap_all .avia-post-nav.avia-post-next' ),
156			param = {
157					prev: prev,
158					next: next,
159					delay_trigger: true,
160					event: {
161							prev: 'native_click',
162							next: 'native_click'
163						},
164					beforeTrigger: methods.beforeTrigger,
165					afterTrigger: methods.afterTrigger
166				};
167
168		$( single ).avia_swipe_trigger( param );
169	};
170
171	$.avia_utilities.avia_ajax_call = function(container)
172	{
173		if( typeof container == 'undefined' )
174		{
175			container = 'body';
176		};
177
178		$('a.avianolink').on('click', function(e){ e.preventDefault(); });
179        $('a.aviablank').attr('target', '_blank');
180
181        //activates the prettyphoto lightbox
182        if($.fn.avia_activate_lightbox)
183		{
184        	$(container).avia_activate_lightbox();
185        }
186
187        //scrollspy for main menu. must be located before smoothscrolling
188		if( $.fn.avia_scrollspy )
189		{
190			if(container == 'body')
191			{
192				$('body').avia_scrollspy({target:'.main_menu .menu li > a'});
193			}
194			else
195			{
196				$('body').avia_scrollspy('refresh');
197			}
198		}
199
200
201
202		//smooth scrooling
203		if( $.fn.avia_smoothscroll )
204		{
205			$('a[href*="#"]', container).avia_smoothscroll(container);
206		}
207
208		avia_small_fixes(container);
209
210		avia_hover_effect(container);
211
212		avia_iframe_fix(container);
213
214		//activate html5 video player
215		if( $.fn.avia_html5_activation && $.fn.mediaelementplayer )
216		{
217			$(".avia_video, .avia_audio", container).avia_html5_activation({ratio:'16:9'});
218		}
219
220	};
221
222	// -------------------------------------------------------------------------------------------
223	// Error log helper
224	// -------------------------------------------------------------------------------------------
225	$.avia_utilities.log = function( text, type, extra )
226	{
227		if( typeof console == 'undefined' )
228		{
229			return;
230		}
231
232		if( typeof type == 'undefined' )
233		{
234			type = "log";
235		}
236
237		type = "AVIA-" + type.toUpperCase();
238
239		console.log( "["+type+"] "+text );
240
241		if( typeof extra != 'undefined' )
242		{
243			console.log( extra );
244		}
245	};
246
247
248
249	// -------------------------------------------------------------------------------------------
250	// keep track of the browser and content width
251	// -------------------------------------------------------------------------------------------
252
253
254
255	function aviaCalcContentWidth()
256	{
257
258	var win			= $(window),
259		width_select= $('html').is('.html_header_sidebar') ? "#main" : "#header",
260		outer		= $(width_select),
261		outerParent = outer.parents('div').eq( 0 ),
262		the_main	= $(width_select + ' .container').first(),
263		css_block	= "",
264		calc_dimensions = function()
265		{
266			var css			= "",
267				w_12 		= Math.round( the_main.width() ),
268				w_outer		= Math.round( outer.width() ),
269				w_inner		= Math.round( outerParent.width() );
270
271			//css rules for mega menu
272			css += " #header .three.units{width:"	+ ( w_12 * 0.25)+	"px;}";
273			css += " #header .six.units{width:"		+ ( w_12 * 0.50)+	"px;}";
274			css += " #header .nine.units{width:"	+ ( w_12 * 0.75)+	"px;}";
275			css += " #header .twelve.units{width:"	+( w_12 )		+	"px;}";
276
277			//css rules for tab sections
278			css += " .av-framed-box .av-layout-tab-inner .container{width:"	+( w_inner )+	"px;}";
279			css += " .html_header_sidebar .av-layout-tab-inner .container{width:"	+( w_outer )+	"px;}";
280			css += " .boxed .av-layout-tab-inner .container{width:"	+( w_outer )+	"px;}";
281
282			//css rules for submenu container
283			css += " .av-framed-box#top .av-submenu-container{width:"	+( w_inner )+	"px;}";
284
285			//ie8 needs different insert method
286			try{
287				css_block.text(css);
288			}
289			catch(err){
290				css_block.remove();
291				var headFirst = $( 'head' ).first();
292				css_block = $("<style type='text/css' id='av-browser-width-calc'>"+css+"</style>").appendTo( headFirst );
293			}
294
295		};
296
297
298
299		if($('.avia_mega_div').length > 0 || $('.av-layout-tab-inner').length > 0 || $('.av-submenu-container').length > 0)
300		{
301			var headFirst = $( 'head' ).first();
302			css_block = $("<style type='text/css' id='av-browser-width-calc'></style>").appendTo( headFirst );
303			win.on( 'debouncedresize', calc_dimensions);
304			calc_dimensions();
305		}
306	}
307
308
309    // -------------------------------------------------------------------------------------------
310    // Tiny helper for sidebar shadow
311    // -------------------------------------------------------------------------------------------
312
313	function AviaSidebarShadowHelper()
314	{
315		var $sidebar_container = $('.sidebar_shadow#top #main .sidebar');
316		var $content_container = $('.sidebar_shadow .content');
317
318		if( $sidebar_container.height() >= $content_container.height() )
319		{
320			$sidebar_container.addClass('av-enable-shadow');
321		}
322		else
323		{
324			$content_container.addClass('av-enable-shadow');
325		}
326	}
327
328
329	// -------------------------------------------------------------------------------------------
330	// modified SCROLLSPY by bootstrap
331	// -------------------------------------------------------------------------------------------
332
333
334	  function AviaScrollSpy(element, options)
335	  {
336		var self = this;
337
338		var process = self.process.bind( self ),
339			refresh = self.refresh.bind( self ),
340			$element = $(element).is('body') ? $(window) : $(element),
341			href;
342
343		    self.$body = $('body');
344		    self.$win = $(window);
345		    self.options = $.extend({}, $.fn.avia_scrollspy.defaults, options);
346		    self.selector = (self.options.target
347		      || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
348		      || '');
349
350		   	self.activation_true = false;
351
352		    if(self.$body.find(self.selector + "[href*='#']").length)
353		    {
354		    	self.$scrollElement = $element.on('scroll.scroll-spy.data-api', process);
355		    	self.$win.on('av-height-change', refresh);
356		    	self.$body.on('av_resize_finished', refresh);
357		    	self.activation_true = true;
358		    	self.checkFirst();
359
360		    	setTimeout(function()
361	  			{
362		    		self.refresh();
363		    		self.process();
364
365		    	},100);
366		    }
367
368	  }
369
370	  AviaScrollSpy.prototype = {
371
372	      constructor: AviaScrollSpy
373		, checkFirst: function () {
374
375			var current = window.location.href.split('#')[0],
376				matching_link = this.$body.find(this.selector + "[href='"+current+"']").attr('href',current+'#top');
377		}
378	    , refresh: function () {
379
380	    if(!this.activation_true) return;
381
382	        var self = this
383	          , $targets;
384
385	        this.offsets = $([]);
386	        this.targets = $([]);
387
388	        $targets = this.$body
389	          .find(this.selector)
390	          .map(function () {
391	            var $el = $(this)
392	              , href = $el.data('target') || $el.attr('href')
393	              , hash = this.hash
394	              , hash = hash.replace(/\//g, "")
395	              , $href = /^#\w/.test(hash) && $(hash);
396
397				//	$.isWindow deprecated 3.3 https://api.jquery.com/jquery.iswindow/
398				var obj = self.$scrollElement.get(0);
399				var isWindow = obj != null && obj === obj.window;
400
401	            return ( $href
402	              && $href.length
403	              && [[ $href.position().top + ( ! isWindow && self.$scrollElement.scrollTop() ), href ]] ) || null;
404	          })
405	          .sort(function (a, b) { return a[0] - b[0]; })
406	          .each(function () {
407	            self.offsets.push(this[0]);
408	            self.targets.push(this[1]);
409	          });
410
411	      }
412
413	    , process: function () {
414
415	    	if(!this.offsets) return;
416	    	if(isNaN(this.options.offset)) this.options.offset = 0;
417
418	        var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
419	          , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
420	          , maxScroll = scrollHeight - this.$scrollElement.height()
421	          , offsets = this.offsets
422	          , targets = this.targets
423	          , activeTarget = this.activeTarget
424	          , i;
425
426	        if (scrollTop >= maxScroll) {
427	          return activeTarget != (i = targets.last()[0])
428	            && this.activate ( i );
429	        }
430
431	        for (i = offsets.length; i--;) {
432	          activeTarget != targets[i]
433	            && scrollTop >= offsets[i]
434	            && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
435	            && this.activate( targets[i] );
436	        }
437	      }
438
439	    , activate: function (target) {
440	        var active
441	          , selector;
442
443	        this.activeTarget = target;
444
445	        $(this.selector)
446	          .parent('.' + this.options.applyClass)
447	          .removeClass(this.options.applyClass);
448
449	        selector = this.selector
450	          + '[data-target="' + target + '"],'
451	          + this.selector + '[href="' + target + '"]';
452
453
454
455	        active = $(selector)
456	          .parent('li')
457	          .addClass(this.options.applyClass);
458
459	        if (active.parent('.sub-menu').length)  {
460	          active = active.closest('li.dropdown_ul_available').addClass(this.options.applyClass);
461	        }
462
463	        active.trigger('activate');
464	      }
465
466	  };
467
468
469	 /* AviaScrollSpy PLUGIN DEFINITION
470	  * =========================== */
471
472	  $.fn.avia_scrollspy = function (option) {
473	    return this.each(function () {
474	      var $this = $(this)
475	        , data = $this.data('scrollspy')
476	        , options = typeof option == 'object' && option;
477	      if (!data) $this.data('scrollspy', (data = new AviaScrollSpy(this, options)));
478	      if (typeof option == 'string') data[option]();
479	    });
480	  };
481
482	  $.fn.avia_scrollspy.Constructor = AviaScrollSpy;
483
484	  $.fn.avia_scrollspy.calc_offset = function()
485	  {
486		  var 	offset_1 = (parseInt($('.html_header_sticky #main').data('scroll-offset'), 10)) || 0,
487		  		offset_2 = ($(".html_header_sticky:not(.html_top_nav_header) #header_main_alternate").outerHeight()) || 0,
488		  		offset_3 = ($(".html_header_sticky.html_header_unstick_top_disabled #header_meta").outerHeight()) || 0,
489		  		offset_4 =  1,
490		  		offset_5 = parseInt($('html').css('margin-top'),10) || 0,
491		  		offset_6 = parseInt($('.av-frame-top ').outerHeight(),10) || 0;
492
493		  return offset_1 + offset_2 + offset_3 + offset_4 + offset_5 + offset_6;
494	  };
495
496	  $.fn.avia_scrollspy.defaults =
497	  {
498	    offset: $.fn.avia_scrollspy.calc_offset(),
499	    applyClass: 'current-menu-item'
500	  };
501
502
503    // -------------------------------------------------------------------------------------------
504    // detect browser and add class to body
505    // -------------------------------------------------------------------------------------------
506    function AviaBrowserDetection(outputClassElement)
507    {
508	    //code from the old jquery migrate plugin
509	    var current_browser = {},
510
511	    	uaMatch = function( ua )
512			{
513				ua = ua.toLowerCase();
514
515				var match = /(edge)\/([\w.]+)/.exec( ua ) ||
516				/(opr)[\/]([\w.]+)/.exec( ua ) ||
517				/(chrome)[ \/]([\w.]+)/.exec( ua ) ||
518				/(iemobile)[\/]([\w.]+)/.exec( ua ) ||
519				/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) ||
520				/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) ||
521				/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
522				/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
523				/(msie) ([\w.]+)/.exec( ua ) ||
524				ua.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec( ua ) ||
525				ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
526				[];
527
528				return {
529					  browser: match[ 5 ] || match[ 3 ] || match[ 1 ] || "",
530					  version: match[ 2 ] || match[ 4 ] || "0",
531					  versionNumber: match[ 4 ] || match[ 2 ] || "0"
532					};
533			};
534
535		var matched = uaMatch( navigator.userAgent );
536
537		if( matched.browser )
538		{
539			current_browser.browser = matched.browser;
540			current_browser[ matched.browser ] = true;
541			current_browser.version = matched.version;
542		}
543
544		// Chrome is Webkit, but Webkit is also Safari.
545		if ( current_browser.chrome ) {
546			current_browser.webkit = true;
547		} else if ( current_browser.webkit ) {
548			current_browser.safari = true;
549		}
550
551        if(typeof(current_browser) !== 'undefined')
552        {
553            var bodyclass = '',
554				version = current_browser.version ? parseInt(current_browser.version) : "";
555
556            if(current_browser.msie || current_browser.rv || current_browser.iemobile){
557                bodyclass += 'avia-msie';
558            }else if(current_browser.webkit){
559                bodyclass += 'avia-webkit';
560            }else if(current_browser.mozilla){
561                bodyclass += 'avia-mozilla';
562            }
563
564            if(current_browser.version) bodyclass += ' ' + bodyclass + '-' + version + ' ';
565            if(current_browser.browser) bodyclass += ' avia-' + current_browser.browser + ' avia-' +current_browser.browser +'-' + version + ' ';
566        }
567
568        if( outputClassElement )
569		{
570			$(outputClassElement).addClass( bodyclass );
571		}
572
573        return bodyclass;
574    }
575
576	/**
577	 * Detect device features and add a class to body
578	 */
579	function AviaDeviceDetection( outputClassElement )
580	{
581		var classes = [];
582
583		//	https://stackoverflow.com/questions/14439903/how-can-i-detect-device-touch-support-in-javascript
584		$.avia_utilities.isTouchDevice = 'ontouchstart' in window ||
585				window.DocumentTouch && document instanceof window.DocumentTouch ||
586				navigator.maxTouchPoints > 0 ||
587				window.navigator.msMaxTouchPoints > 0;
588
589		classes.push( $.avia_utilities.isTouchDevice ? 'touch-device' : 'no-touch-device' );
590
591		$.avia_utilities.pointerDevices = [];
592
593		//	https://stackdiary.com/detect-mobile-browser-javascript/
594		if( typeof window.matchMedia != 'function' )
595		{
596			$.avia_utilities.pointerDevices.push( 'undefined' );
597			classes.push( 'pointer-device-undefined' );
598		}
599		else
600		{
601			var pointer_fine = false;
602
603			if( window.matchMedia( '(any-pointer: fine)' ) )
604			{
605				classes.push( 'pointer-device-fine' );
606				$.avia_utilities.pointerDevices.push( 'fine' );
607				pointer_fine = true;
608			}
609
610			if( window.matchMedia( '(any-pointer: coarse)' ) )
611			{
612				classes.push( 'pointer-device-coarse' );
613				$.avia_utilities.pointerDevices.push( 'coarse' );
614
615				if( ! pointer_fine )
616				{
617					classes.push( 'pointer-device-coarse-only' );
618				}
619			}
620
621			if( ! $.avia_utilities.pointerDevices.length )
622			{
623				classes.push( 'pointer-device-none' );
624				$.avia_utilities.pointerDevices.push( 'none' );
625			}
626		}
627
628		if( 'undefined' == typeof $.avia_utilities.isMobile )
629		{
630			if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && 'ontouchstart' in document.documentElement)
631			{
632				$.avia_utilities.isMobile = true;
633			}
634			else
635			{
636				$.avia_utilities.isMobile = false;
637			}
638		}
639
640		$( outputClassElement ).addClass( classes.join( ' ') );
641	}
642
643    // -------------------------------------------------------------------------------------------
644	// html 5 videos
645	// -------------------------------------------------------------------------------------------
646    $.fn.avia_html5_activation = function( options )
647	{
648		var defaults =
649		{
650			ratio: '16:9'
651		};
652
653		var options = $.extend( defaults, options );
654
655//			isMobile = $.avia_utilities.isMobile;
656//			if(isMobile) return;
657
658		this.each( function()
659		{
660			var fv = $(this),
661				id_to_apply = '#' + fv.attr('id'),
662				posterImg = fv.attr('poster'),
663				features = [ 'playpause', 'progress', 'current', 'duration', 'tracks', 'volume' ],
664				container = fv.closest( '.avia-video' );
665
666			if( container.length > 0 && container.hasClass( 'av-html5-fullscreen-btn' ) )
667			{
668				features.push( 'fullscreen' );
669			}
670
671			/*
672			 * Hide controls
673			 * https://kriesi.at/support/topic/video-not-appearing-properly-as-color-section-background/#post-1429866
674			 *
675			 * @since 5.6.10
676			 */
677			if( ! $(this).prop('controls') )
678			{
679				features = [];
680			}
681
682			fv.mediaelementplayer(
683			{
684				// if the <video width> is not specified, this is the default
685				defaultVideoWidth: 480,
686				// if the <video height> is not specified, this is the default
687				defaultVideoHeight: 270,
688				// if set, overrides <video width>
689				videoWidth: -1,
690				// if set, overrides <video height>
691				videoHeight: -1,
692				// width of audio player
693				audioWidth: 400,
694				// height of audio player
695				audioHeight: 30,
696				// initial volume when the player starts
697				startVolume: 0.8,
698				// useful for <audio> player loops
699				loop: false,
700				// enables Flash and Silverlight to resize to content size
701				enableAutosize: false,
702				// the order of controls you want on the control bar (and other plugins below)
703				features: features,
704				// Hide controls when playing and mouse is not over the video
705				alwaysShowControls: false,
706				// force iPad's native controls
707				iPadUseNativeControls: false,
708				// force iPhone's native controls
709				iPhoneUseNativeControls: false,
710				// force Android's native controls
711				AndroidUseNativeControls: false,
712				// forces the hour marker (##:00:00)
713				alwaysShowHours: false,
714				// show framecount in timecode (##:00:00:00)
715				showTimecodeFrameCount: false,
716				// used when showTimecodeFrameCount is set to true
717				framesPerSecond: 25,
718				// turns keyboard support on and off for this instance
719				enableKeyboard: true,
720				// when this player starts, it will pause other players
721				pauseOtherPlayers: false,
722				poster: posterImg,
723				success: function( mediaElement, domObject, instance )
724				{
725					//make the medialement instance accesible by storing it. usually not necessary but safari has problems since wp version 4.9
726					$.AviaVideoAPI.players[ fv.attr('id').replace( /_html5/,'' ) ] = instance;
727
728					setTimeout(function()
729					{
730						if( mediaElement.pluginType == 'flash' )
731						{
732							mediaElement.addEventListener('canplay', function() { fv.trigger('av-mediajs-loaded'); }, false);
733						}
734						else
735						{
736							fv.trigger('av-mediajs-loaded').addClass('av-mediajs-loaded');
737						}
738
739						mediaElement.addEventListener('ended', function() {  fv.trigger('av-mediajs-ended'); }, false);
740
741						var html5MediaElement = document.getElementById( $(mediaElement).attr('id') + '_html5' );
742						if( html5MediaElement && html5MediaElement !== mediaElement )
743						{
744							mediaElement.addEventListener( "ended", function()
745							{
746								$( html5MediaElement ).trigger( 'av-mediajs-ended' );
747							});
748						}
749					}, 10 );
750
751				},
752				// fires when a problem is detected
753				error: function()
754				{
755
756				},
757				// array of keyboard commands
758				keyActions: []
759			});
760		});
761	};
762
763	// -------------------------------------------------------------------------------------------
764	// hover effect for images
765	// -------------------------------------------------------------------------------------------
766	function avia_hover_effect( container )
767	{
768		//hover overlay for mobile device doesnt really make sense. in addition it often slows down the click event
769		if( $.avia_utilities.isMobile )
770		{
771			return;
772		}
773
774		if( $('body').hasClass( 'av-disable-avia-hover-effect' ) )
775		{
776			return;
777		}
778
779		var overlay = "",
780			cssTrans = $.avia_utilities.supports('transition'),
781			elements = [];
782
783		if(container == 'body')
784		{
785			elements = $('#main a img').parents('a').not('.noLightbox, .noLightbox a, .avia-gallery-thumb a, .ls-wp-container a, .noHover, .noHover a, .av-logo-container .logo a').add('#main .avia-hover-fx');
786		}
787		else
788		{
789			elements = $('a img', container).parents('a').not('.noLightbox, .noLightbox a, .avia-gallery-thumb a, .ls-wp-container a, .noHover, .noHover a, .av-logo-container .logo a').add('.avia-hover-fx', container);
790		}
791
792		elements.each( function(e)
793		{
794			var link = $(this),
795				current = link.find('img').first();
796
797			if( current.hasClass('alignleft') )
798			{
799				link.addClass('alignleft').css({float:'left', margin:0, padding:0});
800			}
801
802			if( current.hasClass('alignright') )
803			{
804				link.addClass('alignright').css({float:'right', margin:0, padding:0});
805			}
806
807			if( current.hasClass('aligncenter') )
808			{
809				link.addClass('aligncenter').css({float:'none','text-align':'center', margin:0, padding:0});
810			}
811
812			if( current.hasClass('alignnone') )
813			{
814			   link.addClass('alignnone').css({margin:0, padding:0});
815
816			   if( ! link.css('display') || link.css('display') == 'inline' )
817			   {
818				   link.css({display:'inline-block'});
819			   }
820			}
821
822			if( ! link.css('position') || link.css('position') == 'static' )
823			{
824				link.css({position:'relative', overflow:'hidden'});
825			}
826
827			var url		 	= link.attr('href'),
828				span_class	= "overlay-type-video",
829				opa			= link.data('opacity') || 0.7,
830				overlay_offset = 5,
831				overlay 	= link.find('.image-overlay');
832
833			if(url)
834			{
835				if( url.match(/(jpg|gif|jpeg|png|tif)/) )
836				{
837					span_class = "overlay-type-image";
838				}
839
840				if( ! url.match(/(jpg|gif|jpeg|png|\.tif|\.mov|\.swf|vimeo\.com|youtube\.com)/) )
841				{
842					span_class = "overlay-type-extern";
843				}
844			}
845
846			if( ! overlay.length )
847			{
848				overlay = $("<span class='image-overlay "+span_class+"'><span class='image-overlay-inside'></span></span>").appendTo(link);
849			}
850
851			link.on('mouseenter', function(e)
852			{
853				var current = link.find('img').first(),
854					_self	= current.get(0),
855					outerH 	= current.outerHeight(),
856					outerW 	= current.outerWidth(),
857					pos		= current.position(),
858					linkCss = link.css('display'),
859					overlay = link.find('.image-overlay');
860
861				if(outerH > 100)
862				{
863					if(!overlay.length)
864					{
865						overlay = $("<span class='image-overlay "+span_class+"'><span class='image-overlay-inside'></span></span>").appendTo(link);
866
867					}
868
869					//can be wrapped into if !overlay.length statement if chrome fixes fade in problem
870					if(link.height() == 0)
871					{
872						link.addClass(_self.className); _self.className = "";
873					}
874
875					if( ! linkCss || linkCss == 'inline')
876					{
877						link.css({display:'block'});
878					}
879					//end wrap
880
881					overlay.css({left:(pos.left - overlay_offset) + parseInt(current.css("margin-left"),10), top:pos.top + parseInt(current.css("margin-top"),10)})
882						   .css({overflow:'hidden',display:'block','height':outerH,'width':(outerW + (2*overlay_offset))});
883
884					if( cssTrans === false )
885					{
886						overlay.stop().animate({opacity:opa}, 400);
887					}
888				}
889				else
890				{
891					overlay.css({display:"none"});
892				}
893
894			}).on('mouseleave', elements, function()
895			{
896				if(overlay.length)
897				{
898					if(cssTrans === false )
899					{
900						overlay.stop().animate({opacity:0}
900, 400);
901					}
902				}
903			});
904		});
905	}
906
907
908// -------------------------------------------------------------------------------------------
909// Smooth scrooling when clicking on anchor links
910// todo: maybe use https://github.com/ryanburnette/scrollToBySpeed/blob/master/src/scrolltobyspeed.jquery.js in the future
911// -------------------------------------------------------------------------------------------
912
913	(function($)
914	{
915		$.fn.avia_smoothscroll = function( apply_to_container )
916		{
917			if( ! this.length )
918			{
919				return;
920			}
921
922			var the_win = $(window),
923				$header = $('#header'),
924				$main 	= $('.html_header_top.html_header_sticky #main').not('.page-template-template-blank-php #main'),
925				$meta 	= $('.html_header_top.html_header_unstick_top_disabled #header_meta'),
926				$alt  	= $('.html_header_top:not(.html_top_nav_header) #header_main_alternate'),
927				menu_above_logo = $('.html_header_top.html_top_nav_header'),
928				shrink	= $('.html_header_top.html_header_shrinking').length,
929				frame	= $('.av-frame-top'),
930				fixedMainPadding = 0,
931				isMobile = $.avia_utilities.isMobile,
932				sticky_sub = $('.sticky_placeholder').first(),
933				calc_main_padding = function()
934				{
935					if( $header.css('position') == "fixed" )
936					{
937						var tempPadding = parseInt($main.data('scroll-offset'),10) || 0,
938							non_shrinking = parseInt($meta.outerHeight(),10) || 0,
939							non_shrinking2 = parseInt($alt.outerHeight(),10) || 0;
940
941						if( tempPadding > 0 && shrink )
942						{
943							tempPadding = (tempPadding / 2 ) + non_shrinking + non_shrinking2;
944						}
945						else
946						{
947							tempPadding = tempPadding + non_shrinking + non_shrinking2;
948						}
949
950						tempPadding += parseInt($('html').css('margin-top'),10);
951						fixedMainPadding = tempPadding;
952					}
953					else
954					{
955						fixedMainPadding = parseInt($('html').css('margin-top'),10);
956					}
957
958					if( frame.length )
959					{
960						fixedMainPadding += frame.height();
961					}
962
963					if( menu_above_logo.length )
964					{
965						//if menu is above logo and we got a sticky height header
966						fixedMainPadding = $('.html_header_sticky #header_main_alternate').height() + parseInt($('html').css('margin-top'),10);
967					}
968
969					if( isMobile )
970					{
971						fixedMainPadding = 0;
972					}
973
974				};
975
976			if( isMobile )
977			{
978				shrink = false;
979			}
980
981			calc_main_padding();
982			the_win.on( "debouncedresize av-height-change", calc_main_padding );
983
984			var hash = window.location.hash.replace(/\//g, "");
985
986			//if a scroll event occurs at pageload and an anchor is set and a coresponding element exists apply the offset to the event
987			if( fixedMainPadding > 0 && hash && apply_to_container == 'body' && hash.charAt(1) != "!" && hash.indexOf("=") === -1 )
988			{
989				var scroll_to_el = $(hash), modifier = 0;
990
991				if( scroll_to_el.length )
992				{
993					the_win.on('scroll.avia_first_scroll', function()
994					{
995						setTimeout( function()		//small delay so other scripts can perform necessary resizing
996						{
997							if( sticky_sub.length && scroll_to_el.offset().top > sticky_sub.offset().top )
998							{
999								modifier = sticky_sub.outerHeight() - 3;
1000							}
1001
1002							the_win.off( 'scroll.avia_first_scroll' ).scrollTop( scroll_to_el.offset().top - fixedMainPadding - modifier );
1003						},10);
1004				    });
1005			    }
1006			}
1007
1008			return this.each(function()
1009			{
1010				$(this).on('click', function(e)
1011				{
1012					var newHash = this.hash.replace(/\//g, ""),
1013						clicked = $(this),
1014						data = clicked.data(),
1015						ignoreScroll = false,
1016						noScrolInViewport = 'undefined' != typeof data.no_scroll_in_viewport && data.no_scroll_in_viewport == 1,
1017						ignoreHash = 'undefined' != typeof data.ignore_hash && data.ignore_hash == 1;
1018
1019					if( newHash != '' && newHash != '#' && newHash != '#prev' && newHash != '#next' && !clicked.is('.comment-reply-link, #cancel-comment-reply-link, .no-scroll'))
1020					{
1021						var container = "",
1022							originHash = "";
1023
1024						if( '#next-section' == newHash )
1025						{
1026							originHash = newHash;
1027
1028							//	@since 4.8.3 check to scroll to visible sections only (e.g. sections could be hidden on different devices
1029							var next_containers = clicked.parents('.container_wrap').eq( 0 ).nextAll('.container_wrap');
1030							next_containers.each( function()
1031							{
1032							   var cont = $( this );
1033
1034							   if( cont.css( 'display' ) == 'none' || cont.css( 'visibility' ) == 'hidden' )
1035							   {
1036								   return;
1037							   }
1038
1039							   container = cont;
1040							   return false;
1041							});
1042
1043							if( 'object' == typeof container && container.length > 0 )
1044							{
1045								newHash = '#' + container.attr('id') ;
1046							}
1047						}
1048						else
1049						{
1050							 container = $( this.hash.replace(/\//g, "") );
1051						}
1052
1053						//	check if element is already in viewport
1054						if( container.length && noScrolInViewport )
1055						{
1056							const rect = container[0].getBoundingClientRect();
1057
1058							if( rect.top > fixedMainPadding && ( rect.top < (window.innerHeight || document.documentElement.clientHeight) ) )
1059							{
1060								ignoreScroll = true;
1061							}
1062						}
1063
1064						if( container.length && ! ignoreScroll )
1065						{
1066							var cur_offset = the_win.scrollTop(),
1067								container_offset = container.offset().top,
1068								target =  container_offset - fixedMainPadding,
1069								hash = window.location.hash,
1070								hash = hash.replace(/\//g, ""),
1071								oldLocation = window.location.href.replace(hash, ''),
1072								newLocation = this,
1073								duration = data.duration || 1200,
1074								easing = data.easing || 'easeInOutQuint';
1075
1076							if( sticky_sub.length && container_offset > sticky_sub.offset().top )
1077							{
1078								target -= sticky_sub.outerHeight() - 3;
1079							}
1080							if( 'undefined' != typeof data.scroll_top_offset && Number.isInteger( data.scroll_top_offset ) )
1081							{
1082								target -= data.scroll_top_offset;
1083							}
1084
1085							// make sure it's the same location
1086							if( oldLocation + newHash == newLocation || originHash )
1087							{
1088								if( cur_offset != target ) // if current pos and target are the same dont scroll
1089								{
1090									if( ! ( cur_offset == 0 && target <= 0 ) ) // if we are at the top dont try to scroll to top or above
1091									{
1092										the_win.trigger('avia_smooth_scroll_start');
1093
1094										// animate to target and set the hash to the window.location after the animation
1095										$('html:not(:animated),body:not(:animated)').animate({ scrollTop: target }, duration, easing, function()
1096										{
1097											the_win.trigger('avia_smooth_scroll_end');
1098
1099											if( ! ignoreHash )
1100											{
1101												// add new hash to the browser location
1102												//window.location.href=newLocation;
1103												if( window.history.replaceState )
1104												{
1105													window.history.replaceState( "", "", newHash );
1106												}
1107											}
1108										});
1109									}
1110								}
1111
1112								// cancel default click action
1113								e.preventDefault();
1114							}
1115						}
1116					}
1117				});
1118			});
1119		};
1120	})(jQuery);
1121
1122
1123	// -------------------------------------------------------------------------------------------
1124	// iframe fix for firefox and ie so they get proper z index
1125	// -------------------------------------------------------------------------------------------
1126	function avia_iframe_fix(container)
1127	{
1128		var iframe 	= jQuery('iframe[src*="youtube.com"]:not(.av_youtube_frame)', container),
1129			youtubeEmbed = jQuery('iframe[src*="youtube.com"]:not(.av_youtube_frame) object, iframe[src*="youtube.com"]:not(.av_youtube_frame) embed', container).attr('wmode','opaque');
1130
1131			iframe.each(function()
1132			{
1133				var current = jQuery(this),
1134					src 	= current.attr('src');
1135
1136				if(src)
1137				{
1138					if(src.indexOf('?') !== -1)
1139					{
1140						src += "&wmode=opaque&rel=0";
1141					}
1142					else
1143					{
1144						src += "?wmode=opaque&rel=0";
1145					}
1146
1147					current.attr('src', src);
1148				}
1149			});
1150	}
1151
1152	// -------------------------------------------------------------------------------------------
1153	// small js fixes for pixel perfection :)
1154	// -------------------------------------------------------------------------------------------
1155	function avia_small_fixes(container)
1156	{
1157		if(!container) container = document;
1158
1159		//make sure that iframes do resize correctly. uses css padding bottom iframe trick
1160		var win		= jQuery(window),
1161			iframes = jQuery('.avia-iframe-wrap iframe:not(.avia-slideshow iframe):not( iframe.no_resize):not(.avia-video iframe)', container),
1162			adjust_iframes = function()
1163			{
1164				iframes.each(function(){
1165
1166					var iframe = jQuery(this), parent = iframe.parent(), proportions = 56.25;
1167
1168					if(this.width && this.height)
1169					{
1170						proportions = (100/ this.width) * this.height;
1171						parent.css({"padding-bottom":proportions+"%"});
1172					}
1173				});
1174			};
1175
1176			adjust_iframes();
1177
1178	}
1179
1180   function avia_scroll_top_fade()
1181   {
1182   		 var win = $(window),
1183   		 	 timeo = false,
1184   		 	 scroll_top = $('#scroll-top-link'),
1185   		 	 set_status = function()
1186             {
1187             	var st = win.scrollTop();
1188
1189             	if(st < 500)
1190             	{
1191             		scroll_top.removeClass('avia_pop_class');
1192             	}
1193             	else if(!scroll_top.is('.avia_pop_class'))
1194             	{
1195             		scroll_top.addClass('avia_pop_class');
1196             	}
1197             };
1198
1199   		 win.on( 'scroll',  function(){ window.requestAnimationFrame( set_status ); } );
1200         set_status();
1201	}
1202
1203	$.AviaAjaxSearch = function( options )
1204	{
1205		var defaults = {
1206			delay: 300,                //delay in ms until the user stops typing.
1207			minChars: 3,               //dont start searching before we got at least that much characters
1208			scope: 'body'
1209		};
1210
1211		this.options = $.extend({}, defaults, options);
1212		this.scope   = $(this.options.scope);
1213		this.timer   = false;
1214		this.lastVal = "";
1215
1216		this.bind_events();
1217	};
1218
1219	$.AviaAjaxSearch.prototype =
1220    {
1221        bind_events: function()
1222        {
1223            this.scope.on( 'keyup', '#s:not(".av_disable_ajax_search #s")', this.try_search.bind( this ) );
1224            this.scope.on( 'click', '#s.av-results-parked', this.reset.bind( this ) );
1225        },
1226
1227        try_search: function(e)
1228        {
1229            var form = $(e.currentTarget).parents('form').eq( 0 ),
1230                resultscontainer = form.find('.ajax_search_response');
1231
1232            clearTimeout(this.timer);
1233
1234			// clear on ESC
1235            if( e.keyCode === 27 )
1236			{
1237                this.reset(e);
1238				return;
1239			}
1240
1241            //only execute search if chars are at least "minChars" and search differs from last one
1242            if(e.currentTarget.value.length >= this.options.minChars && this.lastVal != e.currentTarget.value.trim() )
1243            {
1244                //wait at least "delay" milliseconds to execute ajax. if user types again during that time dont execute
1245                this.timer = setTimeout( this.do_search.bind( this, e ), this.options.delay );
1246            }
1247            //remove the results container if the input field has been emptied
1248            else if ( e.currentTarget.value.length == 0 )
1249			{
1250                this.timer = setTimeout( this.reset.bind( this, e ), this.options.delay );
1251			}
1252        },
1253
1254		reset: function(e)
1255		{
1256            var form = $(e.currentTarget).parents('form').eq( 0 ),
1257				resultscontainer = form.find('.ajax_search_response'),
1258				alternative_resultscontainer = $(form.attr('data-ajaxcontainer')).find('.ajax_search_response'),
1259				searchInput = $(e.currentTarget);
1260
1261            // bring back results that were hidden when user clicked outside the form element
1262            if ($(e.currentTarget).hasClass('av-results-parked')) {
1263                resultscontainer.show();
1264                alternative_resultscontainer.show();
1265
1266                // in case results container is attached to body
1267                $('body > .ajax_search_response').show();
1268			}
1269			else {
1270                // remove results and delete the input value
1271                resultscontainer.remove();
1272                alternative_resultscontainer.remove();
1273                searchInput.val('');
1274
1275                // in case results container is attached to body
1276                $('body > .ajax_search_response').remove();
1277			}
1278
1279
1280		},
1281
1282        do_search: function(e)
1283        {
1284            var obj = this,
1285                currentField = $(e.currentTarget).attr( "autocomplete", "off" ),
1286				currentFieldWrapper = $(e.currentTarget).parents('.av_searchform_wrapper').eq( 0 ),
1287                currentField_position = currentFieldWrapper.offset(),
1288                currentField_width = currentFieldWrapper.outerWidth(),
1289                currentField_height = currentFieldWrapper.outerHeight(),
1290				form = currentField.parents('form').eq( 0 ),
1291				submitbtn = form.find('#searchsubmit'),
1292                resultscontainer = form,
1293                results = resultscontainer.find('.ajax_search_response'),
1294                loading = $('<div class="ajax_load"><span class="ajax_load_inner"></span></div>'),
1295                action = form.attr('action'),
1296                values = form.serialize(),
1297				elementID = form.data('element_id'),
1298				custom_color = form.data('custom_color');
1299
1300			values += '&action=avia_ajax_search';
1301
1302
1303            // define results div if not found
1304            if( ! results.length )
1305			{
1306                results = $('<div class="ajax_search_response" style="display:none;"></div>');
1307            }
1308
1309			if( 'undefined' != typeof elementID )
1310			{
1311				results.addClass( elementID );
1312			}
1313
1314			if( 'undefined' != typeof custom_color && custom_color != '' )
1315			{
1316				results.addClass( 'av_has_custom_color' );
1317			}
1318
1319            // add class to differentiate betweeen search element and header search
1320			if( form.attr('id') == 'searchform_element')
1321			{
1322				results.addClass('av_searchform_element_results');
1323			}
1324
1325            //check if the form got get parameters applied and also apply them
1326           	if(action.indexOf('?') != -1)
1327           	{
1328           		action  = action.split('?');
1329           		values += "&" + action[1];
1330           	}
1331
1332           	//check if there is a results container defined
1333			if( form.attr('data-ajaxcontainer') )
1334			{
1335                var rescon = form.attr('data-ajaxcontainer');
1336
1337                // check if defined container exists
1338                if ($(rescon).length)
1339				{
1340                	// remove previous search results
1341					$(rescon).find('.ajax_search_response').remove();
1342
1343                    resultscontainer = $(rescon);
1344				}
1345			}
1346
1347			/*
1348			 * For the placement option: "Under the search form - overlay other content",
1349			 * we have to attach the results to the body in order to overlay the other content,
1350			 * and we calculate it's position using the search field
1351			 */
1352
1353            results_css = {};
1354
1355			if( form.hasClass('av_results_container_fixed') )
1356			{
1357				// remove previous search results
1358				$('body').find('.ajax_search_response').remove();
1359
1360				resultscontainer = $('body');
1361
1362				// add class and position to results if defined above
1363				var results_css = {
1364								top: currentField_position.top + currentField_height,
1365								left: currentField_position.left,
1366								width: currentField_width
1367							};
1368
1369				// make sure default stylesheet is applied
1370				results.addClass('main_color');
1371
1372				// remove results and reset if window is resized
1373				$( window ).resize( function()
1374				{
1375					results.remove();
1376					this.reset.bind( this );
1377					currentField.val('');
1378				});
1379			}
1380
1381            // add additional styles - for backwards comp. only. Attribute has been removed in 4.8.7 with header styles
1382            if ( form.attr('data-results_style') )
1383			{
1384                var results_style = JSON.parse(form.attr('data-results_style'));
1385                results_css = Object.assign(results_css, results_style);
1386
1387                // add class if font color is applied, so we can use color: inherit
1388                if( "color" in results_css )
1389				{
1390                    results.addClass('av_has_custom_color');
1391                }
1392            }
1393
1394            // apply inline styles
1395            results.css(results_css);
1396
1397            // add .container class if resultscontainer in a color section
1398			if( resultscontainer.hasClass('avia-section') )
1399			{
1400				results.addClass('container');
1401			}
1402
1403            // append results to defined container
1404            results.appendTo(resultscontainer);
1405
1406
1407			//return if we already hit a no result and user is still typing
1408			if(results.find('.ajax_not_found').length && e.currentTarget.value.indexOf(this.lastVal) != -1)
1409			{
1410				return;
1411			}
1412
1413			this.lastVal = e.currentTarget.value;
1414
1415			$.ajax({
1416				url: avia_framework_globals.ajaxurl,
1417				type: "POST",
1418				data:values,
1419				beforeSend: function()
1420				{
1421					// add loader after submit button
1422					loading.insertAfter(submitbtn);
1423					form.addClass('ajax_loading_now');
1424				},
1425				success: function(response)
1426				{
1427					if(response == 0)
1428					{
1429						response = "";
1430					}
1431
1432					results.html(response).show();
1433				},
1434				complete: function()
1435				{
1436					loading.remove();
1437					form.removeClass('ajax_loading_now');
1438				}
1439			});
1440
1441            // Hide search resuls if user clicks anywhere outside the form element
1442			$(document).on('click',function(e)
1443			{
1444				if(!$(e.target).closest(form).length)
1445				{
1446					if($(results).is(":visible"))
1447					{
1448						$(results).hide();
1449						currentField.addClass('av-results-parked');
1450					}
1451				}
1452			});
1453		}
1454	};
1455
1456
1457	$.AviaTooltip = function( options )
1458	{
1459	   var defaults = {
1460            delay: 1500,                //delay in ms until the tooltip appears
1461            delayOut: 300,             	//delay in ms when instant showing should stop
1462            delayHide: 0,             	//delay hiding of tooltip in ms
1463            "class": "avia-tooltip",   	//tooltip classname for css styling and alignment
1464            scope: "body",             	//area the tooltip should be applied to
1465            data:  "avia-tooltip",     	//data attribute that contains the tooltip text
1466            attach: "body",          	//either attach the tooltip to the "mouse" or to the "element" // todo: implement mouse, make sure that it doesnt overlap with screen borders
1467            event: 'mouseenter',       	//mousenter and leave or click and leave
1468            position: 'top',             //top or bottom
1469            extraClass: 'avia-tooltip-class', //extra class that is defined by a tooltip element data attribute
1470            permanent: false, 			// always display the tooltip?
1471            within_screen: false,		// if the tooltip is displayed outside the screen adjust its position
1472            close_keys: null			// string|[] of keyCodes to close the tooltip (there is no check for empty value !! )
1473        };
1474
1475        this.options = $.extend({}, defaults, options);
1476
1477		var close_keys = '';
1478		if( this.options.close_keys != null )
1479		{
1480			if( ! Array.isArray( this.options.close_keys ) )
1481			{
1482				this.options.close_keys = [ this.options.close_keys ];
1483			}
1484			close_keys = ' data-close-keys="' + this.options.close_keys.join( ',' ) + '" ';
1485		}
1486
1487        this.body    = $('body');
1488        this.scope   = $(this.options.scope);
1489		this.tooltip = $( '<div class="' + this.options['class'] + ' avia-tt"' + close_keys + '><span class="avia-arrow-wrap"><span class="avia-arrow"></span></span></div>' );
1490        this.inner   = $( '<div class="inner_tooltip"></div>').prependTo(this.tooltip);
1491        this.open    = false;
1492        this.timer   = false;
1493        this.active  = false;
1494
1495        this.bind_events();
1496	};
1497
1498	$.AviaTooltip.openTTs = [];
1499	$.AviaTooltip.openTT_Elements = [];
1500
1501    $.AviaTooltip.prototype =
1502    {
1503        bind_events: function()
1504        {
1505	        var perma_tooltips		= '.av-permanent-tooltip [data-'+this.options.data+']',
1506	        	default_tooltips	= '[data-'+this.options.data+']:not( .av-permanent-tooltip [data-'+this.options.data+'])';
1507
1508	        this.scope.on( 'av_permanent_show', perma_tooltips, this.display_tooltip.bind( this ) );
1509	        $(perma_tooltips).addClass('av-perma-tooltip').trigger('av_permanent_show');
1510
1511
1512			this.scope.on( this.options.event + ' mouseleave', default_tooltips, this.start_countdown.bind( this ) );
1513
1514            if(this.options.event != 'click')
1515            {
1516                this.scope.on( 'mouseleave', default_tooltips, this.hide_tooltip.bind( this ) );
1517				this.scope.on( 'click', default_tooltips, this.hide_on_click_tooltip.bind( this ) );
1518            }
1519            else
1520            {
1521                this.body.on( 'mousedown', this.hide_tooltip.bind( this ) );
1522            }
1523
1524			if( this.options.close_keys != null )
1525			{
1526				this.body.on( 'keyup', this.close_on_keyup.bind( this ) );
1527			}
1528        },
1529
1530        start_countdown: function(e)
1531        {
1532            clearTimeout(this.timer);
1533
1534			var target 		= this.options.event == "click" ? e.target : e.currentTarget,
1535            	element 	= $(target);
1536
1537            if( e.type == this.options.event )
1538            {
1539                var delay = this.options.event == 'click' ? 0 : this.open ? 0 : this.options.delay;
1540
1541                this.timer = setTimeout( this.display_tooltip.bind( this, e ), delay );
1542            }
1543            else if( e.type == 'mouseleave' )
1544            {
1545				if( ! element.hasClass( 'av-close-on-click-tooltip' ) )
1546				{
1547					this.timer = setTimeout( this.stop_instant_open.bind( this, e ), this.options.delayOut);
1548				}
1549            }
1550            e.preventDefault();
1551        },
1552
1553        reset_countdown: function(e)
1554        {
1555            clearTimeout( this.timer );
1556            this.timer = false;
1557        },
1558
1559        display_tooltip: function(e)
1560        {
1561            var _self		= this,
1562            	target 		= this.options.event == "click" ? e.target : e.currentTarget,
1563            	element 	= $(target),
1564                text    	= element.data(this.options.data),
1565                tip_index  	= element.data('avia-created-tooltip'),
1566            	extraClass 	= element.data('avia-tooltip-class'),
1567                attach  	= this.options.attach == 'element' ? element : this.body,
1568                offset  	= this.options.attach == 'element' ? element.position() : element.offset(),
1569                position	= element.data('avia-tooltip-position'),
1570                align		= element.data('avia-tooltip-alignment'),
1571                force_append= false,
1572				newTip		= false,
1573				is_new_tip	= false;
1574
1575            text = 'string' == typeof text ? text.trim() : '';
1576
1577            if(element.is('.av-perma-tooltip'))
1578            {
1579	            offset = {top:0, left:0 };
1580	        	attach = element;
1581				force_append = true;
1582            }
1583
1584			if( text == "" )
1585			{
1586				return;
1587			}
1588			if( position == "" || typeof position == 'undefined' )
1589			{
1590				position = this.options.position;
1591			}
1592			if( align == "" || typeof align == 'undefined' )
1593			{
1594				align = 'center';
1595			}
1596
1597			if( typeof tip_index != 'undefined' )
1598			{
1599				newTip = $.AviaTooltip.openTTs[tip_index];
1600			}
1601			else
1602			{
1603				this.inner.html(text);
1604				newTip = this.tooltip.clone();
1605				is_new_tip = true;
1606
1607				if( this.options.attach == 'element' && force_append !== true )
1608				{
1609					newTip.insertAfter(attach);
1610				}
1611				else
1612				{
1613					newTip.appendTo(attach);
1614				}
1615
1616                if(extraClass != "")
1617				{
1618					newTip.addClass(extraClass);
1619				}
1620			}
1621
1622			if( this.open && this.active == newTip )
1623			{
1624				return;
1625			}
1626
1627			if( element.hasClass( 'av-close-on-click-tooltip' ) )
1628			{
1629				this.hide_all_tooltips();
1630			}
1631
1632            this.open = true;
1633            this.active = newTip;
1634
1635            if( ( newTip.is(':animated:visible') && e.type == 'click' ) || element.is( '.' + this.options['class'] ) || element.parents( '.' + this.options['class'] ).length != 0 )
1636			{
1637				return;
1638			}
1639
1640            var animate1 = {},
1641				animate2 = {},
1642				pos1 = "",
1643				pos2 = "";
1644
1645			if( position == "top" || position == "bottom" )
1646			{
1647				switch(align)
1648				{
1649					case "left":
1650						pos2 = offset.left;
1651						break;
1652					case "right":
1653						pos2 = offset.left + element.outerWidth() - newTip.outerWidth();
1654						break;
1655					default:
1656						pos2 = ( offset.left + ( element.outerWidth() / 2 ) ) - ( newTip.outerWidth() / 2 );
1657						break;
1658				}
1659
1660				if(_self.options.within_screen) //used to keep search field inside screen
1661				{
1662					var boundary = element.offset().left + (element.outerWidth() / 2) - (newTip.outerWidth() / 2) + parseInt(newTip.css('margin-left'),10);
1663					if(boundary < 0)
1664					{
1665						pos2 = pos2 - boundary;
1666					}
1667				}
1668			}
1669			else
1670			{
1671				switch(align)
1672				{
1673					case "top":
1674						pos1 = offset.top;
1675						break;
1676					case "bottom":
1677						pos1 = offset.top + element.outerHeight() - newTip.outerHeight();
1678						break;
1679					default:
1680						pos1 = ( offset.top + (element.outerHeight() / 2 ) ) - ( newTip.outerHeight() / 2 );
1681						break;
1682				}
1683			}
1684
1685			switch(position)
1686			{
1687				case "top":
1688					pos1 = offset.top - newTip.outerHeight();
1689					animate1 = {top: pos1 - 10, left: pos2};
1690					animate2 = {top: pos1};
1691					break;
1692				case "bottom":
1693					pos1 = offset.top + element.outerHeight();
1694					animate1 = {top: pos1 + 10, left: pos2};
1695					animate2 = {top: pos1};
1696					break;
1697				case "left":
1698					pos2 = offset.left  - newTip.outerWidth();
1699					animate1 = {top: pos1, left: pos2 -10};
1700					animate2 = {left: pos2};
1701					break;
1702				case "right":
1703					pos2 = offset.left + element.outerWidth();
1704					animate1 = {top: pos1, left: pos2 + 10};
1705					animate2 = {left: pos2};
1706					break;
1707			}
1708
1709			animate1['display'] = "block";
1710			animate1['opacity'] = 0;
1711			animate2['opacity'] = 1;
1712
1713            newTip.css(animate1).stop().animate(animate2,200);
1714
1715            newTip.find('input, textarea').trigger('focus');
1716			if( is_new_tip )
1717			{
1718				$.AviaTooltip.openTTs.push(newTip);
1719				$.AviaTooltip.openTT_Elements.push(element);
1720				element.data('avia-created-tooltip', $.AviaTooltip.openTTs.length - 1);
1721			}
1722        },
1723
1724		hide_on_click_tooltip: function(e)
1725		{
1726			if( this.options.event == "click" )
1727			{
1728				return;
1729			}
1730
1731			var element = $( e.currentTarget );
1732
1733			if( ! element.hasClass('av-close-on-click-tooltip') )
1734			{
1735				return;
1736			}
1737
1738			if( ! element.find( 'a' ) )
1739			{
1740				e.preventDefault();
1741			}
1742
1743			//	Default behaviour when using mouse - click on active tooltip closes it (moving mouse to another tooltip close others automatically
1744			//	On mobile devices or when using touchscreen we show element on click (= old behaviour) and hide when same element
1745			var ttip_index = element.data('avia-created-tooltip');
1746
1747			if( 'undefined' != typeof ttip_index )
1748			{
1749				var current = $.AviaTooltip.openTTs[ttip_index];
1750				if( 'undefined' != typeof current && current == this.active )
1751				{
1752					this.hide_all_tooltips();
1753				}
1754			}
1755
1756		},
1757
1758		close_on_keyup: function( e )
1759		{
1760			if( this.options.close_keys == null )
1761			{
1762				return;
1763			}
1764
1765			if( $.inArray( e.keyCode, this.options.close_keys ) < 0 )
1766			{
1767				return;
1768			}
1769
1770			this.hide_all_tooltips( e.keyCode );
1771		},
1772
1773		hide_all_tooltips: function( keyCode )
1774		{
1775			var ttip,
1776				position,
1777				element,
1778				keyCodeCheck = 'undefined' != typeof keyCode ? keyCode + '' : null;
1779
1780			for( var index = 0; index < $.AviaTooltip.openTTs.length; ++index )
1781			{
1782				ttip = $.AviaTooltip.openTTs[index];
1783				element = $.AviaTooltip.openTT_Elements[index];
1784				position = element.data('avia-tooltip-position');
1785
1786				//	check if tooltip can be closed on keyup
1787				if( keyCodeCheck != null )
1788				{
1789					var keys = ttip.data( 'close-keys' );
1790					if( 'undefined' == typeof keys )
1791					{
1792						continue;
1793					}
1794
1795					keys = keys + '';
1796					keys = keys.split( ',' );
1797					if( $.inArray( keyCodeCheck, keys ) < 0 )
1798					{
1799						continue;
1800					}
1801				}
1802
1803				this.animate_hide_tooltip( ttip, position );
1804			}
1805
1806			this.open = false;
1807			this.active  = false;
1808		},
1809
1810        hide_tooltip: function(e)
1811        {
1812            var element 	= $(e.currentTarget) , newTip, animateTo,
1813            	position	= element.data('avia-tooltip-position'),
1814                align		= element.data('avia-tooltip-alignment'),
1815				newTip		= false;
1816
1817            if( position == "" || typeof position == 'undefined' )
1818			{
1819				position = this.options.position;
1820			}
1821
1822			if( align == "" || typeof align == 'undefined' )
1823			{
1824				align = 'center';
1825			}
1826
1827            if( this.options.event == 'click' )
1828            {
1829                element = $(e.target);
1830
1831                if( ! element.is( '.' + this.options['class'] ) && element.parents( '.' + this.options['class'] ).length == 0 )
1832                {
1833                    if( this.active.length )
1834					{
1835						newTip = this.active;
1836						this.active = false;
1837					}
1838                }
1839            }
1840            else
1841            {
1842				if( ! element.hasClass( 'av-close-on-click-tooltip' ) )
1843				{
1844					newTip = element.data('avia-created-tooltip');
1845					newTip = typeof newTip != 'undefined' ? $.AviaTooltip.openTTs[newTip] : false;
1846				}
1847            }
1848
1849            this.animate_hide_tooltip( newTip, position );
1850        },
1851
1852		animate_hide_tooltip: function( ttip, position )
1853		{
1854			if(ttip)
1855            {
1856            	var animate = {opacity:0};
1857
1858            	switch(position)
1859            	{
1860            		case "top":
1861						animate['top'] = parseInt(ttip.css('top'),10) - 10;
1862						break;
1863					case "bottom":
1864						animate['top'] = parseInt(ttip.css('top'),10) + 10;
1865						break;
1866					case "left":
1867						animate['left'] = parseInt(ttip.css('left'), 10) - 10;
1868						break;
1869					case "right":
1870						animate['left'] = parseInt(ttip.css('left'), 10) + 10;
1871						break;
1872            	}
1873
1874                ttip.animate( animate, 200, function()
1875                {
1876                    ttip.css({display:'none'});
1877                });
1878			}
1879		},
1880
1881        stop_instant_open: function(e)
1882        {
1883            this.open = false;
1884        }
1885    };
1886
1887})( jQuery );
1888
1889
1890(function($)
1891{
1892	"use strict";
1893
1894	$( function()
1895	{
1896		/**
1897		 * Performance fix to pass pagespeed test
1898		 *
1899		 * https://stackoverflow.com/questions/60357083/does-not-use-passive-listeners-to-improve-scrolling-performance-lighthouse-repo#62177358
1900		 * @since 5.4
1901		 */
1902		$.event.special.touchstart = {
1903							setup: function( _, ns, handle )
1904							{
1905								this.addEventListener( "touchstart", handle, { passive: !ns.includes("noPreventDefault") } );
1906							}
1907						};
1908
1909		$.event.special.touchmove = {
1910							setup: function( _, ns, handle )
1911							{
1912								this.addEventListener( "touchmove", handle, { passive: !ns.includes("noPreventDefault") } );
1913							}
1914						};
1915
1916		$.event.special.wheel = {
1917							setup: function( _, ns, handle )
1918							{
1919								this.addEventListener( "wheel", handle, { passive: true } );
1920							}
1921						};
1922
1923		$.event.special.mousewheel = {
1924							setup: function( _, ns, handle )
1925							{
1926								this.addEventListener( "mousewheel", handle, { passive: true } );
1927							}
1928						};
1929
1930	});
1931
1932})( jQuery );
1933
1934
1935/**
1936 * Waypoints - 4.0.2
1937 * Copyright © 2011-2016 Caleb Troughton (up to 4.0.1)
1938 * Licensed under the MIT license.
1939 * https://github.com/imakewebthings/waypoints/blob/master/licenses.txt
1940 *
1941 * @since 5.2   moved to own folder /waypoints
1942 */
1943
1944
1945// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ + http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
1946// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel. can be removed if IE9 is no longer supported or all parallax scripts are gone
1947// MIT license
1948(function(){var lastTime=0;var vendors=['ms','moz','webkit','o'];for(var x=0;x<vendors.length&&!window.requestAnimationFrame;++x){window.requestAnimationFrame=window[vendors[x]+'RequestAnimationFrame'];window.cancelAnimationFrame=window[vendors[x]+'CancelAnimationFrame']||window[vendors[x]+'CancelRequestAnimationFrame']}if(!window.requestAnimationFrame)window.requestAnimationFrame=function(callback,element){var currTime=new Date().getTime();var timeToCall=Math.max(0,16-(currTime-lastTime));var id=window.setTimeout(function(){callback(currTime+timeToCall)},timeToCall);lastTime=currTime+timeToCall;return id};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=function(id){clearTimeout(id)}}());
1949
1950jQuery.expr.pseudos.regex = function(elem, index, match)
1951{
1952    var matchParams = match[3].split(','),
1953        validLabels = /^(data|css):/,
1954        attr = {
1955            method: matchParams[0].match(validLabels) ? matchParams[0].split(':')[0] : 'attr',
1956            property: matchParams.shift().replace(validLabels,'')
1957        },
1958        regexFlags = 'ig',
1959        regex = new RegExp(matchParams.join('').replace(/^\s+|\s+$/g,''), regexFlags);
1960
1961    return regex.test(jQuery(elem)[attr.method](attr.property));
1962};
1963

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.