
myUrl = location.href; 
mySub1 = "/"; 
mySub2 = ".html"; 
//Returns everything right of the last instance of the substring to the end of the fullString 
function rightFromsubstringToEndOfFullString(fullString, substring) { 
if (fullString.lastIndexOf(substring) == -1) { 
return ""; 
} else { 
return fullString.substring(fullString.lastIndexOf(substring)+1, fullString.length); 
} 
} 

//Returns everything left of the last instance of the substring to the start of the fullString 
function leftFromsubstringToBeginningOfFullString(fullString, substring) { 
if (fullString.lastIndexOf(substring) == -1) { 
return ""; 
} else { 
return fullString.substring(0, fullString.lastIndexOf(substring)); 
} 
} 

//Strip out everything before the last "/" 
myVar = rightFromsubstringToEndOfFullString(myUrl, mySub1); 

//Strip out the .html 
myText = leftFromsubstringToBeginningOfFullString(myVar, mySub2); 

//Change the color of the nav link
document.write("<style>a#"+myText+"{color:#c77a59};</style>");


