var newWindow=null;
function addEvent(elm, evType, fn, useCapture) {
	if(elm.addEventListener) {
		elm.addEventListener(evType, fn, useCapture);
		return true;
	} else if (elm.attachEvent) {
		var r=elm.attachEvent('on'+evType, fn);
		return r;
	} else elm['on'+evType]=fn;
}
function doPopUp(e) {
	var t="standard"; var w="600"; var h="400"; var tools="";
	attribs=this.rel.split(" ");
	if (attribs[1]!=null) t=attribs[1];
	if (attribs[2]!=null) w=attribs[2];
	if (attribs[3]!=null) h=attribs[3];
	t = t.toLowerCase();
	if (t=="fullscreen"){
		w=screen.availWidth;
		h=screen.availHeight;
	}

	if (newWindow!=null) if(!newWindow.closed) newWindow.close();

	if (t=="standard") tools="resizable,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width="+w+",height="+h;
	if (t=="console" || t=="fullscreen") tools="resizable,toolbar=no,location=no,scrollbars=no,width="+w+",height="+h;
	newWindow=window.open(this.href, 'newWin', tools);
	newWindow.focus();

	if (window.event) { //cancel the default link action if pop-up activated
		window.event.returnValue=false;
		window.event.cancelBubble=true;
	} else if (e) {
		e.stopPropagation();
		e.preventDefault();
}	}
function verifyKey(e){
	if(e.keyCode==13) doPopUp(e);
}
function findPopUps() {
	var popups = document.getElementsByTagName("a");
	for (i=0;i<popups.length;i++) {
		if (popups[i].rel.indexOf("popup")!=-1) {
			popups[i].onclick=doPopUp; // attach popup behaviour
			popups[i].onkeypress=verifyKey;
			popups[i].title=popups[i].title+" [Opens in pop-up window]";
			/*if (popups[i].rel.indexOf("noicon")==-1) { // add popup indicator
				popups[i].style.backgroundImage="url(/services/images/items/info.gif)";
				popups[i].style.backgroundPosition="0 center";
				popups[i].style.backgroundRepeat="no-repeat";
				popups[i].style.paddingLeft="15px";
			}*/
}	}	}
addEvent(window, 'load', findPopUps, false);