/* Simple recursing script to highlight appropriate items in left hand nav */
 var pageUrl = String(window.self.location);
 var pageSplit = pageUrl.split('/');
 var Url = pageSplit[pageSplit.length -1];
var hireNav = {
nav_id: 'leftNav', // SET THIS - this is the id of your topmost <ul>
displayLoop: function(el) {
// set the link LI itself
if (el.className == 'separator') {
 el.className+=' selected';
}
else {
 el.className = 'selected';
 }
el.parentNode.style.display = 'block';
// if this <li> has a child ul specifically in it
var neighbour = el.childNodes;
for (var i=0; i<neighbour.length; i++){
if (neighbour[i].nodeName == 'UL') {
neighbour[i].style.display = 'block';
}
}
// carry on up the tree
var parEl = el.parentNode.parentNode;
if (parEl.nodeName == 'LI') {
this.displayLoop(parEl);
}
},
// initialise
init: function() {
// get the LH nav:
var nav = document.getElementById(this.nav_id);
// first collapse all child ul items
var childEls = nav.getElementsByTagName('ul');
for (var i=0; i<childEls.length; i++){
childEls[i].style.display = 'none'; 
}
// nav_override can be used to 'cheat' - use it in an html page, ie: var nav_override = "not_my_filename.html";
if (typeof(nav_override)!="undefined") {
// if "override" is set in the html page, that's our "loc" var
var loc = nav_override;
} else {
// get the current location as string
var loc = String(window.self.location);
loc = loc.toLowerCase();
// get the text from the last '/'
locArr = loc.split('/');
loc = locArr[locArr.length -1];
}
// loop through all the links till we find the correct one:
var linksArr = nav.getElementsByTagName('a');
var currLink = '';
for (var i=0; i<linksArr.length; i++) {
//currLink = linksArr[i].getProperty('href');
currLink = linksArr[i].getAttribute('href');
currLink = currLink.toLowerCase();
if (currLink.search(/\//) != -1) {
var currSplit = currLink.split('/');
currLink = currSplit[currSplit.length -1];
}
// currLink ends up as a lowercase string filename - ie 'this.html'
if (loc == currLink) {
// check for a parent element:
this.displayLoop(linksArr[i].parentNode); // send this <li> up
}
}
}
}
function utilityNav(){
 var utilityNav = document.getElementById("subNav");
 var utilityNavA = utilityNav.getElementsByTagName('a');
 
 //loop through ul with an id of subnav and get the value of the hrefs
 for(var j=0; j < utilityNavA.length; j++){
 subCurrLink = utilityNavA[j].getAttribute('href');  
 subCurrLink = subCurrLink.toLowerCase();
 if (subCurrLink.search(/\//) != -1) {
  var subCurrLink = subCurrLink.split('/');
  subCurrLink = subCurrLink[subCurrLink.length -1];
 }
 
 //if Url and subCurrLin value are the same set the li to have a class of selected
 if (Url == subCurrLink) {  
  if (utilityNavA[j].parentNode.className == 'first') {
    utilityNavA[j].parentNode.className += ' selected';
   }
  else {
   utilityNavA[j].parentNode.className  = 'selected';
  }  
  }
 }
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(function() {
utilityNav();
if(!document.getElementById("leftNav")) return false;
hireNav.init();
});