      /*  The following code is adapted from a Sitepoint article entitled "New-Window Links in a Standards-Compliant World".
          The article may be found at "http://www.sitepoint.com/article/standards-compliant-world".

          Issue: the "target" attribute has been deprecated in HTML.  Sitepoint overcomes this by using the "rel" attribute, set to "external",
          in the (x)html document (<a href="document.html" rel="external">external link</a>).

          The "rel" attribute defines the relationship between the document that contains the link, and the target of the link.  Standard values are
          "next", "previous", "chapter", "section", etc. -- most of which have to do with relationships between small sections of a larger document.
          However, a developer can use nonstandard values for "rel" for site-specific purposes.

          Once the "rel" attribute has been set to "external" in the (x)html document, Sitepoint uses JavaScript first to check whether a browser
          supports JavaScript, then to open a new window if it does.  Sitepoint's code follows: */



      //  First step: set up a function called "externalLinks".


function externalLinks() {


      /*  Next, weed out older browsers (e.g. Netscape 4 and IE4) that don't support the Document Object Model 1.0 (DOM1) by checking for
          the presence of the method "getElementsByTagName".  If the method is not found, just return and let external links open in the same browser window. */


if (!document.getElementsByTagName) return;


      //  Next: use the "getElementsByTagName" method to get a list of all the <a> tags in the document:


var anchors = document.getElementsByTagName("a");


      /*  The variable "anchors" will then contain an array of <a> tags.
          Next, we set up a loop to look for <a> tags representing new-window links: */


for (var i=0; i < anchors.length; i++) { 
 var anchor = anchors[i];


      /*  English translation: "For variable "i", numbered 0 through the number of elements in the array, and incremented by one each time the loop is executed:
          place the value of the element from the "anchors" array into a variable called "anchor".*/


      /*  Now we check to see whether "anchor" represents a new-window link.  Since only <a> tags with an "href" attribute (as opposed to the "name" attribute) qualify as hyperlinks,
          we check that "anchor" has an "href" attribute, as well as a "rel" attribute that is set to "external": */


if (anchor.getAttribute("href") && 
     anchor.getAttribute("rel") == "external")


      //  If both these conditions are true, we have a new-window link.  We then set its target attribute to "_blank":


anchor.target = "_blank";


      //  Close the loop bracket:


}


      //  Close the function bracket:


}


      //  Assign the "externalLinks" function to the window's onload event handler (triggers the function when the document has finished loading):


window.onload = externalLinks;


      /*  Be sure the following appears in the <head> tag of the (x)html document:
          <script type="text/javascript" src="/newWindow.js"> 
          </script> */