jQuery(function() {
initOpenClose();
initCustomForms();
initMobileNav();
initAnchors();
initRetinaCover();
initDropDownClasses();
initTabNav();
initFormToggle();
initAccordion();
initNavActive();
initMap();
initSearch();
initWasThisHelpful();
initHeadingAnchors();
initFixedBlock();
initAnimateSteps();
initActiveSideNav();
initSwiper();
});
jQuery(function () {
jQuery('[data-toggle="tooltip"]').tooltip()
jQuery('[data-toggle="popover"]').popover()
})
jQuery(document).ready(function($) {
if ($('#navbar').length > 0) {
$('body')
.attr('data-spy', 'scroll')
.attr('data-offset', 0)
.attr('data-target', '#navbar');
jQuery('body').scrollspy();
}
});
function initAnimateSteps() {
AOS.init({duration: 1200});
}
// fixed block init
function initFixedBlock() {
var isTouchDevice = /MSIE 10.*Touch/.test(navigator.userAgent) || ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
if (isTouchDevice) {
jQuery('body').addClass('touchdevice');
}
//data-spy="scroll" data-target="#navbar" data-offset="0"
jQuery('body')
.addClass('fixed-ready');
jQuery('.two-columns').fixedSlideBlock({
slideBlock: '#sidebar',
fakeFixed: '
',
onInit: function(options, holder, fixedBlock, fakeBlock) {
options.resizeFakeBlock = function() {
fakeBlock.css({height: fixedBlock.outerHeight(true)});
};
options.resizeFixedBlock = function() {
fixedBlock.css({width: fakeBlock.width()});
};
options.resizeFakeBlock();
options.resizeFixedBlock();
},
onResize: function(options, holder, fixedBlock, fakeBlock) {
options.resizeFakeBlock();
options.resizeFixedBlock();
}
});
}
function initActiveSideNav() {
jQuery(document).ready(function ($) {
$('.section-nav a[href^="#"]').on('click', function (e) {
e.preventDefault();
$('.section-nav a').each(function () {
$(this).removeClass('active');
});
$(this).addClass('active');
var target = this.hash;
var $target = jQuery(target);
$('html, body').stop().animate({
'scrollTop': $target.offset().top
}, 500, 'swing', function () {
window.location.hash = target;
});
});
});
}
function initHeadingAnchors() {
jQuery('.body-content h2').each(function(index) {
var id = jQuery(this).attr('id');
var text = jQuery(this).text();
var text_no_space = text.replace(/ /g,'');
jQuery(this).attr('id',text_no_space);
if( jQuery('.on-this-page').length ){
jQuery('.link-holder').append(''+text+'
');
} else {
jQuery(' .content').prepend('On this Page');
jQuery('.link-holder').append(''+text+'
');
}
//$('.summary').append(header);
});
}
function initWasThisHelpful() {
jQuery(document).on('change', 'input[name="was_this_page_helpful_"]', function() {
if(jQuery("input[name='was_this_page_helpful_']:checked")) {
jQuery('.webform-submission-form > .container > .feedback_container').addClass('d-flex');
jQuery('.captcha').css('display', 'block');
} else {
jQuery('.webform-submission-form > .container > .feedback_container').removeClass('d-flex');
jQuery('.captcha').css('display', 'none');
}
});
}
function initNavActive() {
var sideNav = jQuery('aside #accordion');
var activeLink = sideNav.find('.active');
var i = 0;
var currentActive = sideNav.find('.active');
while (i < 4) {
activeLink = activeLink.parents('.collapse');
if (activeLink) {
activeLink.addClass('show');
activeLink.find('.accordion-opener.active').addClass('collapsed').attr('aria-expanded', true);
//activeLink.find('.accordion-opener.notactive').addClass('collapsed').attr('aria-expanded', false);
currentActive.closest('.accordion-holder').find('.accordion-opener.active').addClass('collapsed').attr('aria-expanded', true);
}
i++;
}
}
jQuery(function () {
jQuery('[data-toggle="tooltip"]').tooltip({ trigger : 'click', container: '#wrapper'});
jQuery('[data-toggle="tooltip"]').click(function(e) {
e.preventDefault();
});
jQuery('[data-toggle="tooltip"]').on('show.bs.tooltip', function() {
// Only one tooltip should ever be open at a time
jQuery('[data-toggle="tooltip"]').not(this).tooltip('hide');
});
jQuery(document).on('click', function(event) {
if(jQuery(event.target).closest('[data-toggle="tooltip"]').length === 0){
jQuery('[data-toggle="tooltip"]').tooltip('hide');
}
});
//find tables in content and wrap in responsvie div
jQuery('table').wrap('');
});
function initSearch() {
var url = jQuery('.search-form input[type="radio"]:checked').val();
jQuery('.search-form input[type="radio"]').on('click', function() {
url = jQuery(this).val();
});
jQuery('.search-form').submit(function(event) {
var search = jQuery('input[name="query"]', this).val();
search = search.replace("&", "%26");
if (url === '/search/node') {
url = url + "#stq=" + search + "&stp=1&q="+search;
} else {
url = url + "?query=" + search;
}
jQuery(this).attr('action', url);
});
}
function initMap (){
if (typeof google.maps === 'undefined') return;
var latLng = {lat: -37.810833, lng: 144.962876};
var map = new google.maps.Map(
document.getElementById('map'),
{center: new google.maps.LatLng(latLng), zoom: 16});
var marker = new google.maps.Marker({
position: latLng,
map: map,
icon: 'images/location.svg',
});
}
function validateForm() {
var errorMessage = "Please complete the following fields:";
var errorElements = new Array();
var node;
var result;
var node_focus = null;
// Check textarea
var node = document.getElementById("textarea");
if( node && node.value == "" ) {
result = "\nYou must enter your feedback";
errorElements.push(result);
showError(node, result);
node_focus = node;
}
if( node_focus != null ) {
for(i=0; i < errorElements.length; i++ ) {
errorMessage += "\n" + errorElements[i];
} // end for
alert(errorMessage);
if( node_focus )
node_focus.focus();
return false;
} else {
// supress submit for test; for a real form, return true
alert("If this were a real form, you would have just submitted it.");
return false;
}
}
function checkFirst(event) {
var node = getTarget(event);
var result;
if( node.value == "" ) {
var result = "You must enter your feedback";
} else {
result = "";
} // endif
showError(node, result);
return stopPropagation( event);
}
function showError(node, message) {
var id = node.id + "_error";
var node_error = document.getElementById( id );
if( node_error )
node_error.innerHTML = "In valid: " + message;
if( message == "" ) {
node.setAttribute('aria-invalid', 'false');
node_error.style.display = "none";
} else {
node.setAttribute('aria-invalid', 'true');
node_error.style.display = "inline";
}
}
function getTarget( event ) {
var e = event || window.event;
if( e.target )
return e.target;
else
return e.srcElement;
}
function stopPropagation( event ) {
if( event.stopPropagation )
event.stopPropagation();
if( event.preventDefault )
event.preventDefault();
if( event.cancelBubble)
event.cancelBubble = true;
if(event.returnValue)
event.returnValue = false;
return false;
}
function initFormToggle() {
jQuery(document).on('click', 'input[name="was_this_page_helpful_"]', function() {
jQuery('#comment-div, #button-div').show();
if (this.value=='Yes'){
jQuery('#edit-was-this-page-helpful-yes').prop('checked',true);
}
if (this.value=='No'){
jQuery('#edit-was-this-page-helpful-no').prop('checked',true);
}
});
jQuery(document).on('click', function(event) {
if(jQuery(event.target).closest('.webform-submission-was-this-page-helpful-form').length === 0){
jQuery('#comment-div, #button-div').hide();
jQuery('.webform-submission-was-this-page-helpful-form').trigger('reset');
}
});
}
// open-close init
function initOpenClose() {
jQuery('.load-more-content').openClose({
activeClass: 'active',
opener: '.see-more',
slider: '.slide',
animSpeed: 400,
effect: 'slide'
});
}
jQuery(function() {
initBrowserDetect(false, true);
});
// accordion menu init
function initAccordion() {
ResponsiveHelper.addRange({
'..1199': {
on: function() {
jQuery('.navbar-nav').slideAccordion({
opener: '>.drop-opener',
slider: '>.menu-drop',
animSpeed: 300,
collapsible:true,
});
},
off: function() {
jQuery('.navbar-nav').slideAccordion('destroy');
}
}
});
/**
* Collapse all open accordions related to parent.
* @type {*|jQuery|HTMLElement}
*/
let accordions = jQuery('div.content .accordion');
jQuery(accordions).each(function() {
let accordion = jQuery(this);
jQuery(accordion).on('show.bs.collapse',function() {
jQuery(this).find('.collapse.show').collapse('hide');
});
});
}
// initialize custom form elements
function initCustomForms() {
jcf.setOptions('Select', {
wrapNative: false,
wrapNativeOnMobile: false,
fakeDropInBody: true,
});
jcf.setOptions('Checkbox', {
wrapNative: false,
wrapNativeOnMobile: false,
fakeDropInBody: true,
});
jcf.replaceAll();
}
// mobile menu init
function initMobileNav() {
jQuery('body').mobileNav({
menuActiveClass: 'nav-active',
menuOpener: '.js-nav-opener'
});
jQuery('body').mobileNav({
menuActiveClass: 'search-active',
menuOpener: '.js-search-opener'
});
}
// initialize smooth anchor links
function initAnchors() {
new SmoothScroll({
anchorLinks: '.js-smooth-scroll',
extraOffset: 0,
wheelBehavior: 'none'
});
}
function initRetinaCover() {
jQuery('.bg-stretch').retinaCover();
}
// add classes if item has dropdown
function initDropDownClasses() {
jQuery('.navbar-nav li').each(function() {
var item = jQuery(this);
var drop = item.find('ul');
var link = item.find('a').eq(0);
if (drop.length) {
item.addClass('has-drop-down');
if (link.length) link.addClass('has-drop-down-a');
}
});
}
// "tab" key handling
function initTabNav() {
jQuery('.navbar-nav').tabNav({
items: 'li'
});
jQuery('.filter-list').tabNav({
items: 'li'
});
}
/*
* jQuery Open/Close plugin
*/
;(function($) {
function OpenClose(options) {
this.options = $.extend({
addClassBeforeAnimation: true,
hideOnClickOutside: false,
activeClass: 'active',
opener: '.opener',
slider: '.slide',
animSpeed: 400,
effect: 'fade',
event: 'click'
}, options);
this.init();
}
OpenClose.prototype = {
init: function() {
if (this.options.holder) {
this.findElements();
this.attachEvents();
this.makeCallback('onInit', this);
}
},
findElements: function() {
this.holder = $(this.options.holder);
this.opener = this.holder.find(this.options.opener);
this.slider = this.holder.find(this.options.slider);
},
attachEvents: function() {
// add handler
var self = this;
this.eventHandler = function(e) {
e.preventDefault();
if (self.slider.hasClass(slideHiddenClass)) {
self.showSlide();
} else {
self.hideSlide();
}
};
self.opener.on(self.options.event, this.eventHandler);
// hover mode handler
if (self.options.event === 'hover') {
self.opener.on('mouseenter', function() {
if (!self.holder.hasClass(self.options.activeClass)) {
self.showSlide();
}
});
self.holder.on('mouseleave', function() {
self.hideSlide();
});
}
// outside click handler
self.outsideClickHandler = function(e) {
if (self.options.hideOnClickOutside) {
var target = $(e.target);
if (!target.is(self.holder) && !target.closest(self.holder).length) {
self.hideSlide();
}
}
};
// set initial styles
if (this.holder.hasClass(this.options.activeClass)) {
$(document).on('click touchstart', self.outsideClickHandler);
} else {
this.slider.addClass(slideHiddenClass);
}
},
showSlide: function() {
var self = this;
if (self.options.addClassBeforeAnimation) {
self.holder.addClass(self.options.activeClass);
}
self.slider.removeClass(slideHiddenClass);
$(document).on('click touchstart', self.outsideClickHandler);
self.makeCallback('animStart', true);
toggleEffects[self.options.effect].show({
box: self.slider,
speed: self.options.animSpeed,
complete: function() {
if (!self.options.addClassBeforeAnimation) {
self.holder.addClass(self.options.activeClass);
}
self.makeCallback('animEnd', true);
}
});
},
hideSlide: function() {
var self = this;
if (self.options.addClassBeforeAnimation) {
self.holder.removeClass(self.options.activeClass);
}
$(document).off('click touchstart', self.outsideClickHandler);
self.makeCallback('animStart', false);
toggleEffects[self.options.effect].hide({
box: self.slider,
speed: self.options.animSpeed,
complete: function() {
if (!self.options.addClassBeforeAnimation) {
self.holder.removeClass(self.options.activeClass);
}
self.slider.addClass(slideHiddenClass);
self.makeCallback('animEnd', false);
}
});
},
destroy: function() {
this.slider.removeClass(slideHiddenClass).css({
display: ''
});
this.opener.off(this.options.event, this.eventHandler);
this.holder.removeClass(this.options.activeClass).removeData('OpenClose');
$(document).off('click touchstart', this.outsideClickHandler);
},
makeCallback: function(name) {
if (typeof this.options[name] === 'function') {
var args = Array.prototype.slice.call(arguments);
args.shift();
this.options[name].apply(this, args);
}
}
};
// add stylesheet for slide on DOMReady
var slideHiddenClass = 'js-slide-hidden';
(function() {
var tabStyleSheet = $('