/*
	popup
	function to automatically add popup window calls to each link
	with a target set to _popup.
*/

function initpop()
{
	var windowAttributes='left=0,top=0,width=640,height=480,resizable=yes,scrollbars=yes,location=no';

	if(!window.opener)
	{
		var as,i,popit
		as=document.getElementsByTagName('a');
		for (i=0;i<as.length;i++)
		{
			if(as[i].target=="_popup")
			{
				popit=function(){window.open(this.href,'',windowAttributes);return false;};
				as[i].onclick=popit;
				as[i].onkeypress=popit;
			}
		}
	}
}

function addEvent(obj, evType, fn)
{ 
	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; 
	} 
}
addEvent(window,'load',initpop);

