function externalLinks() {
  /*
    getElementsByTagName is a method of DOM 1.0 (DOM1) standard supported by modern browsers.
    IE4 doesn't support DOM1. In this case, the following line returns them from the script and the link loads normally.
  */
  if (!document.getElementsByTagName) return;

  // We use the getElementsByTagName method to create an array of all the <a> tags in the document.
  var anchors = document.getElementsByTagName("a");

  // We start a loop to go through all of the array elements.
  for (var i=0; i < anchors.length; i++) {
    // We create a variable inside the loop called anchor to isolate the tag with which we are currently concerned.
    var anchor = anchors[i];
    /*
	  The statement checks to see if the anchor tag has an href attribute set (as some anchors are for jumping around a page).
	  It also checks to see if the rel attribute has been set, and that it equals "external".
	*/
    if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
      // As the link has been confirmed to be external, we set its target attribute to _blank, updating the HTML automatically.
      anchor.target = "_blank";
	}

  }
}

// As soon as the window has loaded, run the function.
window.onload = externalLinks;