var OnloadHandler = { };
OnloadHandler.stack = new Array();

// Function to call to add functions to be executed when the onLoad
// event occurs.
OnloadHandler.add = function(func) {
    if (typeof(func) != "function") {
        alert('OnloadHandler.add: Attempt to add non-function');
    }
    else {
        OnloadHandler.stack[OnloadHandler.stack.length] = func;
    }
}

// Replace the window.onload event handler with a function that
// executes all of the functions added, in order.
window.onload = function() {
    for (var i in OnloadHandler.stack) {
        var func = OnloadHandler.stack[i];
        func();
    }
}


