// JavaScript Document
/*
	initExternalBlanks.js

	Checks all links in the current document, and sets the target attribute of any found that possess
	a "rel" attribute of "external" to "_blank".

	Note that this does *not* deal with forms - they will likely need something similar, but that 
	applies more directly to the base form object.
*/

function initExternalBlanks()
{
	try
	{
		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") && anchor.getAttribute("rel").indexOf("external") != -1 )
			{
				anchor.setAttribute("target", "_blank");
			}
		}
	}
	catch(extBlankErr)
	{
		//	Not doing anything here...
	}
}

onLoadSet = false;
if ( document.addEventListener )
{
	addEventListener('load', initExternalBlanks, false);
	onLoadSet = true;
}

if ( ! onLoadSet )
{
	window.onload = initExternalBlanks;
}
