//
// This method will allow specific href links to be opened in a new window,
// yet allow the XHTML or HTML code to meet the appropriate standard.
function externalLinks() {   
  //
  // The getElmentsByTagName call is not supported on older browsers, so
  // handle gracefully.
  //
  if (!document.getElementsByTagName) return;
    
  //
  // Get an array containing all the anchor tags in the document.
  //
  var anchors = document.getElementsByTagName("a");   

  //
  // Loop through all the anchor tags.  Those that contain a href attribute
  // and a rel attribute equal to "external" will have target attribute to
  // "_blank" which will cause the link to be opened in a new window.
  // 
  for (var i=0; i<anchors.length; i++) {   
    var anchor = anchors[i];
       
    if (anchor.getAttribute("href") &&   
        anchor.getAttribute("rel") == "external") {   
      anchor.target = "_blank";
    }     
  }   
}

//
// Load externalLinks() when the page loads.
//   
window.onload = externalLinks;


