PageSourceSearch

https://notesfromthedigitalunderground.net/wp-content/themes/enfold/js/avia.js?ver=4.9.2.3

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

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.