/** 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, scroll )
{
	if( scroll == null )
	{
		scroll == '0';
	}
	
        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=" + scroll + ",status=1,toolbar=0","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;
        }
}

var form_submit = false;
function multi_submit() {
	if( form_submit == false ) {
		form_submit = true;
		return true;
	}
	return false;
}

function addOnload(func) {
	if (!func) {
		return;
	}
	old_onload = window.onload;
	if (old_onload) {
		window.onload = function(ev) {
			old_onload(ev);
			func(ev);
		}
	} else {
		window.onload = func;
	}
}

