// Javascript Document
/*****************************************************************************
 *                                                                           *
 * ESJ - 2009/10/06                                                          *
 *                                                                           *
 * A handy little Javascript workaround for the annoying fact that the       *
 * XHTML 1.0 Strict DTD does not include the 'target' attribute, preventing  *
 * the use of the target="_blank" method of opening a link in a new          *
 * window. By including this .js file in a web page, all <a> tags marked     *
 * with rel="external" will open in a new window, just like they would       *
 * when the 'target' attribute was still legal.                              *
 *                                                                           *
 *  Example:                                                                 *
 *                                                                           *
 *       <a rel="external" href="http://www.earlisanhtmlgod.com">            *
 *                                                                           *
 *                                                                           *
 *  Attribution:                                                             *
 *                                                                           *
 *    This code was copied wholesale from this page:                         *
 *                                                                           *
 *    http://articles.sitepoint.com/article/standards-compliant-world/3      *
 *                                                                           *
 *****************************************************************************/

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";  
 }  
}  

// Do not remove this line, or the code won't work properly
window.onload = externalLinks;

