// Add javascript code as an element to the array to be executed on the page been loaded.
function addToOnLoad(jsCode) {
    if (typeof(globalInitFunctionsList) == 'undefined') {
        globalInitFunctionsList = new Array();
    }

    var l_length = globalInitFunctionsList.length;
    var l_localNewArray = new Array(l_length+1);
    for(var i=0; i<l_length;i++){
        l_localNewArray[i]=globalInitFunctionsList[i];
    }

    l_localNewArray[l_length] = jsCode;

    globalInitFunctionsList = l_localNewArray;
}

function globalInit() {
    if (typeof(globalInitFunctionsList) == 'undefined') {
        globalInitFunctionsList = new Array();
    }

    for (var i = 0; i < globalInitFunctionsList.length; i++) {
        var res = eval(globalInitFunctionsList[i]);
        if (res == globalInitFunctionsList[i]) {
            throw ("Error in addToOnLoad('" + globalInitFunctionsList[i] + "') execution");
        }
    }
}

window.onload = globalInit;