// ===============
// = Login Modal =
// ===============

var loginModal;

function initall ()
{
    initOverlays();

    // try to focus the login input
    var e = document.getElementById('page_username');
    if (e != null) e.focus();
}

function initOverlays ()
{
    loginModal = new YAHOO.widget.Panel("loginModal", {
        modal: true,
        fixedcenter: true,
        constraintoviewport: true,
        underlay: "shadow",
        close: true,
        visible: false,
        zIndex: 10,
        monitorresize: false } );
    loginModal.render();
}

addLoadEvent(initall);

function showLoginModal()
{
    if (browser.isIE6x)
    {
        window.location = '/login';
        return false;
    }

    var e = document.getElementById('loginModal');
    e.style.display = 'block';

    loginModal.show();

    // focus username input
    e = document.getElementById('username');
    e.focus();

    return false;
}

function swap (e, img)
{
    e.src = img;
}
