
//this script highlights the current page's navigation item
//according to R5 standard navi specs. 
//it looks for the A[nnnnnn] string from the url, 
//if a match is found, it is searched from the link list of current document.
//If that match is inside a node

function FakeSideNaviHighlight (){

  var regAurl = /\/A\d{6,10}/;
  //isolate the Aurl
    aurl = location.href.match(regAurl);
    if(aurl === null ) {return;}
    for (i=0;i<document.links.length;i++) {
      if ( document.links[i].href.match(aurl) ) {
        addHighLight(document.links[i]); 
      } 
    }
}

function addHighLight(linkObj) {

var hlClass = 'navi_static_pointer';
var naviClass = 'lvl_item'; 
if (linkObj.parentNode.className.match(naviClass) ){
// alert('highlighting');
//higlight the parent list element by giving it the appropriate classname
  var parts = linkObj.parentNode.className.split(' ');
      parts.push(hlClass);
      linkObj.parentNode.className = parts.join( ' ' );
      
  //remove the anchor and replace it with static text
  var text = linkObj.innerHTML;
  linkObj.parentNode.innerHTML = text;
}
}
window.onload = FakeSideNaviHighlight
