/*
	Description: Common JavaScript for WINGS websites
	Author: Lance Willett
	Author URI: http://simpledream.net
	Copyright: See below for source of these common scripts
*/

/*
	Open links in new window/tab with rel="external"
	From http://articles.sitepoint.com/article/standards-compliant-world/3
*/
function externalLinks() {
	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") == "external") {
			anchor.target = "_blank";
		}
	}
}

/*
	Event loading: functions to fire on window load
	From http://simonwillison.net/2004/May/26/addLoadEvent/
*/
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		};
	}
}

addLoadEvent(externalLinks);