var m_szDefaultWinHnd = "window";
var m_oPopUpWnd = null;
function open_pop_up(nWidth, nHeight, bCentered, szURL, bHasScrollBars, szWinName)
{
	// alert (szWinName);
	var n_w = 0, n_h = 0; 
	var n_x = 0, n_y = 0;
	var szResizable = null, szScrollBars  = null;

	szResizable = szScrollBars = "no";
	n_w = (nWidth < window.screen.availWidth) ? nWidth : window.screen.availWidth;
	n_h = (nHeight < window.screen.availHeight) ? nHeight : window.screen.availHeight;
	if((nWidth >= window.screen.availWidth)||(nHeight >= window.screen.availHeight))
		szResizable = "yes";		
	n_x = ((window.screen.availWidth) - n_w) / 2; 
	n_y = ((window.screen.availHeight) - n_h) / 2;

	if(m_oPopUpWnd)
		if(!(m_oPopUpWnd.closed))
			m_oPopUpWnd.close();
	m_oPopUpWnd = null;		

	if(bHasScrollBars)
		szScrollBars = "yes";

	if (bCentered) {
		m_oPopUpWnd = window.open(szURL, szWinName, "left=" + n_x + ",top=" + n_y + ",resizable=" + szResizable + ",scrollbars=" + szScrollBars + ",menubar=no,location=no,toolbar=no,status=no,width=" + n_w + ",height=" + n_h);
	} else {
		m_oPopUpWnd = window.open(szURL, szWinName, "resizable=" + szResizable + ",scrollbars=" + szScrollBars + ",menubar=no,location=no,toolbar=no,status=no,width=" + n_w + ",height=" + n_h);
	}
	m_oPopUpWnd.focus();		
}			
function open_popup(wid, hi, szURL, popUpName)
{
	open_pop_up(wid, hi, true, szURL, false, popUpName);
}