function string_to_number( string ) { if ( typeof string === 'number' ) { return string; } if ( typeof string === 'string' ) { var n = string.match(/[^\d\.]+$/); if ( ! n ) { n = string.match(/[\d\.]+$/); } if (n) { return parseFloat(n[0]); } else { return 0; } } return 0; } function string_to_bool( v ) { if ( typeof v === 'boolean' ){ return v; } if ( typeof v === 'number' ){ return v === 0 ? false : true; } if ( typeof v === 'string' ){ if ( v === 'true' || v === '1' ) { return true; } else { return false; } } return false; } /** * skip-link-focus-fix.js * * Helps with accessibility for keyboard only users. * * Learn more: https://git.io/vWdr2 */ ( function() { var is_webkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1, is_opera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1, is_ie = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1; if ( ( is_webkit || is_opera || is_ie ) && document.getElementById && window.addEventListener ) { window.addEventListener( 'hashchange', function() { var id = location.hash.substring( 1 ), element; if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) { return; } element = document.getElementById( id ); if ( element ) { if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) { element.tabIndex = -1; } element.focus(); } }, false ); } })(); /** * navigation.js * * Handles toggling the navigation menu for small screens and enables tab * support for dropdown menus. */ ( function() { var container, button, menu, links, subMenus; container = document.getElementById( 'site-navigation' ); if ( ! container ) { return; } button = container.getElementsByTagName( 'button' )[0]; if ( 'undefined' === typeof button ) { return; } menu = container.getElementsByTagName( 'ul' )[0]; // Hide menu toggle button if menu is empty and return early. if ( 'undefined' === typeof menu ) { button.style.display = 'none'; return; } menu.setAttribute( 'aria-expanded', 'false' ); if ( -1 === menu.className.indexOf( 'nav-menu' ) ) { menu.className += ' nav-menu'; } button.onclick = function() { if ( -1 !== container.className.indexOf( 'toggled' ) ) { container.className = container.className.replace( ' toggled', '' ); button.setAttribute( 'aria-expanded', 'false' ); menu.setAttribute( 'aria-expanded', 'false' ); } else { container.className += ' toggled'; button.setAttribute( 'aria-expanded', 'true' ); menu.setAttribute( 'aria-expanded', 'true' ); } }; // Get all the link elements within the menu. links = menu.getElementsByTagName( 'a' ); subMenus = menu.getElementsByTagName( 'ul' ); // Set menu items with submenus to aria-haspopup="true". for ( var i = 0, len = subMenus.length; i < len; i++ ) { subMenus[i].parentNode.setAttribute( 'aria-haspopup', 'true' ); } // Each time a menu link is focused or blurred, toggle focus. for ( i = 0, len = links.length; i < len; i++ ) { links[i].addEventListener( 'focus', toggleFocus, true ); links[i].addEventListener( 'blur', toggleFocus, true ); } /** * Sets or removes .focus class on an element. */ function toggleFocus() { var self = this; // Move up through the ancestors of the current link until we hit .nav-menu. while ( -1 === self.className.indexOf( 'nav-menu' ) ) { // On li elements toggle the class .focus. if ( 'li' === self.tagName.toLowerCase() ) { if ( -1 !== self.className.indexOf( 'focus' ) ) { self.className = self.className.replace( ' focus', '' ); } else { self.className += ' focus'; } } self = self.parentElement; } } } )(); jQuery( document ).ready( function( $ ){ var mobile_max_width = 1140; // Media max width for mobile var main_navigation = jQuery('.main-navigation .nav-menu'); var stite_header = $( '.site-header' ); /** * Initialise Menu Toggle */ jQuery('#nav-toggle').on('click', function(event){ event.preventDefault(); jQuery('#nav-toggle').toggleClass('nav-is-visible'); jQuery('body').toggleClass('body-nav-is-visible'); jQuery('.main-navigation .nav-menu').toggleClass("nav-menu-mobile"); jQuery('.header-widget').toggleClass("header-widget-mobile"); if ( main_navigation.hasClass( 'nav-menu-mobile' ) && $( window).width() <= mobile_max_width ) { var h = $( window).height( ) - stite_header.height(); main_navigation.css( { height: h, overflow: 'auto', }); } else { main_navigation.removeAttr( 'style' ); } }); $( window).resize( function(){ if ( main_navigation.hasClass( 'nav-menu-mobile' ) && $( window).width() <= mobile_max_width ) { var h = $( window).height( ) - stite_header.height(); main_navigation.css( { height: h, overflow: 'auto', }); } else { main_navigation.removeAttr( 'style' ); } } ); jQuery('.nav-menu li.menu-item-has-children, .nav-menu li.page_item_has_children').each( function() { jQuery(this).prepend(''); }); jQuery('.nav-toggle-subarrow, .nav-toggle-subarrow .nav-toggle-subarrow').click( function () { jQuery(this).parent().toggleClass("nav-toggle-dropdown"); } ); /** * Fixed header * */ var is_fixed_header = $('.site-header.sticky-header').length > 0 ? true: false; var is_transparent = false; if ( $('.site-header.sticky-header').hasClass( 'transparent' ) ){ is_fixed_header = true; is_transparent = true; } if ( is_fixed_header ) { $('.site-header.sticky-header').eq(0).wrap( '