//externalLinks.js
function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	strHost = document.location.hostname;
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if ((anchor.getAttribute("rel") !== "nonexternal") && ((anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")||((anchor.href.search(strHost) == -1 && anchor.href.search('mailto:') == -1) && anchor.href.search('http://') != -1))) {
			if (anchor.title.indexOf('opens in a') > 0) {
			} else {
				anchor.title += " Link opens in a new window";
			}
			//alert('This is an external link ' + anchor.href);

			if(anchor.onclick==null)
			{
			anchor.onclick=function() {
				popUpWin = window.open(this.href,'','');
				
				//pop up blocker may be in force, so check so an ie error isn't spat out in ie
				if(popUpWin!=null)
				{
					popUpWin.focus();
					return false;
				}
				
				}
			}
		}
	}
}

AddEventListener(window, 'load', externalLinks);