
// Open a little window.

var popupWin = null

function openWindow(location, w, h)
{
    //openWindowCustom(location, w, h,left,top,scrollbars,resizable,toolbar,menubar,status)
	return openWindowCustom(location, w, h,20,20,1,1,1,0,0)
}
function openWindowHelp(location, w, h)
{
	//openWindowCustom(location, w, h,left,top,scrollbars,resizable,toolbar,menubar,status)
	openWindowCustom(location, w, h,20,20,1,1,0,0,1);
}
function openWindowSimple(location, w, h)
{
	//openWindowCustom(location, w, h,left,top,scrollbars,resizable,toolbar,menubar,status)
	return openWindowCustom(location, w, h,20,20,0,0,0,0,0);
}

function openWindowCustom(location, w, h,left,top,scrollbars,resizable,toolbar,menubar,status)
{
    if (popupWin != null && !popupWin.closed)
    {
      popupWin.close()
      popupWin = null
    }

    // Detect screen resolution. Only works in 4+ browsers. If resolution is
    // smaller than the desired window size, adjust the window size.
    if (screen) 
    {
      wd = (w > screen.availWidth) ? eval(screen.availWidth - 15) : w
      ht = (h > screen.availHeight) ? eval(screen.availHeight - 15) : h
    }
    
    // If we can't detect screen size, assume 640x480.
    else 
    {
      wd = (w > 600) ? 600 : w
      ht = (h > 380) ? 380 : h
    }
    
    // Open a resizable popup window with scrollbars, the toolbar (buttons),
    // no status bar, in the top left corner of the screen (window positioning
    // only works in IE 4+).
    popupWin = window.open("", "display", "scrollbars="+scrollbars+",resizable="+resizable+",width="+wd+",height="+ht+",left="+left+",top="+top+",toolbar="+toolbar+",menubar="+menubar+",status="+status+"")
    popupWin.focus()
    popupWin.location.href = location

    return true
}