var global_work_page  =  0;

function global_nav_js_handler ( ) {

	if ( ! document.getElementById ) { return; }

	/* Find the first "page abbr" in the URL */
	var regex    =  /^http?:\/\/[^\/]*\/([^\/]*)\/?.*$/;
	//var work_regex  =  /^https?:\/\/[^\/]*\/(shared_|)(work)\/.*$/;
	var matches     =  window.location.href.match( regex );
	var abbr        =  '';

	if ( matches ) {
		abbr  =  matches[1];
	} else {
		return;
	}
	
	var nav_element  =  document.getElementById( 'nav-'+abbr );
	
	if ( ! nav_element ) {
		nav_element  =  document.getElementById( 'nav_home' );
	}

	if ( ! nav_element ) { return; }

	nav_element.className  =  'on-nav';

	return true;

}

function sub_nav_js_handler ( ) {

	if ( ! document.getElementById ) { return; }

	var regex    =  /^http?:\/\/[^\/]*\/[^\/]*\/([^\/]*)\/?.*$/;
	//var work_regex  =  /^https?:\/\/[^\/]*\/(shared_|)(work)\/.*$/;
	var matches     =  window.location.href.match( regex );
	var abbr        =  '';

	if ( matches ) {
		abbr  =  matches[1];
	} else {
		return;
	}

	var nav_element  =  document.getElementById( 'sub-nav-'+matches[1] );

	if ( ! nav_element ) { return; }

	nav_element.className  =  'on-sub-nav';

	return true;

}

function sub_sub_nav_js_handler ( ) {

	if ( ! document.getElementById ) { return; }

	/* Find the first "page abbr" in the URL */
	var regex    =  /^http?:\/\/[^\/]*\/[^\/]*\/[^\/]*\/([^\/]*)\/?.*$/;
	//var work_regex  =  /^https?:\/\/[^\/]*\/(shared_|)(work)\/.*$/;
	var matches     =  window.location.href.match( regex );
	var abbr        =  '';

	if ( matches ) {
		abbr  =  matches[1];
	} else {
		return;
	}

	var nav_element  =  document.getElementById( 'sub-sub-nav-'+matches[1] );

	if ( ! nav_element ) { return; }

	nav_element.className  =  'on-sub-sub-nav';

	return true;

}
