
/* FUNCTION RESULT: <a rel="external">link</a> will open link in new window.

   Why do this through Javascript instead of adding the attribute directly?
     1. The "target" attribute is depreciated in HTML 4.0, but not in the DOM 2.0 (and won't be in the forseeable future)
     2. Kevin Yank explains in his article: 

        One of the ideals that is expressed by the removal of 
		the target attribute from the Strict standards 
		is that (X)HTML should only be concerned with the 
		information that's displayed within a browser window.

        Consequently, as soon as we start talking about 
		opening new browser windows, the idealistic notion 
		is that we have exceeded the responsibilities of (X)HTML 
		and entered the world of client-side scripting (i.e. JavaScript).
		
		- "New-Window Links in a Standards-Compliant World"  ( http://www.sitepoint.com/article/standards-compliant-world )
*/		



function External_Links() {
	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";
	}
}

window.onload = External_Links;
