function getLocation() { loc = String(document.location); loc = loc.substr(loc.search(/\w+\.html/)); if (loc.indexOf('_') != -1) loc = loc.substr(0, loc.indexOf('_')); else if (loc.indexOf('_') == -1) loc = loc.substr(0, loc.indexOf('.')); return loc; } // navDetect loc = getLocation(); if (document.getElementById('nav_' + loc)) document.getElementById('nav_' + loc).className = 'selectedLink'; else if (document.getElementById('topNav_' + loc)) { document.getElementById('topNav_' + loc).style.textDecoration = 'underline'; }