/** Storage for all popup handles */
var popupList = {};

/**
 * Opens a named window with the given URL, width, and height.
 * @param winName The name of the window to use
 * @param url The relative or absolute URL to open
 * @param w The requested window width
 * @param h The requested window height
 */
function openWindow( winName, url, w, h )
{
        closeWindow( winName );
        popupList[winName] = window.open( url, winName, "height=" + h + ",width=" + w + ",channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=1,toolbar=1","pop" );
        if ( popupList[winName].opener == null )
        {
                popupList[winName].opener = window;
        }
        if ( navigator.appName == 'Netscape' )
        {
                popupList[winName].focus;
        }
}

/**
 * Closes a named window.
 * @param winName The name of the window to close.
 */
function closeWindow( winName )
{
        if ( popupList[winName] != null && typeof( popupList[winName] ) == "object" && !popupList[winName].closed )
        {
                popupList[winName].close();
                popupList[winName] = null;
        }
}
