var functions = new Array ();

window.onload = function ()
{
    for ( var i = 0; i < functions.length; i++ )
    {
        eval ( functions [ i ] );
    };
};

function load ( func )
{
    functions [ functions.length ] = func;
};

function help ()
{
    var tables = document.getElementsByTagName ( 'table' );
    
    for ( var table = 0; table < tables.length; table++ )
    {
        var links = tables [ table ].getElementsByTagName ( 'a' );
        
        for ( var link = 0; link < links.length; link++ )
        {
            if ( links [ link ].parentNode.className == 'question' )
            {
                links [ link ].onclick = function ()
                {
                    var table = this.parentNode.parentNode.parentNode.parentNode;
                    var row = this.parentNode.parentNode;
                    var index = this.parentNode.parentNode.rowIndex;
                    var next = index + 1 * 1;
                    
                    if ( this.title != 'Help' )
                    {
                        var description = this.title;
                        this.title = 'Help';
                        
                        var add = table.insertRow ( next );
                        
                        add.className = 'description';
                        
                        var cell = add.insertCell ( 0 );
                        
                        cell.colSpan = '7';
                        cell.innerHTML = description;
                    }
                    else
                    {
                        this.title = table.rows [ next ].cells [ 0 ].innerHTML;
                        
                        table.deleteRow ( next );
                    };
                    
                    return false;
                };
            };
        };
    };
};

load ( 'help ()' );

function login ()
{
    if ( document.getElementById ( 'username' ) && document.getElementById ( 'password' ) )
    {
        var username = document.getElementById ( 'username' );
        var password = document.getElementById ( 'password' );
        
        username.onclick = function ()
        {
            if ( this.value == 'Gebruikersnaam' )
            {
                this.select ();
            };
        };
        
        password.onfocus = function ()
        {
            if ( this.value == 'Wachtwoord' )
            {
                this.select ();
            };
        }
    };
}

load ( 'login ()' );

function products ()
{
    if ( document.getElementById ( 'listproducts' ) )
    {
        items = document.getElementById ( 'listproducts' ).getElementsByTagName ( 'label' );
        
        for ( var li = 0; li < items.length; li++ )
        {
            items [ li ].onclick = function ()
            {
                items = document.getElementById ( 'listproducts' ).getElementsByTagName ( 'label' );
                
                for ( var li = 0; li < items.length; li++ )
                {
                    if ( items [ li ].getElementsByTagName ( 'input' ) [ 0 ].checked )
                    {
                        items [ li ].className = 'active';
                    }
                    else
                    {
                        items [ li ].className = 'none';
                    };
                };
                
                if ( document.getElementById ( 'listproducts2' ) )
                {
                    items2 = document.getElementById ( 'listproducts2' ).getElementsByTagName ( 'label' );
                            
                    for ( var li = 0; li < items2.length; li++ )
                    {
                        items2 [ li ].className = 'none';
                    };
                };
            };
        };
    };
    
    if ( document.getElementById ( 'listproducts' ) && document.getElementById ( 'listproducts2' ) )
    {
        items = document.getElementById ( 'listproducts2' ).getElementsByTagName ( 'label' );
        
        for ( var li = 0; li < items.length; li++ )
        {
            items [ li ].onclick = function ()
            {
                items = document.getElementById ( 'listproducts2' ).getElementsByTagName ( 'label' );
                        
                for ( var li = 0; li < items.length; li++ )
                {
                    if ( items [ li ].getElementsByTagName ( 'input' ) [ 0 ].checked )
                    {
                        items [ li ].className = 'active';
                    }
                    else
                    {
                        items [ li ].className = 'none';
                    };
                };
                
                items2 = document.getElementById ( 'listproducts' ).getElementsByTagName ( 'label' );
                        
                for ( var li = 0; li < items2.length; li++ )
                {
                    items2 [ li ].className = 'none';
                };
            };
        };
    };
}

load ( 'products ()' );