function expand(e)
{
    Event.stop(e);
    $$('div.expand').each(function(d) {d.hide()});
    $$('a.show').each(function(a) {a.show()});
    var elm = Event.element(e);
    if (elm.nodeName != 'A')
        elm = elm.up('a');
    $(elm.name).select('div.expand').each(function(div) 
    {
        if (elm.hasClassName('show')) {
            div.show();
            $$('a[name="' + elm.name + '"].show').each(function(a) {a.hide()});
        }
        else {
            div.hide();
            $$('a[name="' + elm.name + '"].show').each(function(a) {a.show()});
        }
    });
}


// initialise page
function init()
{
    var div = 'situatie' + Math.round(Math.random()*6+1);
    $(div).show();
    $$('a.expand').each(function(a) {Event.observe(a, 'click', expand);});
    $$('a.show').each(function(a) {Event.observe(a, 'click', expand);});
    $$('#gebedform').each(function(f) {Event.observe(f, 'submit', validate);});
}

//Event.observe(window, 'load', init);
document.observe('dom:loaded', init);

