
var _NgWindowOnLoadEvents = new Array();

function NgRegisterWindowOnLoadEvent(func, timeout)
{
    if(func == null)
        return;

    if(timeout == null)
    {
        _NgWindowOnLoadEvents[_NgWindowOnLoadEvents.length] = func;
    }
    else
    {
        _NgWindowOnLoadEvents[_NgWindowOnLoadEvents.length] = function() { setTimeout(func, timeout); };
    }
}

NgRegisterWindowOnLoadEvent(window.onload);

window.onload = function()
{
    for(var i = 0; i < _NgWindowOnLoadEvents.length; i++)
    {
        var func = _NgWindowOnLoadEvents[i];
    
        if(typeof func == 'function')
        {
            func();
        }
    }
}
    
    