function init() {
	setupARIA();
	doPopups();
}

function addARIARole(strID, strRole) {
	// find the element to add a role property to
	var objElement = document.getElementById(strID);

	if(objElement) {
		// add the role property to the element
		objElement.setAttribute('role', strRole);
	}
}

function setupARIA() {
	// add ARIA roles to the document
	addARIARole('header', 'banner');
	addARIARole('footer', 'contentinfo');
	addARIARole('content', 'main');
	addARIARole('global', 'navigation');
	addARIARole('local', 'navigation');
	addARIARole('courtesy', 'navigation');
}

function doPopups() {
	if(!document.getElementsByTagName) return false;
	var links = document.getElementsByTagName("a");
	for(var i = 0; i < links.length; i++) {
		if(links[i].className.match("external")) {
			links[i].onclick = function() {
				window.open(this.href);
				return false;
			}
			links[i].setAttribute('title', 'Opens new window');
		}
	}
}

window.onload = init;