PageSourceSearch

https://eastspencer.gov/wp-content/themes/HighendWP/assets/js/jquery.custom.js?ver=4.4.3

js eastspencer.gov collected 2026-10-04 13:27:07 UTC 79,695 bytes, 2,920 lines download raw bytes

1var _gsScope = 'undefined' != typeof module && module.exports && 'undefined' != typeof global ? global : this || window;
2(_gsScope._gsQueue || (_gsScope._gsQueue = [])).push(function () {
3	'use strict';
4	var t = document.documentElement,
5		e = window,
6		i = function (i, s) {
7			var r = 'x' === s ? 'Width' : 'Height',
8				n = 'scroll' + r,
9				o = 'client' + r,
10				a = document.body;
11			return i === e || i === t || i === a ? Math.max(t[n], a[n]) - (e['inner' + r] || Math.max(t[o], a[o])) : i[n] - i['offset' + r];
12		},
13		s = _gsScope._gsDefine.plugin({
14			propName: 'scrollTo',
15			API: 2,
16			version: '1.7.4',
17			init: function (t, s, r) {
18				return (
19					(this._wdw = t === e),
20					(this._target = t),
21					(this._tween = r),
22					'object' != typeof s && (s = { y: s }),
23					(this.vars = s),
24					(this._autoKill = s.autoKill !== !1),
25					(this.x = this.xPrev = this.getX()),
26					(this.y = this.yPrev = this.getY()),
27					null != s.x
28						? (this._addTween(this, 'x', this.x, 'max' === s.x ? i(t, 'x') : s.x, 'scrollTo_x', !0), this._overwriteProps.push('scrollTo_x'))
29						: (this.skipX = !0),
30					null != s.y
31						? (this._addTween(this, 'y', this.y, 'max' === s.y ? i(t, 'y') : s.y, 'scrollTo_y', !0), this._overwriteProps.push('scrollTo_y'))
32						: (this.skipY = !0),
33					!0
34				);
35			},
36			set: function (t) {
37				this._super.setRatio.call(this, t);
38				var s = this._wdw || !this.skipX ? this.getX() : this.xPrev,
39					r = this._wdw || !this.skipY ? this.getY() : this.yPrev,
40					n = r - this.yPrev,
41					o = s - this.xPrev;
42				this._autoKill &&
43					(!this.skipX && (o > 7 || -7 > o) && i(this._target, 'x') > s && (this.skipX = !0),
44					!this.skipY && (n > 7 || -7 > n) && i(this._target, 'y') > r && (this.skipY = !0),
45					this.skipX &&
46						this.skipY &&
47						(this._tween.kill(),
48						this.vars.onAutoKill && this.vars.onAutoKill.apply(this.vars.onAutoKillScope || this._tween, this.vars.onAutoKillParams || []))),
49					this._wdw
50						? e.scrollTo(this.skipX ? s : this.x, this.skipY ? r : this.y)
51						: (this.skipY || (this._target.scrollTop = this.y), this.skipX || (this._target.scrollLeft = this.x)),
52					(this.xPrev = this.x),
53					(this.yPrev = this.y);
54			},
55		}),
56		r = s.prototype;
57	(s.max = i),
58		(r.getX = function () {
59			return this._wdw ? (null != e.pageXOffset ? e.pageXOffset : null != t.scrollLeft ? t.scrollLeft : document.body.scrollLeft) : this._target.scrollLeft;
60		}),
61		(r.getY = function () {
62			return this._wdw ? (null != e.pageYOffset ? e.pageYOffset : null != t.scrollTop ? t.scrollTop : document.body.scrollTop) : this._target.scrollTop;
63		}),
64		(r._kill = function (t) {
65			return t.scrollTo_x && (this.skipX = !0), t.scrollTo_y && (this.skipY = !0), this._super._kill.call(this, t);
66		});
67}),
68	_gsScope._gsDefine && _gsScope._gsQueue.pop()();
69
70var $j = jQuery.noConflict();
71var search_in_menu = 0;
72var $body = $j('body');
73var $main_wrapper = $j('#main-wrapper');
74var $doc = $j(document);
75var $wind = $j(window);
76var hb_open_flag = 0;
77var $is_fullpage = $j('#fullpage').length ? true : false;
78var $preloader = $j('#hb-preloader').length;
79
80var main_wrapper = document.getElementById('main-wrapper');
81
82var is_safari = false;
83if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
84	is_safari = true;
85}
86if ($body.hasClass('page-id-323')) {
87	is_safari = true;
88}
89
90var hb_js = function () {
91	hb_hide_preloader_after_s();
92	hb_is_mobile();
93	hb_menu_init();
94	hb_menu_search();
95	hb_init_tooltip();
96	hb_max_height_fixes();
97	hb_header_dropdown();
98	hb_scroll_top_init();
99	hb_fit_video();
100	hb_anim_content();
101	hb_pagination_ajax();
102	hb_masonry();
103	hb_to_top_click();
104	hb_side_nav_handler();
105	hb_modern_search();
106	hb_fancy_search();
107	hb_click_forms();
108	hb_like_init();
109	hb_mini_contact_form();
110	// hb_header_effect();
111	hb_validations();
112	hb_fixed_footer_init();
113	hb_ajax_search();
114	hb_init_lightbox();
115	hb_single_blog_scripts();
116	hb_init_shortcodes();
117	hb_counter();
118	hb_charts();
119	hb_progress_bar();
120	hb_contact_forms();
121	hb_contact_forms_spec();
122	hb_animated_contents_ready();
123	hb_woo_stuff();
124	hb_count_gallery_filters();
125	hb_faq_filter();
126	hb_delayed_mh();
127	hb_smooth_scroll();
128	hb_fullwidth_page();
129	hb_fullscreen_image();
130
131	highendStickyHeader();
132	highendOnePageNav();
133};
134
135// Window load
136window.addEventListener('load', function () {
137	hb_hide_preloader();
138	hb_init_standard_gallery();
139	hb_init_fw_gallery();
140	hb_modal_on_load();
141	hb_max_height_fixes();
142	hb_parallax_init();
143	hb_center_vertically();
144	hb_center_me();
145});
146
147// DOM ready
148document.addEventListener('DOMContentLoaded', function () {
149	'use strict';
150	window.hb_js();
151});
152
153window.addEventListener('scroll', function () {
154	highendDebounce(hb_animated_contents());
155	highendDebounce(hb_counter());
156	highendDebounce(hb_charts());
157	highendDebounce(hb_progress_bar());
158});
159
160window.addEventListener('resize', function () {
161	if (is_responsive()) {
162		highendDebounce(hb_center_me());
163		highendDebounce(hb_center_vertically());
164		highendDebounce(hb_fixed_footer_init());
165		highendDebounce(hb_max_height_fixes());
166		highendDebounce(hb_fullscreen_image());
167		highendDebounce(hb_parallax_init());
168	}
169});
170
171/*************************** Functions ***************************/
172
173/**
174 * Debounce functions for better performance
175 * (c) 2018 Chris Ferdinandi, MIT License, https://gomakethings.com
176 *
177 * @since 1.0.0
178 *
179 * @param  {Function} fn The function to debounce
180 */
181function highendDebounce(fn) {
182	// Setup a timer
183	var timeout;
184
185	// Return a function to run debounced
186	return function () {
187		// Setup the arguments
188		var context = this;
189		var args = arguments;
190
191		// If there's a timer, cancel it
192		if (timeout) {
193			window.cancelAnimationFrame(timeout);
194		}
195
196		// Setup the new requestAnimationFrame()
197		timeout = window.requestAnimationFrame(function () {
198			fn.apply(this, args);
199		});
200	};
201}
202
203/* Hide Preloader after 5 seconds */
204function hb_hide_preloader_after_s() {
205	if ($preloader) {
206		setTimeout(function () {
207			if (!$j('#hb-preloader').hasClass('ajax-like-initiated')) {
208				$j('#hb-preloader').css('opacity', 0);
209				$j('#hb-preloader').hide();
210				hb_animated_contents();
211			}
212		}, 5000);
213	}
214}
215
216/* Hide Preloader */
217function hb_hide_preloader() {
218	$j('#hb-preloader').css('opacity', 0);
219	setTimeout(function () {
220		$j('#hb-preloader').hide();
221		hb_animated_contents();
222	}, 600);
223}
224
225/* Check if mobile device */
226function hb_is_mobile() {
227	if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
228		$body.addClass('mobile mobile-device');
229	}
230}
231
232/* Check if responsive is enabled */
233function is_responsive() {
234	if (highend_vars.responsive) {
235		return true;
236	}
237
238	return false;
239}
240
241/* Check if element exists */
242jQuery.exists = function (selector) {
243	return $j(selector).length > 0;
244};
245
246/* Tooltip Init */
247function hb_init_tooltip() {
248	$body.tooltip({ selector: '[rel=tooltip]' });
249}
250
251/* Animations document is loaded */
252function hb_animated_contents_ready() {
253	if (!$preloader) {
254		hb_animated_contents();
255	}
256}
257
258/* Animations when element is visible */
259function hb_animated_contents() {
260	if ($j.exists('.hb-animate-element') && $j.inviewport && !$body.hasClass('mobile') && !$is_fullpage) {
261		$j('.hb-animate-element:in-viewport').each(function (e) {
262			hb_animation_in_viewport($j(this));
263		});
264	}
265}
266
267function hb_animation_in_viewport($element) {
268	if ($element.hasClass('hb-in-viewport')) {
269		return;
270	}
271
272	var delay = $element.attr('data-delay');
273
274	if (typeof delay == 'undefined' || delay == '') {
275		delay = 80;
276	}
277
278	delay = parseInt(delay);
279
280	setTimeout(function () {
281		$element.addClass('hb-in-viewport');
282	}, delay);
283}
284
285/* Check if is touch device */
286function is_touch_device() {
287	return !!('ontouchstart' in window) || !!('onmsgesturechange' in window);
288}
289
290/* FitVids initialization */
291function hb_fit_video() {
292	$j('.fitVids, #pp_full_res').fitVids();
293}
294
295/* SuperFish initialization */
296function hb_menu_init() {
297	$j('.sf-menu').superfish({
298		delay: 50,
299		speed: 200,
300		speedOut: 100,
301		autoArrows: true,
302		disableHI: true,
303		animation: { opacity: 'show' },
304		easing: 'easeOutQuad',
305	});
306
307	// Sub Indicators for the dropdown
308	if ($j('#main-nav').length && !$j('#main-nav').hasClass('sf-subbed')) {
309		$j('#main-nav li').each(function () {
310			$j(this).parent().addClass('sf-subbed');
311			if ($j(this).find('> ul').length > 0) {
312				$j(this).addClass('has-ul');
313				$j(this).find('> a').append('<i class="icon-angle-right sf-sub-indicator"></i>');
314			}
315		});
316	}
317
318	// Move current language to the top
319	if ($j('.language-selector').length) {
320		var lang = $j('.language-selector').find('.active-language .icl_lang_sel_native').html();
321		var lang_img = $j('.language-selector').find('.active-language .lang-img').html();
322
323		if (lang !== '') {
324			$j('#hb-current-lang .lang-val').html(lang);
325			$j('#hb-current-lang .active-lang-img').html(lang_img);
326		}
327	}
328
329	if ($j('#mobile-menu').length && $j('#mobile-menu').hasClass('interactive')) {
330		$j('#mobile-menu > div > .menu-main-menu-container > li').each(function () {
331			if ($j(this).find('ul').length) {
332				$j(this).append('<span class="open-submenu"><i class="icon-angle-down"></i></span>');
333			}
334		});
335
336		$j('.open-submenu').on('click', function (e) {
337			if ($j(this).hasClass('active')) {
338				$j(this).find('i').attr('class', 'icon-angle-down');
339				$j(this).parent().find('ul').css('display', 'none');
340				$j(this).removeClass('active');
341			} else {
342				$j(this).addClass('active');
343				$j(this).find('i').attr('class', 'icon-angle-up');
344				$j(this).parent().find('ul').css('display', 'block');
345			}
346		});
347	}
348
349	// Mobile Menu
350	function show_mobile_menu() {
351		$body.addClass('mobile-menu-open');
352
353		setTimeout(function () {
354			$main_wrapper.on('click', clear_mobile_menu);
355		}, 500);
356
357		// Disable Scrolling Presentation scrolling
358		if ($j('#fullpage').length) {
359			$j.fn.fullpage.setAllowScrolling(false);
360		}
361	}
362
363	$j('#show-nav-menu, .mobile-menu-close').on('touchstart click', function (e) {
364		e.preventDefault();
365		if ($body.hasClass('mobile-menu-open')) {
366			hide_mobile_menu();
367		} else {
368			show_mobile_menu();
369		}
370	});
371
372	$j('#mobile-menu li a').on('click', hide_mobile_menu);
373
374	function hide_mobile_menu() {
375		$body.removeClass('mobile-menu-open');
376		$main_wrapper.off('click', clear_mobile_menu);
377
378		// Allow Scrolling Presentation scrolling again
379		if ($j('#fullpage').length) {
380			$j.fn.fullpage.setAllowScrolling(true);
381		}
382	}
383
384	function clear_mobile_menu() {
385		$body.removeClass('mobile-menu-open');
386		hide_mobile_menu();
387	}
388}
389
390function hb_fullwidth_page() {
391	if ($j('#fullpage').length) {
392		section_names = new Array();
393		$light_logo_length = $j('.hb-light-logo').length;
394		$is_special_header = $body.hasClass('hb-special-header-style');
395
396		$j('.section').each(function () {
397			section_names.push($j(this).attr('data-id'));
398		});
399
400		$j('#fullpage').fullpage({
401			sectionsColor: [],
402			anchors: section_names,
403			navigation: true,
404			navigationPosition: 'right',
405			navigationTooltips: [],
406			menu: '#menu',
407			resize: false,
408			loopTop: false,
409			loopBottom: false,
410			scrollingSpeed: 600,
411			verticalCentered: true,
412			easing: 'easeInOutQuad',
413			autoScrolling: true,
414			scrollOverflow: true,
415			css3: true,
416
417			onLeave: function (index, nextIndex, direction) {
418				var i = nextIndex - 1;
419				var style = $j('#fullpage .section').eq(i).attr('data-nav-color');
420
421				if (style == 'dark') {
422					$j('#fp-nav').addClass('dark-skin');
423
424					if ($is_special_header) {
425						$j('#header-inner-bg').addClass('dark-skin');
426						$j('.hb-visible-logo').removeClass('hb-visible-logo');
427						$j('.hb-dark-logo').addClass('hb-visible-logo');
428					}
429				} else {
430					$j('#fp-nav').removeClass('dark-skin');
431
432					if ($is_special_header) {
433						$j('#header-inner-bg').removeClass('dark-skin');
434						$j('.hb-visible-logo').removeClass('hb-visible-logo');
435						$j('.hb-light-logo').addClass('hb-visible-logo');
436					}
437				}
438
439				$j('#fullpage .section').eq(i).addClass('lazy-loaded');
440			},
441			afterLoad: function (anchorLink, index) {
442				console.log(index);
443				$j('#fullpage .section')
444					.eq(index - 1)
445					.addClass('lazy-loaded');
446				var pb = $j('#fullpage .section')
447					.eq(index - 1)
448					.find('.hb-button.primary');
449				var sb = $j('#fullpage .section')
450					.eq(index - 1)
451					.find('.hb-button.secondary');
452				var ti = $j('#fullpage .section')
453					.eq(index - 1)
454					.find('h2');
455				var pa = $j('#fullpage .section')
456					.eq(index - 1)
457					.find('p');
458
459				var elements = new Array();
460				elements.push(pb);
461				elements.push(sb);
462				elements.push(ti);
463				elements.push(pa);
464
465				$j.each(elements, function (index, val) {
466					hb_animation_in_viewport($j(this));
467				});
468			},
469			afterRender: function () {
470				if ($j('video').length) {
471					$j('video').get(0).play();
472				}
473
474				var i = 0;
475				var style = $j('#fullpage .section').eq(i).attr('data-nav-color');
476
477				if (style == 'dark') {
478					$j('#fp-nav').addClass('dark-skin');
479
480					if ($is_special_header) {
481						$j('#header-inner-bg').addClass('dark-skin');
482						$j('.hb-visible-logo').removeClass('hb-visible-logo');
483						$j('.hb-dark-logo').addClass('hb-visible-logo');
484					}
485				} else {
486					$j('#fp-nav').removeClass('dark-skin');
487
488					if ($is_special_header) {
489						$j('#header-inner-bg').removeClass('dark-skin');
490						$j('.hb-visible-logo').removeClass('hb-visible-logo');
491						$j('.hb-light-logo').addClass('hb-visible-logo');
492					}
493				}
494
495				var pb = $j('#fullpage .section').eq(0).find('.hb-button.primary');
496				var sb = $j('#fullpage .section').eq(0).find('.hb-button.secondary');
497				var ti = $j('#fullpage .section').eq(0).find('h2');
498				var pa = $j('#fullpage .section').eq(0).find('p');
499
500				var elements = new Array();
501				elements.push(pb);
502				elements.push(sb);
503				elements.push(ti);
504				elements.push(pa);
505
506				$j.each(elements, function (index, val) {
507					hb_animation_in_viewport($j(this));
508				});
509			},
510		});
511	}
512}
513
514/* Make Elements to have equal heights */
515function hb_max_height_fixes() {
516	// Max Height MegaMenu
517	var max;
518	/*if ( $j('.main-navigation .megamenu').length && $wind.width() > 900 ){
519		var element;
520		var first_ul;
521		var $mega_lis;
522
523		$j('.main-navigation .megamenu').each(function() {
524			element = $j(this);
525			first_ul = element.find(">ul").css("display", "block");
526			$mega_lis = first_ul.find('>li');
527			$mega_lis.css("height", "auto");
528			max = Math.max.apply(Math, $mega_lis.map(function() { return $j(this).outerHeight(); }));
529			$mega_lis.css("height", max);
530			first_ul.css("display", "none");
531		});
532	}*/
533
534	if ($j('.hb-same-height').length && $wind.width() > 767) {
535		$j('.hb-same-height').each(function () {
536			var $cols = $j(this).find('.wpb_column');
537			$cols.css('height', 'auto');
538			max = Math.max.apply(
539				Math,
540				$cols.map(function () {
541					return $j(this).outerHeight();
542				})
543			);
544			$cols.css('height', max);
545		});
546	} else if ($wind.width() < 767) {
547		$j('.hb-same-height .wpb_column').css('height', 'auto');
548	}
549
550	$j('.wpcf7-submit').on('touchstart click', function (e) {
551		setTimeout(function () {
552			$wind.trigger('resize');
553		}, 500);
554		setTimeout(function () {
555			$wind.trigger('resize');
556		}, 1000);
557		setTimeout(function () {
558			$wind.trigger('resize');
559		}, 1500);
560	});
561
562	if ($j('.hb-flipbox-container').length) {
563		$j('.hb-flipbox-container').each(function () {
564			var front_height = $j(this).find('.hb-flipbox-front .hb-flipbox-content').outerHeight();
565			var back_height = $j(this).find('.hb-flipbox-back .hb-flipbox-content').outerHeight();
566			var min_height = Math.max(front_height, back_height);
567			$j(this).css('min-height', min_height);
568		});
569	}
570}
571
572/* Delayed Max height fix */
573function hb_dmh() {
574	if ($j('.hb-same-height').length && $wind.width() > 767) {
575		$j('.hb-same-height').each(function () {
576			var $cols = $j(this).find('.hb-column');
577			$cols.css('height', 'auto');
578			max = Math.max.apply(
579				Math,
580				$cols.map(function () {
581					return $j(this).outerHeight();
582				})
583			);
584			$cols.css('height', max);
585		});
586	} else if ($wind.width() < 767) {
587		$j('.hb-same-height .hb-column').css('height', 'auto');
588	}
589
590	hb_fixed_footer_init();
591}
592
593// Delayed Max Height
594function hb_delayed_mh() {
595	setTimeout(function () {
596		hb_dmh();
597	}, 2000);
598	setTimeout(function () {
599		hb_dmh();
600	}, 4000);
601	setTimeout(function () {
602		hb_dmh();
603	}, 8000);
604}
605
606/* Show dropdown menu on hover */
607function hb_header_dropdown() {
608	var $current;
609	var $dropdown;
610
611	$body
612		.on('mouseenter', '.top-widget, .share-holder', function () {
613			$dropdown = $j(this).find('.hb-dropdown-box');
614			if ($dropdown.hasClass('dropdown-visible')) {
615				$dropdown.removeClass('dropdown-visible');
616			} else {
617				$dropdown.addClass('dropdown-visible');
618			}
619			$current = $dropdown;
620		})
621		.on('mouseleave', '.top-widget, .share-holder', function () {
622			$current.removeClass('dropdown-visible');
623		});
624
625	$j('.top-widget #password, .top-widget #username').keypress(function (e) {
626		var keycode = event.keyCode ? event.keyCode : event.which;
627		if (keycode == '13') {
628			$j('#hb-login-form').submit();
629		}
630	});
631
632	$j('#password-tmp, #username-tmp').keypress(function (e) {
633		var keycode = event.keyCode ? event.keyCode : event.which;
634		if (keycode == '13') {
635			$j('#hb-login-form-tmp').submit();
636		}
637	});
638}
639
640/* Show Scroll Top */
641function hb_scroll_top_init() {
642	var win = $wind;
643	(timeo = false),
644		(scroll_top = $j('#to-top')),
645		(set_status = function () {
646			var st = win.scrollTop();
647			if (st < 350) {
648				scroll_top.removeClass('hb-pop-class');
649			} else if (!scroll_top.is('.hb-pop-class')) {
650				scroll_top.addClass('hb-pop-class');
651			}
652		});
653	win.scroll(function () {
654		highendDebounce(set_status());
655	});
656	set_status();
657}
658
659/* Show Menu in Search */
660function hb_menu_search() {
661	if ($body.hasClass('vc_editor')) return false;
662
663	hb_side_panel_added = 0;
664	var $main_nav = $j('#main-nav');
665	var $search_in_header = highend_vars.search_header;
666	var $cart_count = highend_vars.cart_count;
667	var $cart_url = highend_vars.cart_url;
668	var $side_nav_socials = $j('#side-nav-socials');
669
670	if ($j('#header-inner').length && $j('#header-inner').hasClass('nav-type-2') && !$j('#header-inner').hasClass('centered-nav')) {
671		if ($main_nav.length && $body.hasClass('has-side-section') && hb_side_panel_added == 0) {
672			$main_nav.append('<li id="hb-panel-opener" class="external float-right"><a class="hb-open-side-section" href="#"><i class="icon-bars"></i></a></li>');
673			hb_side_panel_added = 1;
674		}
675
676		if ($main_nav.length && $main_wrapper.hasClass('with-shop-button')) {
677			$main_nav.append(
678				'<li id="hb-cart-count" class="external float-right"><a class="hb-cart-init" aria-label="Cart" href="' +
679					$cart_url +
680					'"><i class="hb-icon-cart"></i><span class="cart-circle-count">' +
681					$cart_count +
682					'</span></a></li>'
683			);
684		}
685
686		if ($main_nav.length && $search_in_header == 1 && search_in_menu == 0) {
687			$main_nav.append(
688				'<li id="nav-search" class="external float-right"><a href="#" id="search-trigger" class="no-transition external"><i class="hb-icon-search"></i></a></li>'
689			);
690			search_in_menu = 1;
691		}
692	} else {
693		if ($main_nav.length && $search_in_header == 1 && search_in_menu == 0) {
694			$main_nav.append(
695				'<li id="nav-search" class="external"><a href="#" id="search-trigger" class="no-transition external"><i class="hb-icon-search"></i></a></li>'
696			);
697			search_in_menu = 1;
698		}
699
700		if ($main_nav.length && $main_wrapper.hasClass('with-shop-button')) {
701			$main_nav.append(
702				'<li id="hb-cart-count" class="external"><a class="hb-cart-init" aria-label="Cart" href="' +
703					$cart_url +
704					'"><i class="hb-icon-cart"></i><span class="cart-circle-count">' +
705					$cart_count +
706					'</span></a></li>'
707			);
708		}
709
710		if ($main_nav.length && $body.hasClass('has-side-section') && hb_side_panel_added == 0) {
711			$main_nav.append('<li id="hb-panel-opener" class="external"><a class="hb-open-side-section" href="#"><i class="icon-bars"></i></a></li>');
712			hb_side_panel_added = 1;
713		}
714	}
715
716	$j('.hb-open-side-section').on('touchstart click', function (e) {
717		e.preventDefault();
718
719		if (hb_open_flag == 0) {
720			hb_gs.TweenLite.to($j('#hb-side-section'), 0.55, {
721				right: '0px',
722				ease: hb_gs.Power2.easeInOut,
723			});
724			hb_gs.TweenLite.to($j('#hb-wrap, .highend-sticky-header #header-inner'), 0.55, { left: '-300px', ease: hb_gs.Power2.easeInOut });
725			hb_gs.TweenLite.fromTo($j('#hb-modal-overlay'), 0.55, { opacity: 0 }, { opacity: 1, display: 'block', ease: hb_gs.Power2.easeInOut });
726			hb_open_flag = 1;
727		} else {
728			hb_gs.TweenLite.to($j('#hb-side-section'), 0.55, {
729				right: '-300px',
730				ease: hb_gs.Power2.easeInOut,
731			});
732			hb_gs.TweenLite.to($j('#hb-wrap, #header-inner'), 0.55, {
733				left: '0px',
734				ease: hb_gs.Power2.easeInOut,
735			});
736			hb_gs.TweenLite.fromTo($j('#hb-modal-overlay'), 0.55, { opacity: 1 }, { opacity: 0, display: 'none', ease: hb_gs.Power2.easeInOut });
737			hb_open_flag = 0;
738		}
739	});
740
741	$j('.hb-close-side-section, #hb-modal-overlay').on('touchstart click', function (e) {
742		e.preventDefault();
743
744		if (hb_open_flag == 1) {
745			hb_gs.TweenLite.to($j('#hb-side-section'), 0.55, {
746				right: '-300px',
747				ease: hb_gs.Power2.easeInOut,
748			});
749			hb_gs.TweenLite.to($j('#hb-wrap, #header-inner'), 0.55, {
750				left: '0px',
751				ease: hb_gs.Power2.easeInOut,
752			});
753			hb_gs.TweenLite.fromTo($j('#hb-modal-overlay'), 0.55, { opacity: 1 }, { opacity: 0, display: 'none', ease: hb_gs.Power2.easeInOut });
754			hb_open_flag = 0;
755		}
756	});
757}
758
759/* Add hb-transform class to the body if animations are supported */
760function hb_anim_content() {
761	if (!is_touch_device()) {
762		$body.addClass('hb-transform');
763	}
764}
765
766/* Scroll to top on click */
767function hb_to_top_click() {
768	$j('#to-top,.go-to-top').click(function (e) {
769		e.preventDefault();
770
771		window.scrollTo({
772			top: 0,
773			left: 0,
774			behavior: 'smooth',
775		});
776	});
777}
778
779/* Init Masonry */
780function hb_masonry() {
781	var $container = $j('.masonry-holder');
782	if ($container.length) {
783		var $layoutMode = $container.attr('data-layout-mode');
784
785		if ($layoutMode == 'fitRows') {
786			$container.isotope({
787				itemSelector: 'article',
788				animationEngine: 'best-available',
789				layoutMode: 'fitRows',
790			});
791		} else if ($layoutMode == 'masonry') {
792			$container.isotope({
793				itemSelector: 'article',
794				animationEngine: 'best-available',
795				layoutMode: 'masonry',
796			});
797		} else if ($layoutMode == 'straightDown') {
798			$container.isotope({
799				itemSelector: 'article',
800				animationEngine: 'best-available',
801				layoutMode: 'straightDown',
802			});
803		} else {
804			$container.isotope({
805				itemSelector: 'article',
806				animationEngine: 'best-available',
807				layoutMode: 'masonry',
808			});
809		}
810
811		$container.imagesLoaded(function () {
812			if ($layoutMode == 'fitRows') {
813				$container.isotope({
814					itemSelector: 'article',
815					animationEngine: 'best-available',
816					layoutMode: 'fitRows',
817				});
818			} else if ($layoutMode == 'masonry') {
819				$container.isotope({
820					itemSelector: 'article',
821					animationEngine: 'best-available',
822					layoutMode: 'masonry',
823				});
824			} else if ($layoutMode == 'straightDown') {
825				$container.isotope({
826					itemSelector: 'article',
827					animationEngine: 'best-available',
828					layoutMode: 'straightDown',
829				});
830			} else {
831				$container.isotope({
832					itemSelector: 'article',
833					animationEngine: 'best-available',
834					layoutMode: 'masonry',
835				});
836			}
837		});
838	}
839}
840
841/* Side nav handlers */
842function hb_side_nav_handler() {
843	if ($body.hasClass('hb-side-navigation')) {
844		var $panel = $j('#hb-side-navigation');
845		var hb_window_y;
846
847		function sideNavScroll() {
848			hb_window_y = $wind.scrollTop();
849
850			if (hb_window_y > 200 && $wind.width() >= 1024) {
851				$body.removeClass('transparent-side-navigation');
852				$panel.removeClass('hb-transparent');
853				$panel.addClass('hb-non-transparent');
854				window.dispatchEvent(new Event('resize'));
855			} else if (hb_window_y < 200 && $wind.width() >= 1024) {
856				$body.addClass('transparent-side-navigation');
857				$panel.addClass('hb-transparent');
858				$panel.removeClass('hb-non-transparent');
859				window.dispatchEvent(new Event('resize'));
860			} else if ($wind.width() < 1024) {
861				$body.removeClass('transparent-side-navigation');
862				$panel.removeClass('hb-transparent');
863				$panel.addClass('hb-non-transparent');
864				window.dispatchEvent(new Event('resize'));
865			}
866		}
867
868		// check for transparent type
869		if ($body.hasClass('transparent-side-navigation')) {
870			// Check on load
871			sideNavScroll();
872
873			$wind.scroll(function () {
874				highendDebounce(sideNavScroll());
875			});
876		}
877
878		// check if animation is enabled
879		if ($body.hasClass('side-navigation-with-animation')) {
880			if ($j('.hb-side-nav > li').length) {
881				$wind.on('load', function () {
882					hb_gs.TweenLite.to($j('.side-logo-wrapper #logo'), 0.4, {
883						delay: 1,
884						left: '0px',
885						opacity: 1,
886						ease: hb_gs.Power1.easeOut,
887					});
888
889					setTimeout(function () {
890						$j('.hb-side-nav > li, .side-nav-bottom-part ul li, .side-nav-bottom-text').each(function (i, l) {
891							hb_gs.TweenLite.to(l, 0.4, {
892								delay: i * 0.12,
893								left: '0px',
894								opacity: 1,
895								ease: hb_gs.Power1.easeOut,
896							});
897						});
898					}, 1000);
899				});
900			} else {
901				hb_gs.TweenLite.to($j('.side-logo-wrapper #logo'), 0.4, {
902					delay: 1,
903					left: '0px',
904					opacity: 1,
905					ease: hb_gs.Power1.easeOut,
906				});
907			}
908		}
909	}
910}
911
912/* Init Parallax for each section */
913function hb_parallax_init() {
914	if ($j('#hb-page-title.parallax').length && !$body.hasClass('mobile') && navigator.userAgent.match(/iPad/i) == null) {
915		var $scroll_val;
916		var $scrollTop;
917		var $opac;
918
919		// Parallax Headers
920		$wind.scroll(function () {
921			highendDebounce(function () {
922				$scrollTop = $wind.scrollTop();
923				$scroll_val = $wind.scrollTop() * 0.3;
924				$scroll_val_img = $wind.scrollTop() * 0.2;
925
926				$opac = 1 - $scrollTop / 260;
927
928				if ($scroll_val <= 0) {
929					$scroll_val = 0;
930				}
931
932				if ($scroll_val_img <= 0) {
933					$scroll_val_img = 0;
934				}
935
936				if ($opac <= 0) {
937					$opac = 0;
938				}
939
940				if (!$body.hasClass('mobile') && navigator.userAgent.match(/iPad/i) == null) {
941					hb_gs.TweenLite.to($j('.hb-image-bg-wrap'), 0, {
942						y: $scroll_val_img,
943						ease: hb_gs.Linear.easeNone,
944						autoRound: true,
945					});
946					hb_gs.TweenLite.to($j('.hb-page-title, .breadcrumbs-wrapper'), 0, {
947						y: $scroll_val,
948						opacity: $opac,
949						ease: hb_gs.Linear.easeNone,
950						autoRound: true,
951					});
952				}
953			});
954		});
955	}
956	if (typeof revapi4 != 'undefined') {
957		revapi4.bind('revolution.slide.onloaded', function (e) {
958			$j('#slider-section .rev_slider_wrapper').addClass('parallax-slider');
959			$j('#slider-section').addClass('parallax-slider-wrapper');
960		});
961
962		var $scroll_val;
963		var $scrollTop;
964		var $opac;
965
966		// Parallax Headers
967		$wind.scroll(function () {
968			highendDebounce(function () {
969				$scrollTop = $wind.scrollTop();
970				$scroll_val = $wind.scrollTop() * 0.65;
971				$scroll_val_img = $wind.scrollTop() * 0.45;
972
973				$opac = 1 - $scrollTop / 560;
974
975				if ($scroll_val <= 0) {
976					$scroll_val = 0;
977				}
978
979				if ($scroll_val_img <= 0) {
980					$scroll_val_img = 0;
981				}
982
983				if ($opac <= 0) {
984					$opac = 0;
985				}
986
987				$j('#slider-section .rev_slider_wrapper').css({
988					transform: 'translateY(' + $scroll_val_img + 'px)',
989				});
990				$j('#slider-section .rev_slider_wrapper').css({ opacity: $opac });
991			});
992		});
993	}
994
995	$j('.hb-parallax-wrapper').each(function () {
996		$j(this).jarallax({
997			speed: 0.2,
998		});
999	});
1000}
1001
1002function hb_fullscreen_image() {
1003	var $hght = $wind.outerHeight() + 1;
1004	$j('.fullscreen-image').css('height', $hght + 'px');
1005}
1006
1007/* Expand sections to full width */
1008function hb_fw_sections() {
1009	var $fwh;
1010	var $width = $wind.width();
1011
1012	var $pad_left = '0px';
1013	var $pad_right = '0px';
1014	var $mar_left = '-50px';
1015
1016	if ($main_wrapper.hasClass('hb-boxed-layout') && $width > 767) {
1017		if ($j('.hb-main-content').length) {
1018			$fwh = parseInt($j('.hb-main-content').width()) + 102;
1019		} else {
1020			$fwh = parseInt($j('.main-row').width()) + 70;
1021		}
1022
1023		$j('.fw-section').each(function () {
1024			$j(this).css({
1025				'margin-left': $mar_left,
1026				'padding-left': $pad_left,
1027				'padding-right': $pad_right,
1028				'margin-right': '0px',
1029				width: $fwh,
1030				visibility: 'visible',
1031			});
1032		});
1033	} else {
1034		if ($j('.hb-main-content').length) {
1035			$fwh = ($width - parseInt($j('.hb-main-content').width())) / 2;
1036		} else {
1037			$fwh = ($width - parseInt($j('.main-row').width())) / 2 + 15;
1038		}
1039
1040		if ($body.hasClass('hb-side-navigation') && $width > 1024) {
1041			$fwh = $fwh - 132;
1042			$width = $width - 265;
1043		}
1044
1045		$j('.fw-section').each(function () {
1046			if ($j(this).hasClass('fw-columns')) {
1047				$j(this).css({
1048					left: -$fwh,
1049					width: $width + 2,
1050					height: 'auto',
1051				});
1052			} else {
1053				$j(this).css({
1054					'margin-left': -$fwh,
1055					'padding-left': $fwh,
1056					'padding-right': $fwh,
1057					visibility: 'visible',
1058					width: '100%',
1059					'margin-right': '0px',
1060				});
1061			}
1062		});
1063	}
1064
1065	if ($j('.content-total-fw').length) {
1066		$j('.content-total-fw').each(function () {
1067			var $that = $j(this);
1068			$that.parent().css('height', $that.outerHeight());
1069			$that.imagesLoaded(function () {
1070				$that.parent().stop().animate({ height: $that.outerHeight() }, 350, 'easeOutCubic');
1071				$that.stop().animate({ opacity: 1 }, 350, 'easeOutCubic');
1072			});
1073		});
1074	}
1075}
1076
1077/* Modern Search */
1078function hb_modern_search() {
1079	if ($body.hasClass('hb-modern-search')) {
1080		$search_overlay = $j('#modern-search-overlay');
1081		$close_search = $j('.hb-modern-search-close');
1082		$search_init = $j('#search-trigger');
1083
1084		$close_search.on('touchstart click', function (e) {
1085			e.preventDefault();
1086
1087			if ($search_overlay.length && $search_overlay.hasClass('overlay-visible')) {
1088				hb_gs.TweenLite.to($search_overlay, 0.8, {
1089					opacity: 0,
1090					scale: 1.5,
1091					ease: hb_gs.Power3.easeOut,
1092					onComplete: function () {
1093						this.target.removeClass('overlay-visible');
1094					},
1095				});
1096			}
1097		});
1098
1099		$search_init.on('touchstart click', function (e) {
1100			e.preventDefault();
1101
1102			$search_overlay.addClass('overlay-visible');
1103			hb_gs.TweenLite.to($search_overlay, 0.5, {
1104				opacity: 1,
1105				scale: 1,
1106				ease: hb_gs.Power3.easeOut,
1107				onComplete: function () {},
1108			});
1109			$j('#hb-modern-search-input').focus();
1110		});
1111
1112		$body.keyup(function (e) {
1113			if ($search_overlay.hasClass('overlay-visible')) {
1114				var keycode = event.keyCode ? event.keyCode : event.which;
1115				if (keycode == '27') {
1116					try {
1117						e.preventDefault();
1118					} catch (x) {
1119						//Non-IE
1120						e.returnValue = false;
1121					} //IE
1122
1123					hb_gs.TweenLite.to($search_overlay, 0.5, {
1124						opacity: 0,
1125						scale: 1.5,
1126						ease: hb_gs.Power3.easeOut,
1127						onComplete: function () {
1128							this.target.removeClass('overlay-visible');
1129						},
1130					});
1131				}
1132			}
1133		});
1134	}
1135}
1136
1137/* Fancy Search in header */
1138function hb_fancy_search() {
1139	var $open_flag = false;
1140	var $header_inner = $j('#header-inner');
1141	$j('#nav-search, #close-fancy-search').click(function (e) {
1142		e.preventDefault();
1143
1144		if ($body.hasClass('hb-modern-search')) {
1145			return false;
1146		} else {
1147			if (!$open_flag) {
1148				$j('#fancy-search #s').val('');
1149				if ($header_inner.hasClass('nav-type-2')) {
1150					$j('#main-nav, #sticky-shop-button').stop(true, false).hide();
1151				} else {
1152					$j('#logo, #main-nav, #sticky-shop-button').stop(true, false).hide();
1153				}
1154				$j('#fancy-search').fadeIn(300);
1155				$j('#fancy-search-form #s').focus();
1156				$body.addClass('fancy-s-open');
1157				$open_flag = true;
1158			} else {
1159				$j('#fancy-search').hide();
1160				$j('#fancy-search #s').blur();
1161				$j('#logo, #main-nav, #sticky-shop-button').stop(true, false).fadeIn(300);
1162				$body.removeClass('fancy-s-open');
1163				$open_flag = false;
1164			}
1165		}
1166	});
1167
1168	$doc.mouseup(function (e) {
1169		var $container = $j('#fancy-search');
1170		if (!$container.is(e.target) && $container.has(e.target).length === 0 && $open_flag) {
1171			$j('#close-fancy-search').trigger('click');
1172		}
1173	});
1174
1175	$doc.keyup(function (e) {
1176		if ($j('#fancy-search').is(':visible') && e.keyCode == 27) {
1177			$j('#close-fancy-search').trigger('click');
1178		}
1179
1180		if (hb_open_flag == 1 && e.keyCode == 27) {
1181			hb_gs.TweenLite.to($j('#hb-side-section'), 0.55, {
1182				right: '-300px',
1183				ease: hb_gs.Power2.easeInOut,
1184			});
1185			hb_gs.TweenLite.to($j('#hb-wrap, #header-inner'), 0.55, {
1186				left: '0px',
1187				ease: hb_gs.Power2.easeInOut,
1188			});
1189			hb_gs.TweenLite.fromTo($j('#hb-modal-overlay'), 0.55, { opacity: 1 }, { opacity: 0, display: 'none', ease: hb_gs.Power2.easeInOut });
1190			hb_open_flag = 0;
1191		}
1192	});
1193}
1194
1195/* Mask the clicks for forms */
1196function hb_click_forms() {
1197	$j('#hb-submit-login-form').click(function (e) {
1198		e.preventDefault();
1199		if ($j('#hb-login-form').validate().form()) {
1200			$j('#hb-login-form').submit();
1201		}
1202	});
1203
1204	$j('#hb-submit-login-form-tmp').click(function (e) {
1205		e.preventDefault();
1206		if ($j('#hb-login-form-tmp').validate().form()) {
1207			$j('#hb-login-form-tmp').submit();
1208		}
1209	});
1210}
1211
1212/* Init Likes */
1213function hb_like_init() {
1214	$body.on('click touchstart', '.like-holder', function (e) {
1215		var $this = jQuery(this);
1216
1217		var data = {
1218			action: 'highend_like_this',
1219			post_id: $this.data('post-id'),
1220			nonce: $this.data('nonce'),
1221		};
1222
1223		jQuery.post(highend_vars.ajaxurl, data, function (response) {
1224			if (response.success) {
1225				if (response.data.message) {
1226					$this.addClass('like-active').find('span').html(response.data.message);
1227				}
1228			}
1229		});
1230	});
1231}
1232
1233/* Mini Contact Form */
1234function hb_mini_contact_form() {
1235	var toggle = false;
1236
1237	$j('#contact-button').click(function (e) {
1238		e.preventDefault();
1239		e.stopPropagation();
1240		$j(this).toggleClass('active-c-button');
1241		$panel = $j('#contact-panel');
1242
1243		if (!toggle) {
1244			hb_gs.TweenLite.to($panel, 0.2, {
1245				opacity: 1,
1246				visibility: 'visible',
1247				scale: 1,
1248				ease: hb_gs.Power3.easeOutBouce,
1249			});
1250			toggle = true;
1251		} else {
1252			hb_gs.TweenLite.to($panel, 0.2, {
1253				opacity: 0,
1254				scale: 0.8,
1255				ease: hb_gs.Power3.easeOutBouce,
1256				onComplete: function () {
1257					$panel.css('visibility', 'hidden');
1258					toggle = false;
1259				},
1260			});
1261		}
1262	});
1263
1264	$j('#contact-panel').click(function (e) {
1265		e.stopPropagation();
1266	});
1267
1268	$doc.click(function (e) {
1269		if (toggle) {
1270			$j('#contact-button').removeClass('active-c-button');
1271			hb_gs.TweenLite.to($panel, 0.2, {
1272				opacity: 0,
1273				scale: 0.9,
1274				ease: hb_gs.Power1.easeOutBouce,
1275				onComplete: function () {
1276					$panel.css('visibility', 'hidden');
1277					toggle = false;
1278				},
1279			});
1280			return false;
1281		}
1282	});
1283}
1284
1285/* HB Header Effect */
1286function hb_header_effect() {
1287	var $header = $j('#header-inner');
1288	var header_els = $j('#header-inner, #header-inner #logo, .main-navigation, .plain-logo, #show-nav-menu');
1289
1290	if (($header.hasClass('centered-nav') || $header.hasClass('nav-type-2')) && $header.hasClass('sticky-nav')) {
1291		$j('.main-navigation').sticky();
1292	}
1293
1294	if ($header.hasClass('sticky-nav') && $header.hasClass('nav-type-1')) {
1295		$header.sticky();
1296
1297		// Disable CSS Transition
1298		$j('.image-logo, .plain-logo, #main-nav li a').addClass('no-transition');
1299
1300		/* Main Navigation */
1301		var header_height = parseInt(highend_vars.header_height);
1302		var header_height_sticky = parseInt(highend_vars.sticky_header_height);
1303
1304		/* Check on Page Load */
1305		var hb_window_y = $wind.scrollTop();
1306		var new_height = 0;
1307		var offset = 0;
1308		var header_els = $j('#header-inner, #header-inner #logo, .main-navigation, .plain-logo, #show-nav-menu');
1309
1310		if ($main_wrapper.hasClass('hb-boxed-layout')) {
1311			offset += 40;
1312		}
1313
1314		// Header Fancy Effect
1315		if (!$body.hasClass('hb-special-header-style')) {
1316			if (hb_window_y > $j('#header-bar').height() + offset) {
1317				if (hb_window_y < header_height - header_height_sticky + $j('#header-bar').height() + offset) {
1318					new_height = header_height - hb_window_y + $j('#header-bar').height() + offset;
1319				} else {
1320					new_height = header_height_sticky;
1321				}
1322			} else if (hb_window_y < 0 && is_safari == false) {
1323				new_height = header_height - hb_window_y;
1324			} else {
1325				new_height = header_height;
1326			}
1327			header_els.css({
1328				height: new_height + 'px',
1329				lineHeight: new_height + 'px',
1330			});
1331			if (new_height > header_height) {
1332				$j('#header-inner-sticky-wrapper').css({
1333					height: new_height + 'px',
1334					lineHeight: new_height + 'px',
1335				});
1336			}
1337			/* End */
1338
1339			$j(window).scroll(function () {
1340				highendDebounce(function () {
1341					var hb_window_y = $wind.scrollTop();
1342					var new_height = 0;
1343					var offset = 0;
1344
1345					if ($main_wrapper.hasClass('hb-boxed-layout')) {
1346						offset += 40;
1347					}
1348
1349					if (hb_window_y > $j('#header-bar').height() + offset) {
1350						if (hb_window_y < header_height - header_height_sticky + $
1350j('#header-bar').height() + offset) {
1351							new_height = header_height - hb_window_y + $j('#header-bar').height() + offset;
1352						} else {
1353							new_height = header_height_sticky;
1354						}
1355					} else if (hb_window_y < 0 && is_safari == false) {
1356						new_height = header_height - hb_window_y;
1357					} else {
1358						new_height = header_height;
1359					}
1360
1361					header_els.css({
1362						height: new_height + 'px',
1363						lineHeight: new_height + 'px',
1364					});
1365
1366					if (new_height > header_height) {
1367						$j('#header-inner-sticky-wrapper').css({
1368							height: new_height + 'px',
1369							lineHeight: new_height + 'px',
1370						});
1371					}
1372				});
1373			});
1374		}
1375	}
1376}
1377
1378/* Function Validations */
1379function hb_validations() {
1380	if (jQuery().validate) {
1381		$j('#commentform').validate();
1382	}
1383}
1384
1385function hb_fixed_footer_init() {
1386	var $fixedFooterBool = $body.hasClass('hb-fixed-footer');
1387	if ($fixedFooterBool && $wind.width() > 768) {
1388		hb_fixed_footer();
1389	} else if ($wind.width() <= 768) {
1390		hb_reset_fixed_footer();
1391	}
1392}
1393
1394/* Fixed Footer */
1395function hb_fixed_footer() {
1396	var $footer_height = 0;
1397	var $copyright_height = 0;
1398	var $total_height = 0;
1399
1400	if ($j('#copyright-wrapper').length) {
1401		$copyright_height = $j('#copyright-wrapper').outerHeight(true);
1402	}
1403
1404	if ($main_wrapper.hasClass('hb-boxed-layout')) {
1405		$j('#footer').css({
1406			position: 'fixed',
1407			bottom: 0,
1408			'margin-bottom': $copyright_height + 'px',
1409			width: 'inherit',
1410			'max-width': 'inherit',
1411			'z-index': -1,
1412		});
1413
1414		$j('#copyright-wrapper').css({
1415			position: 'fixed',
1416			bottom: 0,
1417			width: 'inherit',
1418			'max-width': 'inherit',
1419			'z-index': -2,
1420		});
1421	} else {
1422		$j('#footer').css({
1423			position: 'fixed',
1424			bottom: 0,
1425			'margin-bottom': $copyright_height + 'px',
1426			left: 0,
1427			width: '100%',
1428			'z-index': -1,
1429		});
1430
1431		$j('#copyright-wrapper').css({
1432			position: 'fixed',
1433			bottom: 0,
1434			left: 0,
1435			width: '100%',
1436			'z-index': -2,
1437		});
1438	}
1439
1440	if ($j('#footer').length) {
1441		$footer_height = $j('#footer').outerHeight(true);
1442	} else if ($j('#copyright-wrapper').length) {
1443		$footer_height = $j('#copyright-wrapper').outerHeight(true);
1444	}
1445
1446	$total_height = $footer_height;
1447
1448	$j('#hb-wrap').css({
1449		'margin-bottom': $total_height,
1450	});
1451}
1452
1453function hb_reset_fixed_footer() {
1454	$j('#footer').css({
1455		position: 'static',
1456		bottom: 0,
1457		'margin-bottom': 0,
1458		left: 0,
1459		width: '100%',
1460		'z-index': 991,
1461	});
1462
1463	$j('#copyright-wrapper').css({
1464		position: 'static',
1465		bottom: 0,
1466		left: 0,
1467		width: '100%',
1468		'z-index': 992,
1469	});
1470
1471	$j('#hb-wrap').css({
1472		'margin-bottom': '0',
1473	});
1474}
1475
1476function hb_init_fw_gallery() {
1477	var $fw_gallery_container = $j('#fw-gallery-grid');
1478	var $isotope_gallery = $j('.fw-gallery-wrap');
1479	var $enableFilter = $fw_gallery_container.attr('data-enable-filter');
1480	var $enableSort = $fw_gallery_container.attr('data-enable-sort');
1481
1482	if ($fw_gallery_container.length) {
1483		$fw_gallery_container.imagesLoaded(function () {
1484			$isotope_gallery.removeClass('loading');
1485
1486			$j('#fw-gallery-grid .col').each(function (i) {
1487				var $that = $j(this);
1488				var $counter = i;
1489
1490				setTimeout(function () {
1491					$that.addClass('animate');
1492					setTimeout(function () {
1493						$that.removeClass('animate').addClass('visible');
1494					}, 800);
1495				}, $counter * 110 + 300);
1496			});
1497
1498			$isotope_gallery.isotope({
1499				itemSelector: '.elastic-item',
1500				getSortData: {
1501					name: '.hb-gallery-item-name',
1502					date: function (elem) {
1503						return $j(elem).attr('data-value');
1504					},
1505					count: '.photo-count parseInt',
1506				},
1507			});
1508
1509			$wind.resize(function () {
1510				highendDebounce($isotope_gallery.isotope());
1511			});
1512		});
1513
1514		$j('li.hb-dd-header').hover(
1515			function () {
1516				var $dropdown = $j(this).find('.hb-gallery-dropdown');
1517				$dropdown.addClass('dropdown-visible');
1518			},
1519			function () {
1520				var $dropdown = $j(this).find('.hb-gallery-dropdown');
1521				$dropdown.removeClass('dropdown-visible');
1522			}
1523		);
1524
1525		$j('ul.hb-sort-filter > li.hb-dd-header > ul > li > a').click(function () {
1526			$j(this).addClass('hb-current-item');
1527			var $new_sort_value = $j(this).html();
1528			var $sort_value = $j(this).parent().parent().parent().find('strong');
1529			var $sort_ascending = false;
1530			var selector = $j(this).attr('data-sort-value');
1531
1532			$sort_value.html($new_sort_value);
1533			$sort_value.siblings('.hb-gallery-dropdown').trigger('mouseout');
1534
1535			if (selector == 'name') {
1536				$sort_ascending = true;
1537			} else if (selector == 'date') {
1538				$sort_ascending = false;
1539			}
1540
1541			if (selector == 'random') {
1542				$isotope_gallery.isotope({ sortBy: 'random' });
1543			} else {
1544				$isotope_gallery.isotope({
1545					sortBy: selector,
1546					sortAscending: $sort_ascending,
1547				});
1548			}
1549
1550			return false;
1551		});
1552
1553		$j('ul.hb-grid-filter > li.hb-dd-header > ul > li > a').click(function () {
1554			$j(this).addClass('hb-current-item');
1555			var selector = $j(this).attr('data-filter');
1556			if (selector != '*') {
1557				selector = '.' + selector;
1558			}
1559			$isotope_gallery.isotope({ filter: selector });
1560
1561			var $new_sort_value = $j(this).attr('data-filter-name');
1562			var $sort_value = $j(this).parent().parent().parent().find('strong');
1563
1564			$sort_value.html($new_sort_value);
1565			$sort_value.siblings('.hb-gallery-dropdown').trigger('mouseout');
1566
1567			return false;
1568		});
1569	}
1570}
1571
1572/* Standard Gallery Initialization */
1573function hb_init_standard_gallery() {
1574	var $standard_gallery_masonry = $j('#standard-gallery-masonry');
1575
1576	var $enableFilter = $standard_gallery_masonry.attr('data-enable-filter');
1577	var $enableSort = $standard_gallery_masonry.attr('data-enable-sort');
1578
1579	if ($standard_gallery_masonry.length) {
1580		$standard_gallery_masonry.imagesLoaded(function () {
1581			$j('#gallery-loading').stop(true, true).fadeOut(200);
1582
1583			$j('.standard-gallery-item').each(function (i) {
1584				var $that = $j(this);
1585				var $counter = i;
1586
1587				setTimeout(function () {
1588					$that.addClass('animate');
1589					setTimeout(function () {
1590						$that.removeClass('animate').css('opacity', 1);
1591					}, 800);
1592				}, $counter * 110 + 300);
1593			});
1594
1595			$standard_gallery_masonry.isotope({
1596				itemSelector: '.standard-gallery-item-wrap',
1597				animationEngine: 'best-available',
1598				layoutMode: 'fitRows',
1599				getSortData: {
1600					name: '.hb-gallery-item-name',
1601					date: function (elem) {
1602						return $j(elem).attr('data-value');
1603					},
1604				},
1605			});
1606		});
1607
1608		$j('ul.filt-tabs > li > a').click(function () {
1609			$j('ul.filt-tabs').find('.selected').removeClass('selected');
1610			$j(this).parent().addClass('selected');
1611
1612			var selector = $j(this).attr('data-filter');
1613			$standard_gallery_masonry.isotope({ filter: selector });
1614
1615			return false;
1616		});
1617
1618		$j('ul.sort-tabs > li > a').click(function () {
1619			$j('ul.sort-tabs').find('.selected').removeClass('selected');
1620			$j(this).parent().addClass('selected');
1621			var $sort_ascending = false;
1622
1623			var selector = $j(this).attr('data-sort');
1624
1625			if (selector == 'name') {
1626				$sort_ascending = true;
1627			} else if (selector == 'date') {
1628				$sort_ascending = false;
1629			}
1630
1631			$standard_gallery_masonry.isotope({
1632				sortBy: selector,
1633				sortAscending: $sort_ascending,
1634			});
1635
1636			return false;
1637		});
1638	}
1639}
1640
1641/* Ajax Search - Only for header menu search */
1642function hb_ajax_search() {
1643	if ($body.hasClass('hb-modern-search')) return false;
1644
1645	if ($j('#nav-search').length && $j('#header-inner').hasClass('hb-ajax-search')) {
1646		$j('#fancy-search #s')
1647			.autocomplete({
1648				delay: 50,
1649				minLength: 2,
1650				appendTo: $j('#fancy-search'),
1651				search: function (event, ui) {
1652					$j('#fancy-search').addClass('ajax-searching');
1653				},
1654				source: function (req, response) {
1655					$j.getJSON(highend_vars.ajaxurl + '?callback=?&action=hb_ajax_search', req, response);
1656				},
1657				select: function (event, ui) {
1658					if (typeof ui.item != 'undefined') {
1659						window.location.href = ui.item.link;
1660					} else {
1661						$j('#fancy-search-form').submit();
1662					}
1663				},
1664				response: function (event, ui) {
1665					$j('#fancy-search').removeClass('ajax-searching');
1666				},
1667				open: function (event, ui) {
1668					var len = $j('#fancy-search .ui-autocomplete > li').length;
1669					if (len == 5) {
1670						$j('#fancy-search .ui-autocomplete').append(
1671							'<li class="ui-menu-item" role="presentation"><a id="ui-view-all-results" href="#" class="ui-corner-all" tabindex="-1"><i class="hb-moon-search-3"></i><span class="search-title all-results">View all results</span></a></li>'
1672						); //See all results);
1673					}
1674				},
1675			})
1676			.data('ui-autocomplete')._renderItem = function (ul, item) {
1677			return $j('<li>')
1678				.append('<a>' + item.image + "<span class='search-title'>" + item.label + "</span><span class='search-date'>" + item.date + '</span></a>')
1679				.appendTo(ul);
1680		};
1681	} else {
1682		return false;
1683	}
1684}
1685
1686/* Function Lighbox Init */
1687function hb_init_lightbox() {
1688	if (!$j.fn.prettyPhoto) {
1689		return;
1690	}
1691
1692	$j("a[rel^='prettyPhoto'], a[rel^='prettyPhoto[gallery]'], .gallery-icon a, a[rel^='lightbox']").prettyPhoto({
1693		animation_speed: 'fast',
1694		opacity: 0.85,
1695		overlay_gallery: true,
1696		slideshow: false,
1697		allow_resize: true,
1698		show_title: true,
1699		changepicturecallback: function () {
1700			if (viewportWidth < 1025) {
1701				var viewportWidth = $j('html').innerWidth();
1702				$j('.pp_pic_holder.pp_default').css('top', window.pageYOffset + 'px');
1703			}
1704		},
1705		default_width: 970,
1706		default_height: 643,
1707		social_tools: '',
1708	});
1709
1710	$j('.gallery-item-init').click(function (e) {
1711		e.preventDefault();
1712		var $api_images = $j(this).attr('data-gallery-images');
1713		$j.prettyPhoto.open($api_images);
1714	});
1715}
1716
1717/* Window Popup */
1718function popWindow(url, winName, w, h) {
1719	if (window.open) {
1720		if (poppedWindow) {
1721			poppedWindow = '';
1722		}
1723		windowW = w;
1724		windowH = h;
1725		var windowX = screen.width / 2 - windowW / 2;
1726		var windowY = screen.height / 2 - windowH / 2;
1727		var myExtra = 'status=no,menubar=no,resizable=yes,toolbar=no,scrollbars=yes,addressbar=no';
1728		var poppedWindow = window.open(url, winName, 'width=' + w + ',height=' + h + ',top=' + windowY + ',left=' + windowX + ',' + myExtra + '');
1729	} else {
1730		alert(
1731			'Your security settings are not allowing our popup windows to function. Please make sure your security software allows popup windows to be opened by this web application.'
1732		);
1733	}
1734	return false;
1735}
1736
1737/* Single Blog Scripts */
1738function hb_single_blog_scripts() {
1739	/* Scroll To #comments when clicked */
1740	$j('.scroll-to-comments').click(function (e) {
1741		e.preventDefault();
1742		if ($j('#comments').length) {
1743			$j('html, body').animate(
1744				{
1745					scrollTop: $j('#comments').offset().top - 120,
1746				},
1747				800,
1748				'easeOutCubic'
1749			);
1750		} else {
1751			$j('html, body').animate(
1752				{
1753					scrollTop: $j('#respond').offset().top - 120,
1754				},
1755				800,
1756				'easeOutCubic'
1757			);
1758		}
1759	});
1760
1761	/* Scroll to #respond when clicked */
1762	$j('.leave-your-reply').click(function (e) {
1763		e.preventDefault();
1764		if ($j('#respond').length) {
1765			$j('html, body').animate(
1766				{
1767					scrollTop: $j('#respond').offset().top - 120,
1768				},
1769				800,
1770				'easeOutCubic'
1771			);
1772		}
1773	});
1774}
1775
1776/* Various Shortcode Inits */
1777function hb_init_shortcodes() {
1778	/* Wrap Select elements */
1779	//$j( "select" ).not("#rating, .esg-sorting-select").not('#calc_shipping_state, #calc_shipping_country, #billing_country, #billing_state, #billing-state, #shipping_country, #shipping_state').wrap( "<div class='hb-custom-select'></div>" );
1780
1781	/* Typed JS */
1782	if ($j('.hb-typed-text').length) {
1783		$j('.hb-typed-text').each(function () {
1784			var $that = $j(this);
1785			var strings_to_type = $that.parent().find('.hb-typed-strings').html();
1786			strings_to_type = strings_to_type.replace('<p>', '');
1787			strings_to_type = strings_to_type.replace('</p>', '');
1788
1789			var strings = strings_to_type.split('<br>');
1790
1791			if ($that.data('highlight') == true) {
1792				$that.css('background-color', $that.data('highlightcolor')).parent().addClass('with-highlight');
1793				$that.css('color', $that.data('highlighttextcolor'));
1794			}
1795
1796			var options = {
1797				strings: strings,
1798				typeSpeed: $that.data('speed'),
1799				backDelay: $that.data('backdelay'),
1800				loopCount: $that.data('loopcount'),
1801				loop: $that.data('loop'),
1802				contentType: 'html',
1803			};
1804
1805			$that.typed(options);
1806		});
1807	}
1808
1809	/* Owl Carousel */
1810	// if ( $j('.hb-owl-slider').length ){
1811	// 	$j('.hb-owl-slider').each(function(){
1812	// 		var $that = $j(this);
1813	// 		setTimeout(function() {
1814	// 			$that.owlCarousel({
1815	// 				'navigationText' : ["<i class='hb-moon-arrow-left-4'></i>","<i class='hb-moon-arrow-right-5'></i>"],
1816	// 				'items' : $that.data("items"),
1817	// 				'slideSpeed' : $that.data("slidespeed"),
1818	// 				'autoPlay' : $that.data("autoplay"),
1819	// 				'stopOnHover' : $that.data("stoponhover"),
1820	// 				'rewindNav' : $that.data("rewindnav"),
1821	// 				'lazyLoad' : $that.data("lazyload"),
1822	// 				'pagination' : $that.data("pagination"),
1823	// 				'data-navigation' : $that.data("navigation"),
1824	// 			});
1825	// 			$that.parent().fadeIn(450);
1826	// 		}, 500);
1827	// 	});
1828	// }
1829	//
1830
1831	document.querySelectorAll('.hb-owl-slider').forEach((item) => {
1832		var args = {
1833			items: parseInt(item.getAttribute('data-items')),
1834			nav: item.getAttribute('data-navigation'),
1835			navText: ["<i class='hb-moon-arrow-left-4'></i>", "<i class='hb-moon-arrow-right-5'></i>"],
1836			autoplay: 'true' === item.getAttribute('data-autoplay'),
1837			autoplayHoverPause: item.getAttribute('data-stoponhover') == 'true',
1838			autoplaySpeed: 'true' === item.getAttribute('data-autoplay') ? parseInt(item.getAttribute('data-autoplaySpeed')) : false,
1839			dots: item.getAttribute('data-pagination') == 'true',
1840			lazyLoad: item.getAttribute('data-lazyload') == 'true',
1841			rewind: item.getAttribute('data-rewindnav') == 'true',
1842			responsiveClass: true,
1843			responsive: {
1844				0: {
1845					items: 1,
1846				},
1847				769: {
1848					items: parseInt(item.getAttribute('data-items')),
1849				},
1850			},
1851		};
1852
1853		$j(item).owlCarousel(args);
1854	});
1855
1856	/* Testimonial Slider */
1857	if ($j('.init-testimonial-slider').length) {
1858		$j('.init-testimonial-slider').each(function () {
1859			var $that = $j(this);
1860			var $speed = $j(this).attr('data-slideshow-speed');
1861
1862			if ($speed < 1000) {
1863				$speed = 1000;
1864			}
1865
1866			$that.flexslider({
1867				selector: '.testimonial-slider > li',
1868				slideshow: true,
1869				animation: 'fade',
1870				smoothHeight: false,
1871				slideshowSpeed: $speed,
1872				animationSpeed: 350,
1873				directionNavArrowsLeft: '<i class="icon-chevron-left"></i>',
1874				directionNavArrowsRight: '<i class="icon-chevron-right"></i>',
1875				pauseOnHover: false,
1876				controlNav: true,
1877				directionNav: false,
1878				prevText: '',
1879				nextText: '',
1880			});
1881		});
1882	}
1883
1884	var init_flexslider = function ($slider) {
1885		var speed = $slider.attr('data-speed');
1886		var pause = $slider.attr('data-pause-on-hover');
1887		var control = $slider.attr('data-control-nav');
1888		var nav = $slider.attr('data-direction-nav');
1889
1890		pause = pause == 'true';
1891		control = control == 'true';
1892		nav = nav == 'true';
1893
1894		$slider.fitVids().flexslider({
1895			selector: '.hb-flex-slides > li',
1896			slideshow: true,
1897			animation: 'slide',
1898			smoothHeight: true,
1899			slideshowSpeed: speed,
1900			animationSpeed: 500,
1901			pauseOnHover: pause,
1902			controlNav: control,
1903			directionNav: nav,
1904			prevText: '',
1905			nextText: '',
1906			start: function () {
1907				$slider.removeClass('loading');
1908
1909				if ($slider.parents('.masonry-holder').length) {
1910					$slider.parents('.masonry-holder').isotope();
1911				}
1912			},
1913		});
1914	};
1915
1916	$j('#main-wrapper').on('init', '.init-flexslider', function () {
1917		init_flexslider($j(this));
1918	});
1919
1920	$j('.init-flexslider').trigger('init');
1921
1922	/* Carousel */
1923	if ($j('.init-carousel').length) {
1924		$j('.init-carousel').each(function () {
1925			var $that = $j(this);
1926			var visible_var = parseInt($that.attr('data-visible'), 10);
1927			var speed_var = parseInt($that.attr('data-speed'), 10);
1928			var autorotate = $that.attr('data-auto-rotate');
1929
1930			if (autorotate == 'false') {
1931				speed_var = false;
1932			}
1933
1934			$that.hbcarousel({
1935				visible: visible_var,
1936				speed: 400,
1937				itemMargin: 20,
1938				carousel: true,
1939				autoRotate: speed_var,
1940				itemMinWidth: 200,
1941			});
1942		});
1943	}
1944
1945	/* Carousel */
1946	if ($j('.init-team-carousel').length) {
1947		$j('.init-team-carousel').each(function () {
1948			var $that = $j(this);
1949			var visible_var = parseInt($that.attr('data-visible'), 10);
1950			var speed_var = parseInt($that.attr('data-speed'), 10);
1951			var autorotate = $that.attr('data-auto-rotate');
1952
1953			if (autorotate == 'false') {
1954				speed_var = false;
1955			}
1956
1957			$that.hbcarousel({
1958				visible: visible_var,
1959				speed: 400,
1960				itemMargin: 30,
1961				carousel: true,
1962				autoRotate: speed_var,
1963				itemMinWidth: 200,
1964			});
1965		});
1966	}
1967
1968	/* Countdowns */
1969	if ($j('.hb-countdown-unit').length) {
1970		var date_value;
1971
1972		$j('.hb-countdown-unit').each(function () {
1973			date_value = $j(this).attr('data-date');
1974			$j(this).highendCountdown({
1975				date: date_value,
1976				format: 'on',
1977			});
1978		});
1979	}
1980
1981	/* Accordions */
1982	if ($j('.hb-accordion').length) {
1983		$j('.hb-accordion').each(function () {
1984			var $index = $j(this).attr('data-initialindex');
1985			if ($index != '-1') {
1986				var $tog = $j(this).find('.hb-accordion-single').eq($index).find('.hb-accordion-tab');
1987				$tog.addClass('active-toggle');
1988				$tog.siblings('.hb-accordion-pane').slideDown(200);
1989				hb_animated_contents();
1990				hb_counter();
1991				hb_charts();
1992				hb_progress_bar();
1993			}
1994		});
1995
1996		$j('.hb-accordion .hb-accordion-tab').click(function (e) {
1997			e.preventDefault();
1998
1999			var $that = $j(this);
2000
2001			$that.parent().parent().find('.hb-accordion-tab').removeClass('active-toggle');
2002			$that.parent().parent().find('.hb-accordion-pane').slideUp(200);
2003
2004			if ($that.next().is(':hidden') == true) {
2005				$that.next().slideDown(200);
2006				$that.addClass('active-toggle');
2007				hb_animated_contents();
2008				hb_counter();
2009				hb_charts();
2010				hb_progress_bar();
2011			}
2012		});
2013	}
2014
2015	/* Toggles */
2016	if ($j('.hb-toggle').length) {
2017		$j('.hb-toggle').each(function () {
2018			var $index = $j(this).attr('data-initialindex');
2019			if ($index != '-1') {
2020				var $tog = $j(this).find('.hb-accordion-single').eq($index).find('.hb-accordion-tab');
2021				$tog.addClass('active-toggle');
2022				$tog.siblings('.hb-accordion-pane').slideDown(200);
2023				hb_animated_contents();
2024				hb_counter();
2025				hb_charts();
2026				hb_progress_bar();
2027			}
2028		});
2029
2030		$j('#main-wrapper').on('click', '.hb-toggle .hb-accordion-tab', function (e) {
2031			e.preventDefault();
2032			var $that = $j(this);
2033
2034			if (!$that.hasClass('active-toggle')) {
2035				$that.addClass('active-toggle').siblings('.hb-accordion-pane').slideDown(200);
2036				hb_animated_contents();
2037				hb_counter();
2038				hb_charts();
2039				hb_progress_bar();
2040			} else {
2041				$j(this).removeClass('active-toggle').siblings('.hb-accordion-pane').slideUp(200);
2042			}
2043		});
2044	}
2045
2046	$j('.map-info-section').on('click', '.minimize-section', function (e) {
2047		e.preventDefault();
2048		$j(this).closest('.map-info-section').toggleClass('minimized');
2049	});
2050	// End Toggle
2051
2052	// Overlay hover
2053	if ($j('.overlay').length) {
2054		$j('.hb-circle-frame a, .hb-box-frame a').hover(
2055			function () {
2056				var $that = $j(this);
2057
2058				$that.find('.overlay').stop().animate(
2059					{
2060						opacity: 0.85,
2061					},
2062					220,
2063					'easeOutCubic'
2064				);
2065
2066				$that
2067					.find('.plus-sign')
2068					.stop()
2069					.animate(
2070						{
2071							top: 50 + '%',
2072						},
2073						420,
2074						'easeOutCubic'
2075					);
2076			},
2077			function () {
2078				var $that = $j(this);
2079				$that.find('.overlay').stop().animate(
2080					{
2081						opacity: 0,
2082					},
2083					220,
2084					'easeOutCubic'
2085				);
2086
2087				$that
2088					.find('.plus-sign')
2089					.stop()
2090					.animate(
2091						{
2092							top: 40 + '%',
2093						},
2094						420,
2095						'easeOutCubic'
2096					);
2097			}
2098		);
2099	}
2100
2101	// Tabs
2102	if ($j('.hb-tabs-wrapper').length) {
2103		$j('.hb-tabs-wrapper ul.nav-tabs').find('li:first').addClass('active');
2104		$j('.wpb_tabs.hb-tabs-wrapper').find('.tab-content:first').show();
2105		var interval = 0;
2106
2107		$j('.wpb_tabs.hb-tabs-wrapper').each(function () {
2108			var $this_el = $j(this);
2109			interval = parseInt($this_el.attr('hb-data-interval')) * 1000;
2110			if (typeof interval !== typeof undefined && interval !== false && interval > 0) {
2111				setInterval(function () {
2112					var $current = $this_el.find('.nav.nav-tabs > li.ui-tabs-active.ui-state-active > a');
2113					var $next = $current.parent().next().find('a');
2114
2115					if ($next.length == 0) {
2116						$next = $this_el.find('.nav.nav-tabs > li:first-child > a');
2117					}
2118
2119					$next.trigger('click');
2120				}, interval);
2121			}
2122		});
2123
2124		$j('.nav-tabs > li > a').click(function (e) {
2125			e.preventDefault();
2126
2127			$j(window).trigger('scroll');
2128			hb_animated_contents();
2129			hb_counter();
2130			hb_charts();
2131			hb_progress_bar();
2132
2133			var tabs_container = $j(this).parent().parent().parent();
2134			var tabs = tabs_container.children('.nav-tabs');
2135			var label = $j(this).attr('id');
2136			var elem = null;
2137
2138			tabs.children('li').removeClass('active');
2139			$j(this).parent().addClass('active');
2140
2141			tabs_container.find('.tab-content').each(function (e) {
2142				if ($j(this).find('.tab-pane').attr('aria-labelledby') == label) {
2143					$j(this).find('.tab-pane').parent().show();
2144				} else {
2145					$j(this).find('.tab-pane').parent().hide();
2146				}
2147			});
2148		});
2149	}
2150
2151	$j('.wpb_tabs_nav li a').click(function () {
2152		$wind.trigger('resize');
2153	});
2154
2155	// Modal
2156	if ($j('.hb-modal-window').length) {
2157		$j('.modal-open').on('click', function (e) {
2158			e.preventDefault();
2159			var $modal_id = $j(this).attr('data-modal-id');
2160
2161			$j('#' + $modal_id)
2162				.parent()
2163				.addClass('hb-visible-modal');
2164
2165			if ($j('#' + $modal_id).hasClass('rendered')) {
2166				setTimeout(function () {
2167					$j('#' + $modal_id).addClass('animate-modal');
2168				}, 220);
2169				$body.addClass('no-scroll');
2170			} else {
2171				if ($j('.hb-accordion').length) {
2172					init_modal_accordion();
2173				}
2174				setTimeout(function () {
2175					$j('#' + $modal_id).addClass('rendered animate-modal');
2176				}, 220);
2177				$body.addClass('no-scroll');
2178			}
2179		});
2180
2181		$j('.hb-modal-window').on('click touchstart', '.close-modal', function (e) {
2182			e.preventDefault();
2183			var $close_id = $j(this).attr('data-close-id');
2184			$j('#' + $close_id).removeClass('animate-modal');
2185			$body.removeClass('no-scroll');
2186			$j('#' + $close_id)
2187				.parent()
2188				.removeClass('hb-visible-modal');
2189		});
2190	}
2191}
2192
2193function init_modal_accordion() {
2194	$j('.hb-accordion').each(function () {
2195		var $that = $j(this);
2196
2197		$that.parent().parent().find('.hb-accordion-tab').removeClass('active-toggle');
2198		$that.parent().parent().find('.hb-accordion-pane').slideUp(200);
2199
2200		var $index = $j(this).attr('data-initialindex');
2201		if ($index != '-1') {
2202			var $tog = $j(this).find('.hb-accordion-single').eq($index).find('.hb-accordion-tab');
2203			$tog.addClass('active-toggle');
2204			$tog.siblings('.hb-accordion-pane').slideDown(200);
2205			hb_animated_contents();
2206			hb_counter();
2207			hb_charts();
2208			hb_progress_bar();
2209		}
2210	});
2211}
2212
2213/* Counter Function */
2214function hb_counter() {
2215	if ($j.exists('.hb-counter') && $j.inviewport) {
2216		/* Counters */
2217		$j('.hb-counter:in-viewport').each(function () {
2218			if (!$j(this).hasClass('activated')) {
2219				var countAsset = $j(this),
2220					countNumber = countAsset.find('.count-number'),
2221					countDivider = countAsset.find('.count-separator').find('span'),
2222					countSubject = countAsset.find('.count-subject'),
2223					countTo = countAsset.find('.count-number').attr('data-to'),
2224					countFrom = countAsset.find('.count-number').attr('data-from'),
2225					countSpeed = parseInt(countAsset.find('.count-number').attr('data-speed'));
2226
2227				countAsset.addClass('activated');
2228
2229				$j({ countNum: countFrom }).animate(
2230					{ countNum: countTo },
2231					{
2232						duration: countSpeed,
2233						easing: 'linear',
2234						step: function () {
2235							countAsset.find('.count-number').text(
2236								Math.floor(this.countNum)
2237									.toString()
2238									.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
2239							);
2240						},
2241						complete: function () {
2242							countAsset.find('.count-number').text(this.countNum.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','));
2243							countDivider.animate({ width: 50 }, 650, 'easeOutCubic');
2244							countSubject.delay(100).animate({ opacity: 1, bottom: '0px' }, 650, 'easeOutCubic');
2245						},
2246					}
2247				);
2248			}
2249		});
2250	}
2251}
2252
2253function highendIsInViewport(element) {
2254	const rect = element.getBoundingClientRect();
2255	return (
2256		rect.top >= 0 &&
2257		rect.left >= 0 &&
2258		rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
2259		rect.right <= (window.innerWidth || document.documentElement.clientWidth)
2260	);
2261}
2262
2263/* Charts */
2264function hb_charts() {
2265	var charts = document.querySelectorAll('.hb-chart');
2266
2267	charts.forEach(function (chart) {
2268		if (null === chart.getAttribute('initialized') && highendIsInViewport(chart)) {
2269			chart.setAttribute('initialized', true);
2270			var $that = $j(chart);
2271			var $animation_speed = $that.attr('data-animation-speed');
2272			var $size = $that.attr('data-barSize');
2273			$that.easyPieChart({
2274				animate: $animation_speed,
2275				lineCap: 'round',
2276				lineWidth: $that.attr('data-lineWidth'),
2277				size: $size,
2278				barColor: $that.attr('data-barColor'),
2279				trackColor: $that.attr('data-trackColor'),
2280				scaleColor: 'transparent',
2281				onStep: function (value) {
2282					this.$el.find('.chart-percent span').text(Math.ceil(value));
2283				},
2284				onStop: function (value) {
2285					this.$el.siblings('.hb-chart-desc').animate({ opacity: 1, bottom: '0px' }, 650, 'easeOutCubic');
2286				},
2287			});
2288		}
2289	});
2290}
2291
2292/* Progress Bar */
2293function hb_progress_bar() {
2294	if ($j.exists('.hb-progress-bar') && $j.inviewport) {
2295		$j('.hb-progress-bar .progress-outer:in-viewport').each(function () {
2296			if (!$j(this).hasClass('activated')) {
2297				$j(this).addClass('activated');
2298				var $that = $j(this);
2299				$that.animate(
2300					{
2301						width: $j(this).attr('data-width') + '%',
2302					},
2303					1400,
2304					'easeOutCubic'
2305				);
2306			}
2307		});
2308	}
2309}
2310
2311/* Contact Forms */
2312function onSuccessSend(results) {
2313	var success_text = $j('#success_text').val();
2314	$j('#hb-submit-contact-panel-form i').attr('class', 'hb-moon-checkmark');
2315	$j('#hb-submit-contact-panel-form').removeClass('hb-asbestos').addClass('hb-nephritis disabled');
2316	$j('#hb-submit-contact-panel-form span.hb-push-button-text').html(success_text);
2317	$j('#hb-submit-contact-panel-form span.hb-push-button-icon').html("<i class='hb-moon-checkmark-2'></i>");
2318
2319	$j('#hb_contact_name_id').attr('disabled', 'disabled');
2320	$j('#hb_contact_email_id').attr('disabled', 'disabled');
2321	$j('#hb_contact_message_id').attr('disabled', 'disabled');
2322}
2323function hb_contact_forms() {
2324	var sent = false;
2325	var nameValidate = false;
2326	var emailValidate = false;
2327	var commentsValidate = false;
2328
2329	$j('#hb_contact_name_id').blur(function () {
2330		nameValidate = $j('#contact-panel-form').validate().element('#hb_contact_name_id');
2331	});
2332	$j('#hb_contact_email_id').blur(function () {
2333		emailValidate = $j('#contact-panel-form').validate().element('#hb_contact_email_id');
2334	});
2335	$j('#hb_contact_message_id').blur(function () {
2336		commentsValidate = $j('#contact-panel-form').validate().element('#hb_contact_message_id');
2337	});
2338
2339	$j('#hb-submit-contact-panel-form').click(function (e) {
2340		e.preventDefault();
2341		if (!sent) {
2342			if ($j('#hb_contact_subject_id').val()) {
2343				alert('Sorry - bots are not allowed!');
2344				return false;
2345			}
2346
2347			if (nameValidate && emailValidate && commentsValidate) {
2348				$j('#contact-name #contact-email, #contact-message').attr('disabled', true);
2349
2350				var data = {};
2351				data.contact_email = $j('#hb_contact_email_id').val();
2352				data.contact_name = $j('#hb_contact_name_id').val();
2353				data.contact_comments = $j('#hb_contact_message_id').val();
2354				data.action = 'mail_action';
2355
2356				$j.post(highend_vars.ajaxurl, data, onSuccessSend);
2357				$j('#hb-submit-contact-panel-form i').attr('class', 'hb-moon-spinner-8');
2358
2359				sent = true;
2360				return;
2361			} else {
2362				$j('#contact-panel-form').validate().form();
2363			}
2364		}
2365	});
2366}
2367
2368function hb_smooth_scroll() {
2369	var offs = 0;
2370
2371	if ($j('#header-inner').hasClass('sticky-nav')) {
2372		offs = highend_vars.sticky_header_height;
2373	}
2374
2375	$j('.smooth-scroll').click(function (e) {
2376		e.preventDefault();
2377
2378		if ($j(this).is('a')) {
2379			var anch = $j(this).attr('href');
2380			$j.scrollTo(anch, 800, { easing: 'easeInOutQuad', offset: -offs });
2381		} else {
2382			var $that = $j(this).find('a');
2383			var anch = $that.attr('href');
2384			$j.scrollTo(anch, 800, { easing: 'easeInOutQuad', offset: -offs });
2385		}
2386	});
2387}
2388
2389/* Other Contact Forms */
2390function hb_contact_forms_spec() {
2391	var sent_spec = false;
2392	var sNameValidate = false;
2393	var sEmailValidate = false;
2394	var sCommentsValidate = false;
2395
2396	$j('#sp-contact-name').blur(function () {
2397		sNameValidate = $j('#sp-contact-form').validate().element('#sp-contact-name');
2398	});
2399	$j('#sp-contact-email').blur(function () {
2400		sEmailValidate = $j('#sp-contact-form').validate().element('#sp-contact-email');
2401	});
2402	$j('#sp-contact-message').blur(function () {
2403		sCommentsValidate = $j('#sp-contact-form').validate().element('#sp-contact-message');
2404	});
2405
2406	$j('#special-submit-form').click(function (e) {
2407		e.preventDefault();
2408		if (!sent_spec) {
2409			if ($j('#hb_contact_subject_id').val()) {
2410				alert('Sorry - bots are not allowed!');
2411				return false;
2412			}
2413
2414			if (sNameValidate && sEmailValidate && sCommentsValidate) {
2415				$j('#sp-contact-name, #sp-contact-email, #sp-contact-message').attr('disabled', true);
2416
2417				var data_s = {};
2418				data_s.contact_email = $j('#sp-contact-email').val();
2419				data_s.contact_name = $j('#sp-contact-name').val();
2420				data_s.contact_comments = $j('#sp-contact-message').val();
2421				data_s.action = 'mail_action';
2422
2423				$j.post(highend_vars.ajaxurl, data_s, onSuccessSendSpec);
2424
2425				sent_spec = true;
2426				return;
2427			} else {
2428				$j('#sp-contact-form').validate().form();
2429			}
2430		}
2431	});
2432}
2433
2434/* Contact Forms */
2435function onSuccessSendSpec(results) {
2436	var success_text = $j('#success_text_special').val();
2437	$j('#special-submit-form i').attr('class', 'hb-moon-checkmark');
2438	$j('#special-submit-form').html(success_text).addClass('disabled-button');
2439
2440	$j('#sp-contact-name').attr('disabled', 'disabled');
2441	$j('#sp-contact-email').attr('disabled', 'disabled');
2442	$j('#sp-contact-message').attr('disabled', 'disabled');
2443}
2444
2445/* Toggle the overlay */
2446function hb_toggle_modal_overlay() {
2447	var $overlay = $j('#hb-modal-overlay');
2448
2449	if ($overlay.length) {
2450		if ($overlay.hasClass('visible')) {
2451			$j('#hb-modal-overlay').fadeOut(220);
2452			$overlay.removeClass('visible');
2453		} else {
2454			$j('#hb-modal-overlay').fadeIn(220);
2455			$overlay.addClass('visible');
2456		}
2457	}
2458}
2459
2460function hb_woo_stuff() {
2461	var $sticky_count = 0;
2462	var $hb_woo_notif = $j('#hb-woo-notif');
2463
2464	if ($hb_woo_notif.length) {
2465		var cart_url = $hb_woo_notif.data('cart-url');
2466		var cart_text = $hb_woo_notif.data('cart-text');
2467		var text = $hb_woo_notif.data('text');
2468	}
2469
2470	$body.bind('added_to_cart', function () {
2471		if ($hb_woo_notif.length) {
2472			var product_name = $j('.product-loading-icon.preloading.hb-spin').parent().parent().siblings('.hb-product-meta-wrapper').find('a h3').text();
2473			var notif = $j(
2474				'<li><div><i class="hb-moon-checkmark-2"></i><span>' + product_name + ' ' + text + ' <a href="' + cart_url + '">' + cart_text + '</a></span></div></li>'
2475			);
2476
2477			if (product_name.length) {
2478				notif.appendTo('#hb-woo-notif').fadeIn(350);
2479				setTimeout(function () {
2480					notif.fadeOut(350);
2481				}, 6000);
2482			}
2483		}
2484
2485		$j('.product-loading-icon').removeClass('preloading hb-spin').addClass('hb-added-to-cart');
2486		if ($j('#sticky-shop-button').length) {
2487			$sticky_count = parseInt($j('#sticky-shop-button').find('span').html()) + 1;
2488			$j('#sticky-shop-button').find('span').html($sticky_count);
2489		}
2490	});
2491
2492	$body.on('click touchstart', '.hb-buy-button', function () {
2493		if (!$j(this).hasClass('no-action-mark')) {
2494			$j(this).parent().find('.product-loading-icon').addClass('preloading hb-spin').removeClass('hb-added-to-cart').css('opacity', '1');
2495
2496			if ($j('.cart-circle-count').length) {
2497				var ctemp = parseInt($j('.cart-circle-count').html());
2498				ctemp++;
2499				$j('.cart-circle-count').html(ctemp);
2500
2501				if (ctemp == 1) {
2502					$j('.cart-tab .contents').html(ctemp + ' item');
2503				} else {
2504					$j('.cart-tab .contents').html(ctemp + ' items');
2505				}
2506			}
2507
2508			if ($j('.hb-cart-total-header').length) {
2509				setTimeout(function () {
2510					if ($j('#top-cart-widget').length) {
2511						var price = $j('#top-cart-widget .amount').html();
2512						$j('.hb-cart-total-header .amount, .cart-tab .amount').html(price);
2513					}
2514				}, 900);
2515			}
2516		}
2517	});
2518
2519	$j(document).on('click', '.plus, .minus', function () {
2520		var b = $j(this).closest('.quantity').find('.qty'),
2521			c = parseFloat(b.val()),
2522			d = parseFloat(b.attr('max')),
2523			e = parseFloat(b.attr('min')),
2524			f = b.attr('step');
2525		(c && '' !== c && 'NaN' !== c) || (c = 0),
2526			('' === d || 'NaN' === d) && (d = ''),
2527			('' === e || 'NaN' === e) && (e = 0),
2528			('any' === f || '' === f || void 0 === f || 'NaN' === parseFloat(f)) && (f = 1),
2529			$j(this).is('.plus') ? b.val(d && (d == c || c > d) ? d : c + parseFloat(f)) : e && (e == c || e > c) ? b.val(e) : c > 0 && b.val(c - parseFloat(f)),
2530			b.trigger('change');
2531	});
2532
2533	var $current_hovered;
2534	$body
2535		.on('mouseenter', '.hb-woo-image-wrap', function () {
2536			$j(this).find('.product-hover-image').css('opacity', '1');
2537			$current_hovered = $j(this);
2538		})
2539		.on('mouseleave', '.hb-woo-image-wrap', function () {
2540			$current_hovered.find('.product-hover-image').css('opacity', '0');
2541		});
2542}
2543
2544function hb_center_me() {
2545	if ($j('.hb-center-me').length) {
2546		$j('.hb-center-me').each(function () {
2547			var $hght = $j(this).outerHeight() / 2;
2548			$j(this).css('margin-top', -$hght + 'px');
2549		});
2550	}
2551}
2552
2553function hb_center_vertically() {
2554	var max = 0;
2555	var $cols = null;
2556
2557	if ($j('.hb-center-vertically').length && $wind.width() > 767) {
2558		$j('.hb-center-vertically').each(function () {
2559			$cols = $j(this).parent().children('.wpb_column');
2560			$cols.css('height', 'auto');
2561			max = Math.max.apply(
2562				Math,
2563				$cols.map(function () {
2564					return $j(this).innerHeight();
2565				})
2566			);
2567			$cols.css('height', max);
2568		});
2569	} else if ($j('.hb-center-vertically').length && $wind.width() < 767) {
2570		$j('.hb-center-vertically').parent().children('.wpb_column').css('height', 'auto');
2571	}
2572}
2573
2574function hb_count_gallery_filters() {
2575	if ($j('.hb-grid-filter').length) {
2576		var $that = null;
2577		var $filter = null;
2578		var $filter_count = null;
2579		var count = 0;
2580
2581		$j('.hb-grid-filter .hb-gallery-dropdown li').each(function () {
2582			$that = $j(this);
2583			$filter = $that.find('a').attr('data-filter');
2584			$filter_count = $that.find('a').find('.hb-filter-count');
2585
2586			if ($filter == '*') {
2587				// Count all gallery items
2588				count = $j('.fw-gallery-wrap .elastic-item').length;
2589			} else {
2590				// Count for each category
2591				count = $j('.fw-gallery-wrap .' + $filter).length;
2592			}
2593			$filter_count.html('(' + count + ')');
2594		});
2595	} else if ($j('.standard-gallery-filter').length) {
2596		var $that = null;
2597		var $filter = null;
2598		var $filter_count = null;
2599		var count = 0;
2600
2601		$j('.filt-tabs li').each(function () {
2602			$that = $j(this);
2603			$filter = $that.find('a').attr('data-filter');
2604			$filter_count = $that.find('a').find('.item-count');
2605
2606			if ($filter == '*') {
2607				// Count all gallery items
2608				count = $j('#standard-gallery-masonry .standard-gallery-item-wrap').length;
2609			} else {
2610				// Count for each category
2611				count = $j('#standard-gallery-masonry ' + $filter).length;
2612			}
2613			$filter_count.html(count);
2614		});
2615	}
2616}
2617
2618function hb_faq_filter() {
2619	if ($j('.faq-filter').length) {
2620		var $elems = $j('.faq-filter li a');
2621		var $data_filter = null;
2622
2623		if ($j('.faq-filter').length) {
2624			$elems.each(function () {
2625				$that = $j(this);
2626				$data_filter = $that.attr('data-filter');
2627
2628				if ($data_filter == '*') {
2629					$that.find('.hb-filter-count').html($j('.faq-module-wrapper').find('.hb-toggle').length);
2630				} else {
2631					$that.find('.hb-filter-count').html($j('.faq-module-wrapper').find('.' + $data_filter).length);
2632				}
2633			});
2634		}
2635
2636		$doc.on('touchstart click', '.faq-filter li a', function (event) {
2637			event.stopPropagation();
2638			event.preventDefault();
2639			if (event.handled !== true) {
2640				$that = $j(this);
2641				$data_filter = $that.attr('data-filter');
2642
2643				$j('.faq-module-wrapper').find('.selected').removeClass('selected');
2644				$that.parent().addClass('selected');
2645
2646				if ($data_filter == '*') {
2647					$j('.faq-module-wrapper').find('.hb-toggle').slideDown(0);
2648				} else {
2649					$j('.faq-module-wrapper').find('.hb-toggle').slideUp(0);
2650					$j('.faq-module-wrapper')
2651						.find('.' + $data_filter)
2652						.slideDown(0);
2653				}
2654
2655				event.handled = true;
2656			} else {
2657				return false;
2658			}
2659		});
2660	}
2661}
2662
2663function hb_modal_on_load() {
2664	if ($j('.modal-show-on-load').length) {
2665		$j('.modal-show-on-load').each(function () {
2666			var $that = $j(this);
2667
2668			var $modal_id = $that.attr('id');
2669
2670			$j('#' + $modal_id)
2671				.parent()
2672				.addClass('hb-visible-modal');
2673			if ($j('#' + $modal_id).hasClass('rendered')) {
2674				setTimeout(function () {
2675					$j('#' + $modal_id).addClass('animate-modal');
2676				}, 220);
2677				$body.addClass('no-scroll');
2678			} else {
2679				setTimeout(function () {
2680					$j('#' + $modal_id).addClass('rendered animate-modal');
2681				}, 220);
2682				$body.addClass('no-scroll');
2683			}
2684		});
2685
2686		/* Countdowns */
2687		if ($j('.hb-countdown-unit').length) {
2688			var date_value;
2689
2690			$j('.hb-countdown-unit').each(function () {
2691				date_value = $j(this).attr('data-date');
2692				$j(this).highendCountdown({
2693					date: date_value,
2694					format: 'on',
2695				});
2696			});
2697		}
2698	}
2699}
2700
2701function hb_pagination_ajax() {
2702	pagination_count = highend_vars.paged;
2703
2704	var $container = $j('#hb-blog-posts');
2705	var col_count = $container.attr('data-column-size');
2706	var category = $container.attr('data-categories');
2707
2708	if ($container.siblings('.load-more-posts').length) {
2709		$container.addClass('masonry-holder');
2710
2711		$j('.load-more-posts').on('click', function (e) {
2712			e.preventDefault();
2713			if (!$j(this).hasClass('inactive')) {
2714				$j('.load-more-posts > .load-more-text ').hide(0);
2715				$j('.load-more-posts > .hb-spin').toggleClass('non-visible');
2716				load_article(pagination_count, $j(this).data('postid'), $j(this).data('template'), $j(this).data('query-vars'));
2717				pagination_count++;
2718			}
2719		});
2720	}
2721
2722	var load_article = function (paged, post_id, template, query_vars) {
2723		var data = {
2724			action: 'highend_pagination_ajax',
2725			_ajax_nonce: highend_vars.nonce,
2726			paged: paged,
2727			post_id: post_id,
2728			template: template,
2729			query_vars: query_vars,
2730			// category: category,
2731			// col_count: col_count,
2732		};
2733
2734		$j.post(highend_vars.ajaxurl, data, function (response) {
2735			if ('string' === typeof response && '' !== response.trim()) {
2736				$j('.load-more-posts > .load-more-text').html(highend_vars.texts['load-more']).show(0);
2737				$j('.load-more-posts > .hb-spin').addClass('non-visible');
2738				//jQuery("#hb-blog-posts").append(html);    // This will be the div where our content will be loaded
2739
2740				var $to_insert = $j(response);
2741				$container.append($to_insert).isotope('appended', $to_insert);
2742
2743				$container.imagesLoaded(function () {
2744					$container.isotope();
2745				});
2746
2747				if ($to_insert.find('.hb-flexslider').length) {
2748					$to_insert.find('.hb-flexslider').trigger('init');
2749				}
2750			} else {
2751				$j('.load-more-posts > .load-more-text').html(highend_vars.texts['no-more-posts']).show(0).parent().addClass('inactive');
2752				$j('.load-more-posts > .hb-spin').addClass('non-visible');
2753			}
2754		});
2755
2756		return false;
2757	};
2758}
2759
2760function highendStickyHeader() {
2761	if (document.body.classList.contains('hb-side-navigation')) {
2762		return;
2763	}
2764
2765	var header = document.getElementById('header-inner');
2766	var headerInner = document.getElementById('header-inner-bg');
2767
2768	if (null == header || null == headerInner) {
2769		return;
2770	}
2771
2772	if (!header.classList.contains('sticky-nav')) {
2773		return;
2774	}
2775
2776	if (header.classList.contains('nav-type-2')) {
2777		header = document.querySelector('.main-navigation-container');
2778		headerInner = document.querySelector('.main-navigation');
2779	}
2780
2781	var wpadminbar = document.getElementById('wpadminbar');
2782	var stickyPosition = headerInner.getBoundingClientRect().top;
2783	var tolerance;
2784
2785	if (null === wpadminbar) {
2786		tolerance = 0;
2787	} else if (window.outerWidth <= 600) {
2788		tolerance = 0;
2789	} else {
2790		tolerance = wpadminbar.getBoundingClientRect().height;
2791	}
2792
2793	var stickyPlaceholder = null;
2794	var sticky = stickyPosition - tolerance < 0;
2795
2796	var checkPosition = function () {
2797		if (null === wpadminbar) {
2798			tolerance = 0;
2799		} else if (window.outerWidth <= 600) {
2800			tolerance = 0;
2801		} else {
2802			tolerance = wpadminbar.getBoundingClientRect().height;
2803		}
2804
2805		stickyPosition = header.getBoundingClientRect().top;
2806		sticky = stickyPosition - tolerance < 0;
2807
2808		maybeStickHeader();
2809	};
2810
2811	var maybeStickHeader = function () {
2812		if (sticky) {
2813			if (!document.body.classList.contains('highend-sticky-header')) {
2814				stickyPlaceholder = document.createElement('div');
2815				stickyPlaceholder.setAttribute('id', 'highend-sticky-placeholder');
2816
2817				stickyPlaceholder.style.height = header.getBoundingClientRect().height + 'px';
2818
2819				header.appendChild(stickyPlaceholder);
2820
2821				document.body.classList.add('highend-sticky-header');
2822			}
2823		} else {
2824			if (document.body.classList.contains('highend-sticky-header')) {
2825				document.body.classList.remove('highend-sticky-header');
2826				document.getElementById('highend-sticky-placeholder').remove();
2827			}
2828		}
2829	};
2830
2831	// Initial check.
2832	maybeStickHeader();
2833
2834	// Debounce scroll.
2835	window.addEventListener('scroll', function () {
2836		highendDebounce(checkPosition());
2837	});
2838
2839	// Debounce resize.
2840	window.addEventListener('resize', function () {
2841		highendDebounce(checkPosition());
2842	});
2843}
2844
2845/**
2846 * Re-written in plain JS in v3.6.14.
2847 */
2848function highendOnePageNav() {
2849	if (null == main_wrapper || !main_wrapper.classList.contains('hb-one-page')) {
2850		return;
2851	}
2852
2853	var header = document.getElementById('header-inner');
2854	var bullets = document.getElementById('hb-one-page-bullets');
2855
2856	// Calculate scroll offset.
2857	var getOffset = () => {
2858		var offset = 0;
2859
2860		if (header && header.classList.contains('sticky-nav')) {
2861			offset = parseInt(highend_vars.sticky_header_height);
2862		}
2863
2864		if (document.getElementById('wpadminbar')) {
2865			offset += document.getElementById('wpadminbar').clientHeight;
2866		}
2867
2868		return offset;
2869	};
2870
2871	// Get offset.
2872	var offset = getOffset();
2873
2874	// Add bullets for each one page section.
2875	document.querySelectorAll('.hb-one-page-section').forEach((item) => {
2876		var li = document.createElement('li');
2877		li.classList.add('hb-animate-element', 'top-to-bottom');
2878		li.setAttribute('rel', 'tooltip');
2879		li.setAttribute('data-placement', 'right');
2880
2881		if (item.getAttribute('data-title')) {
2882			li.setAttribute('title', item.getAttribute('data-title'));
2883		}
2884
2885		var anch = document.createElement('a');
2886		anch.setAttribute('href', '#' + item.getAttribute('id'));
2887
2888		var i = document.createElement('i');
2889		i.classList.add('hb-moon-radio-unchecked');
2890
2891		anch.appendChild(i);
2892		li.appendChild(anch);
2893		bullets.append(li);
2894	});
2895
2896	// Center bullets vertically.
2897	bullets.style.marginTop = -(bullets.clientHeight / 2) + 'px';
2898
2899	// Listen for menu clicks.
2900	document.querySelectorAll('#main-nav li a, #hb-side-menu li a, #hb-one-page-bullets li a').forEach((item) => {
2901		var section_id = item.getAttribute('href');
2902
2903		if (section_id.length <= 1 || '#' !== section_id[0]) {
2904			return;
2905		}
2906
2907		var section = document.querySelector(section_id);
2908
2909		if (section) {
2910			item.addEventListener('click', (e) => {
2911				e.preventDefault();
2912
2913				window.scroll({
2914					top: section.getBoundingClientRect().top + window.scrollY - offset,
2915					behavior: 'smooth',
2916				});
2917			});
2918		}
2919	});
2920}

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.