popupWins = new Array();

/******************************* 
the popupWins array stores an object reference for
each separate window that is called, based upon
the name attribute that is supplied as an argument
http://www.codestore.net/store.nsf/unid/DOMM-4PYJ3S?OpenDocument
*******************************/
function windowOpener(url, name, args) {
	if (typeof(popupWins[name]) != "object") {
		popupWins[name] = window.open(url,name,args);
	} 
	else {
		if (!popupWins[name].closed){
			popupWins[name].location.href = url;
		}
		else {
			popupWins[name] = window.open(url, name,args);
		}
	}
	popupWins[name].focus();
}

function windowCloser() {
	a=windowCloser.arguments;
	for(var i=0; i<(a.length); i++) {
		if (popupWins[a[i]]) {
			if (popupWins[a[i]].location && !popupWins[a[i]].closed)
				popupWins[a[i]].close();	
		}
	}
}

function launchArchive(url) {
	var winName = "archive";
	var features = "width=650,height=450,scrollbars=yes,resizable=yes";
	windowOpener(url, winName, features);
}

function cmsPopup(sUrl, sName, nWidth, nHeight)
{
	var top = (screen.height-nHeight) / 2;
	var left = 	(screen.width-nWidth) / 2;
	
	windowOpener(sUrl, sName, "width=" + nWidth + ",height=" + nHeight + ",scrollbars=yes,resizable=yes,left=" + left + ",top=" + top + "");
}