// functions for highlighting the current page on the streetcar and cable car section.
// trigger it with setPage() after the menu
function extractPageName(hrefString) {
var arr = hrefString.split('/');
return (arr.length < 2) ? hrefString : arr[arr.length-2].toLowerCase() + arr[arr.length-1].toLowerCase();
}
function setActiveMenu(arr, crtPage) {
for (var i=0; i < arr.length; i++) {
if(extractPageName(arr[i].href) == crtPage) {
if (arr[i].parentNode.tagName != "DIV") {
arr[i].className = "current";
arr[i].parentNode.className = "current";
}
}
}
}
function setPage() {
hrefString = document.location.href ? document.location.href : document.location;
if (document.getElementById("section-nav") !=null )
setActiveMenu(document.getElementById("section-nav").getElementsByTagName("a"), extractPageName(hrefString));
}
