function inject_to_current_page() { 
 if (!document.getElementsByTagName) return;  
 var anchors = document.getElementsByTagName("a"); 
 var thispage = location.href; 
 for (var i=0; i<anchors.length; i++) {  
 var anchor = anchors[i]; 
 thisHREF = anchor.getAttribute("href"); 
 if ((thisHREF == thispage) ||(location.protocol + "//" + location.hostname + thisHREF == thispage)) { 
 anchor.className+= "current"; 
 return; 
 } 
 }  
}
window.onload=inject_to_current_page;  