// Richard Westerbeek
// Evolution Internet Ltd.
// This reads through all anchor tags in the page that it is set in.  Any that have a rel="NewWindow" are given a 
// target of _blank and adds a title of "opens a new window to an external web site" (for accessibility), adding it to the existing title
// if there is one, otherwise creating a title

function SetTargetForExternalLinks() { 
 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") == "NewWindow") 
	   {
		 anchor.target = "_blank"; 
		 if (anchor.getAttribute("title"))
		 	anchor.title = anchor.title + " - ";
			
		 anchor.title = anchor.title + "Opens a new window to an external web site";
	   }
 } 
} 
window.onload = SetTargetForExternalLinks;