// JavaScript Document - Open Web page in a new window
//external.js

//Links in the site that are to open in a new window use rel="external"

//Check for browser's ability to use JavaScript this JS code
//Search NM EPHT site for rel="external" and create array
//for [a href] and [rel="external"] create blank target

function externalLinks()
  {
  if (!document.getElementsByTagName) return;
  var anchors = document.getElementsByTagName("a");
  for (var i=0; i<anchors.length; i++)
    {
	var anchor = anchors[i];
	if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
	  anchor.target = "_blank";
	}
  }

window.onload = externalLinks;