/*
 * This script will set the target of all anchor (link) tags, that 
 * are not directed to a location that is internal, to be a new tab/window. 
 * Note: By setting a target, the tag will not be altered.
 */
window.addEvent('domready', function(){
	// this is the current url that we will compare to
	var activeURL = new URI(window.location.href);
	$$('a').each(function(link) {
		// only alter tags that don't have a target and don't invoke JavaScript
		if(!$defined(link.get('target')) && $defined(link.get('href')) && !link.get('href').match(/javascript:/gi))
		{
			// add a _blank target to all tags that are not internal
			var linkURL = new URI(link.get('href'));
			if(linkURL.get('host') != activeURL.get('host'))
			{
				link.set('target', "_blank");
			}
		}
	});
});
