/** Called on page to load to decorate page */
function decoratePage() {
	decorateLinks();
	// Add more decorations here
}

/** Opens external window, stops event propagation */
function openExternal() {
	window.open(this.href);
	return false;
}

/** Decorate (external) links */
function decorateLinks() {
	var links = document.getElementsByTagName("a");	
	for(i=0; i<links.length;++i) {
		if(links[i].className=="external") {
			decorateExternalLink(links[i]);
		}
	}
}

/** Adds image and event listener to external link */
function decorateExternalLink(elem)
{
	var img = document.createElement("img");
	img.setAttribute("alt", "opent in nieuw venster");
	img.setAttribute("src", "/mznd/img/external.gif");
	// Use DOM0 style, to avoid browser checks on IE not supporting DOM eventlisteners or setAttribute onclick
	elem.onclick = openExternal;
	elem.appendChild(img);
}
