﻿/**
* exmenu.ext.js
*
* @requires jQuery exmenu plugin <http://irama.org/web/dhtml/exmenu/>
*/
jQuery(document).ready(function() {
    openSectionNav();
});

/**
* Opens section nav to the last open page link where the current page does NOT exist in section nav 
* (e.g. technical publication child pages do NOT appear in section nav)
*/
function openSectionNav() {
    // validate nav section exists and current page link does NOT exist
    if (jQuery('#nav-section').size() > 0 && jQuery('#nav-section a.current-page').size() == 0) {
        // get reference to last open page link in nav
        var openNavTo = jQuery('#nav-section a.open:last');

        if (openNavTo.size() > 0) {
            // open nav to last open page link
            jQuery('#nav-section').exmenu(
				'setCurrent', openNavTo.text()
			);
        }
    }
}

