// JavaScript Document
/*
The Complete Script

As promised, here is the complete script. Notice the last line, which assigns the externalLinks function to the window's onload event handler. This triggers the function when the document has finished loading.
*/
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;
/*
As this is the kind of script you'll want to deploy across your entire site, you should copy this code into a separate file (e.g. external.js), and then load it in every page on your site with the following code, which should appear in the <head> tag of each document:

<script type="text/javascript" src="/js/externalLinks.js"></script>

*/