/**********************************************************
Author:
Adam Barry
eBOUND
www.ebound.dk

Date: September 16 2005

© 2005 Adam Barry, all rights reserved
-----------------------------------------------------------

Name:
externalLinks script

-----------------------------------------------------------
Description:
Function that enable external links in standard compliant
web pages. The scripts traverses all the anchors on a web
page and enables anchors with a rel="external" to open a
new window.

Formerly external links had a target="_blank" attribute,
however this attribute does not comply with W3C standards
for XHTML.

-----------------------------------------------------------
Usage:
Simply place a link to the this script in the head-section
of the XHTML page. The script will then automatically
execute on page load.

<script type="text/javascript" src="externalLinks.js"></script>

-----------------------------------------------------------
Example:
<script type="text/javascript" src="externalLinks.js"></script>

<a href="http://www.ebound.dk" rel="external">this link
 opens the ebound website in a new window</a>

-----------------------------------------------------------
Dependencies:
This script depends on the windowOnLoad-script to execute

**********************************************************/

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";
		}
 	}
}
addLoadEvent(function(){externalLinks();});