function externalLinks() {
  // does the browser support the DOM?

  if (!document.getElementsByTagName) { return; }

  // create an array of the anchors present in the document

  var anchors = document.getElementsByTagName("a");

  // loop through the anchor array

  for (var i=0; i<anchors.length; i++) {

    // get various anchor properties
    var anchor   = anchors[i];
    var rel      = anchor.getAttribute("rel");
    var title    = anchor.getAttribute("title");


    // set the regexp to test for
    var external = /external/;


    // if the anchor has a href and a rel attribute containing the string 'external'
    if (anchor.getAttribute("href") && external.test(rel)) {

      // set the anchor target to blank
      anchor.target = "_blank";

      // set the anchor class to external
      anchor.className = "external";

     // append a helpful message to the title attribute
      anchor.title += " [opens in a new window]";
    }
  }
}
window.onload=function(){externalLinks()}