//##############################################################
// on_load_handler
// author: Scott Ingram
//
// permits multiple widgets to register their own onLoad and onUnload handlers
//
// The developer can have his own custom functions automatically execute
// during page load and page unload by using the following functions.
// add_on_load(function_name)
// add_on_unload(function_name)
//
// requires submit_ifpp_form to define
// unshift(), push(), pop(), and concat()
//
//

//removed becoz the first item is sometimes
//off the bottom of the browser, causing it to scroll down.
var on_load_stack = ["set_focus_on_first_item"];

//var on_load_stack = [];
var on_unload_stack = [];


function do_on_load()
//##############################################################
{
	//alert("do_on_load");
	execute_handler_stack(on_load_stack);
}

function do_on_unload()
//##############################################################
{
	//alert("do_on_unload");
	execute_handler_stack(on_unload_stack);
}

function execute_handler_stack(stack)
//##############################################################
{	var i;
	for (i=0; i<stack.length; i++)
	{	var function_name = stack[i];
		//alert("DEBUG: execute_handler_stack - function_name=(" +function_name+ ")" );

		var exists = window[function_name];
		if (exists)
		{
			ok = eval (function_name + "()");
		}
		else
		{	alert("DEBUG: on_X_load ERROR: '" +function_name+ "' handler does not exist");
		}
	}
}

function add_on_load_handler(name)
//##############################################################
{	push(on_load_stack,name);
}

function add_on_unload_handler(name)
//##############################################################
{	push(on_unload_stack,name);
}

function add_early_on_load_handler(name)
//##############################################################
// inserts the handler at the FRONT of the stack
{	unshift(on_load_stack,name);
}

function popfly()
//#############################################################
// fix the javascript error caused by the new SUN header template.
{
}

function closefly()
//#############################################################
// fix the javascript error caused by the new SUN header template.
{
}

