/*
	popstuff 
	function to automatically add popup window calls to each link
	with a target
*/

function initpop()
{
	var windowAttributes='width=380,height=500,left=0,top=0,scrollbars=yes,resizable=yes,location=no,status=yes';

	if(!window.opener) {
		var as,i,popit
		as=document.getElementsByTagName('a');
		for (i=0;i<as.length;i++) {
			if(as[i].target=='pop') {
				popit=function(){window.open(this.href,'',windowAttributes);return false;};
				as[i].onclick=popit;
				as[i].onkeypress=popit;
			}
		}
	}
}

// create event  
function addEvent(obj, evType, fn) { 
	// add event listener to the window object
	if (obj.addEventListener) { 
		obj.addEventListener(evType, fn, true); 
		return true; 
	} else if (obj.attachEvent) { 
		var r = obj.attachEvent("on"+evType, fn); 
		return r; 
	} else { 
		return false; 
	} 
}

// first check that we can do this
if (document.getElementById && document.createTextNode) {
  addEvent(window,'load',initpop);
}

