function externalLinks() {
	// Check for DOM support by browser
	if (!document.getElementsByTagName) return;

	// Get all of the A tags from the document
	var anchors = document.getElementsByTagName("a");

	// For each anchor tag...
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		// If the anchor has an href and has rel="external" set...
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
			// Set the anchor's target to "_blank"
			anchor.target = "_blank";
	}
}

// Run the function on document load
window.onload = externalLinks;