/* unlink.js - remove links from a page if they are self referential 
 * 
 * Lou Scoras <louis.j.scoras@census.gov> 
 * Fri Jan  5 10:00:19 EST 2007 
 */ 

/* 
 * unlinkSection removes links to the current page from the children of the 
 * specified element.  The required parameter is the id attribute of the 
 * element to remove the links from. 
 */ 

function unlinkSection(id) { 
  var item  = document.getElementById(id); 
  var links = item.getElementsByTagName("a"); 

  for (var i=0; i < links.length; ++i) { 
    if (window.location == links[i].href) { 
      var parent      = links[i].parentNode; 
      var name        = links[i].childNodes[0]; 
      var replacement = document.createElement("span"); 
      var textNode    = document.createTextNode(name.nodeValue); 

      replacement.appendChild(textNode); 
      parent.replaceChild(replacement, links[i]); 
    } 
  } 
} 
