function showLoginDialog()
{
    showDialog("login_dialog");
    document.admin_login.admin_pwd.focus();
}

function closeLoginDialog()
{
    showLoginDialog();
}

function switchToNormalMode()
{
    deleteCookie("admin_mode_pwd");
    
    document.location.href = "index.php?switch=home";
}

function deleteNews(techCategory, id, category, title)
{
    if (confirm("Wollen Sie den News-Eintrag \"" + title + "\" aus der Rubrik \"" + category + "\" wirklich löchen?"))
    {
        var hr = location.href;
        var pos = hr.indexOf("#");
        if (pos >= 0)
            hr = hr.substr(0, pos);
        location.href = (hr + "&admin=delete&item=" + encodeURI(techCategory + "/" + id));
    }
}

function deleteEssay(techCategory, id, category, title)
{
    if (confirm("Wollen Sie den Aufsatz \"" + title + "\" aus der Rubrik \"" + category + "\" wirklich löchen?"))
    {
        var hr = location.href;
        var pos = hr.indexOf("#");
        if (pos >= 0)
            hr = hr.substr(0, pos);
        location.href = (hr + "&admin=delete");
    }
}

function deleteFAQ(id, question)
{
    if (confirm("Wollen Sie den FAQ-Eintrag \"" + question + "\" wirklich löchen?"))
    {
        var hr = location.href;
        var pos = hr.indexOf("#");
        if (pos >= 0)
            hr = hr.substr(0, pos);
        location.href = (hr + "&admin=delete&item=" + id);
    }
}

function deleteAgendaPos(id, position)
{
    if (confirm("Wollen Sie die Agenda-Position \"" + position + "\" wirklich löchen?"))
    {
        var hr = location.href;
        var pos = hr.indexOf("#");
        if (pos >= 0)
            hr = hr.substr(0, pos);
        location.href = (hr + "&admin=delete&item=" + id);
    }
}

function setStatisticLockCookie()
{
    document.statistic.stat_lock_cookie.value = "set";
    document.statistic.submit();
}
function deleteStatisticLockCookie()
{
    document.statistic.stat_lock_cookie.value = "delete";
    document.statistic.submit();
}

function getSelectedRadioValue(radios)
{
    if (radios.length != null)
    {
        for (var i = 0; i < radios.length; i++)
        {
            if (radios[i].checked)
                return(radios[i].value);
        }
        
        return(null);
    }
    else
    {
        return(radios.value);
    }
}
