cmsAdminLogin = {
    div : null,
    'init' : function() {
    if (adminMode != 'DIRECT') {
      shortcut.add("Ctrl+Alt+L", function() {
        if (adminMode != 'PORTAL') {
          cmsAdminLogin.toggle();
        } else {
            var logoutForm = document.createElement("form");
            logoutForm.method = "POST";
            logoutForm.innerHTML = "<input name='command' type='hidden' value='logoutAdmin'/>";
            document.body.appendChild(logoutForm);
            logoutForm.submit();
            }
      });
        }
    },
    'toggle' : function() {
        if (cmsAdminLogin.div != null) {
            cmsAdminLogin.hide();
            return;
        }

        var div = document.createElement("div");

    div.className = "adminLoginDiv";

    div.style.top = (getScrollY()) + "px";

        var form = document.createElement("form");
        form.method = "POST";

        div.appendChild(form);
    form.innerHTML = "<input id='command' name='command' type='hidden' value='loginAdmin'/><table><tr><td>login: </td><td><input name='login' type='text' id='adminLoginField'/></td></tr><tr><td>password: </td><td><input name='password' type='password'/></td></tr><tr><td colspan=2><input name='submitLogin' type='submit' value='Login' /></td></tr></table>";

        document.body.appendChild(div);
    document.getElementById("adminLoginField").focus();
        cmsAdminLogin.div = div;

        shortcut.add("esc", function() {
            cmsAdminLogin.hide();
        });
    },
    'hide' : function() {
        document.body.removeChild(cmsAdminLogin.div);
        shortcut.remove("esc");
        cmsAdminLogin.div = null;
    }
};


