// JavaScript Document

var newWindow=null;
function openWindow(contentURL,windowName,windowWidth,windowHeight) {
	widthHeight='height=' + windowHeight + ',width=' + windowWidth;
	newWindow=window.open(contentURL,windowName,widthHeight);
	newWindow.focus()
}
function closeWindow() {
	if (newWindow !=null) {
	newWindow.close();
	newWindow=null;
	}
}
function toggleWindow(contentURL,windowName,windowWidth,windowHeight) {
	if (newWindow==null) {
		widthHeight='height=' + windowHeight + ',width=' + windowWidth;
		newWindow=window.open(contentURL,windowName,widthHeight);
		newWindow.focus()
	}
	else {
	newWindow.close();
		newWindow=null;
}}

//With thanks to Scott Andrew

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); */