// JavaScript Document
/*
 * externalLinks()
 *
 * assigns _blank targets to any link on the page that has rel="external"
 * used to comply with (X)HTML Strict DOCTYPE - because target="_blank" is depreciated
 */
function externalLinks() {
	// return if not able to retrieve by tag name
	if (!document.getElementsByTagName){ 
		return; 
	}
	// collect anchor tags
	var anchors = document.getElementsByTagName("a");
	// for each anchor
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		// if external
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external"){
			// set target to blank
			anchor.target = "_blank";
		}
	}
}
// load function when loading of window is complete
window.onload = externalLinks;
