//Look for navlist node
var nav_list = document.getElementById('navlist');
//only take the anchor tag elements
var list = nav_list.getElementsByTagName('a');
//for each element see if it points to the current location, if so give class "current" changing its color
for(var i = 0; i < document.links.length; i++){
  if ( document.links[i].href.toLowerCase() == location.href.toLowerCase())
  list[i].className='current';
}
//Look for sublist node
var sub_list = document.getElementById('sublist');
//only take the anchor tag elements
var sublist = sub_list.getElementsByTagName('a');
//for each element see if it points to the current location, if so give class "current" changing its color
for(var i = 0; i < document.links.length; i++){
  if ( document.links[i].href.toLowerCase() == location.href.toLowerCase())
  sublist[i].className='current';
}