/* MainLinker.js 
   Build time: 13/04/2009-14:36:51  Copyright (c) 2008-2131 Patrick 'Zener' Brunet */

/* MUST be the first script */

_poInstallerDaisyChain = null;
_poAsapInstallerDaisyChain = null;

function CInstaller( pjInstaller)
{
    this._pjInstaller = pjInstaller;
    this._poNext = _poInstallerDaisyChain;
    _poInstallerDaisyChain = this;
}

function MainLinkerRegister( pjInstaller)
{
    var poNode = new CInstaller( pjInstaller);
}

function CAsapInstaller( tID, pjInstaller)
{
    if( tID == null || tID == "")
        alert( "Invalid ID in CAsapInstaller !");
    this._tID = tID;
    this._pjInstaller = pjInstaller;
    this._poNext = _poAsapInstallerDaisyChain;
    _poAsapInstallerDaisyChain = this;
}

function MainLinkerAsapRegister( tID, pjInstaller)
{
    var poNode = new CAsapInstaller( tID, pjInstaller);
}

function OnPageLoaded()
{
    var poNode = _poInstallerDaisyChain;

    while( poNode != null)
    {
        poNode._pjInstaller();
        poNode = poNode._poNext;
    }
    return( true);
}

function RetryAsapInstallers()
{
    var poNode = _poAsapInstallerDaisyChain;
    var bRetry = false;

    if( poNode == null) /* Not started registering yet */
        bRetry = true;
    while( poNode != null)
    {
        if( poNode._tID != null)
        {
            if( document != null && document.getElementById( poNode._tID) != null)
            {
                poNode._pjInstaller( poNode._tID);
                poNode._tID = null;
            }
            else
                bRetry = true;
        }
        poNode = poNode._poNext;
    }
    if( bRetry)
        setTimeout( 'RetryAsapInstallers()', 100);
}

window.onload = OnPageLoaded;  /* So completely load-timing safe */

RetryAsapInstallers();         /* As soon as each object exists  */

/* End */

