/* This script is designed to run once the document it is embedded in is loaded.
 It will find all the hyperlinks in the document and modify those that have the 
 special (but standards-compliant!) rel="external" attribute, so that they open 
 in a new window.
 
 This is because target="_blank" to open a window in a new browser is not XHTML!

http://www.sitepoint.com/article/standards-compliant-world/2

*/

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;
