// JavaScript Document

var currentFlyout = 0;

function toggleElement(elementId, linkId, state)
{
    /// {{{

    var obj     = document.getElementById(elementId);
    var state   = (typeof state == 'undefined') ? obj.style.display : state;

    if (state == 'block')
    {
        obj.style.display = 'none';
        className         = 'open';
    }
    else
    {
        obj.style.display = 'block';
        className         = 'open close';
    }

    if (typeof linkId != 'undefined' && document.getElementById(linkId))
    {
        document.getElementById(linkId).className = className;
        document.getElementById(linkId).blur();
    }


    return;

    /// }}}
}



function showFlyout(id)
{
    /// {{{

    var newFlyout = document.getElementById('flyout' + id);
    var oldFlyout = document.getElementById('flyout' + currentFlyout);

    if (oldFlyout)
    {
        oldFlyout.style.display = 'none';
    }

    if (newFlyout)
    {
        newFlyout.style.display = 'block';
        currentFlyout = id;
    }

    /// }}}
}


function hideFlyout(id)
{
    /// {{{

    var blaFlyout = document.getElementById('flyout' + id);

    if (blaFlyout)
    {
        blaFlyout.style.display = 'none';
    }

    /// }}}
}
