// 1)  windowOpener(url, name, args);
// 2)  NewWindow(lsUrl, lsName, lsWidth, lsHeight);
//---------------------------------------------------------------------------
popupWins = new Array();
popupNames = new Array();
iNumNames = 0;
function windowOpener(url, name, args) {
	/******************************* 
		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
		*******************************/
	if ( typeof( popupWins[name] ) != "object" )
	{
		popupWins[name] = window.open(url,name,args);
		popupNames[iNumNames] = name;
		iNumNames += 1;
	} 
	else 
	{
		if (!popupWins[name].closed)
		{
			popupWins[name].location.href = url;
		} 
		else 
		{
			popupWins[name] = window.open(url, name,args);
		}
	}
	popupWins[name].focus();
}
//---------------------------------------------------------------------------
function NewWindow(lsUrl, lsName, lsWidth, lsHeight) 
{
	var lvLeft = (screen.width - lsWidth) / 2;
	var lvTop = (screen.height - lsHeight) / 2;
	winprops = 'height=' + lsHeight + 
		',width=' + lsWidth + 
		',top=' + lvTop + 
		',left=' + lvLeft + 
		',resizable=yes' + 
		',scrollbars=yes';

	// window.open(lsUrl, lsName, winprops)
	windowOpener(lsUrl, lsName, winprops);
}
//---------------------------------------------------------------------------
function CloseWindows()
{
	for(iCnt = 0; iCnt<iNumNames; ++iCnt)
	{
		if(popupWins[popupNames[iCnt]])
		{
			popupWins[popupNames[iCnt]].close();
		}
		popupNames[iCnt] = "";
	}
	iNumNames = 0;
}
//---------------------------------------------------------------------------
