function prepareLinks()
{
	var links = document.getElementsByTagName("a");
	var theLink;
	for (var i=0; i<links.length; i++) {
		theLink = links[i];
		if (theLink.className) {
			if (theLink.className.indexOf("external") > -1) {
				if (theLink.getAttribute('title') == '') {
					theLink.setAttribute("title","(This link opens in a new window)");
				}
				theLink.onclick = function() {
					OpenNewWindow(this.getAttribute('href'));
					return false;
				}
			} else if (theLink.className.substring(0,6) == 'popup_') {
				theLink.setAttribute('title','this link opens in a popup');
				theLink.onclick = function() {
					popup(50,50,this.className.split('_')[1],this.className.split('_')[2],this.getAttribute('href'));
					return false;
				}
			}
		}
  	}
}

function OpenNewWindow(fn){
	NewWindow = window.open(fn)
}

function popup(x,y,w,h,f) {
	NewWindow=window.open(f,'descr','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbar=0,scrollbars=1,resizable=1,copyhistory=0,width='+w+',height='+h+',top='+y+',left='+x)
}
