function disableFront()
{
  if (document.article_form.group_id.value == 0)
  {
    document.article_form.front_id.disabled = true;
    document.article_form.front_id.id = "input_disabled";
  }
  else
  {
    document.article_form.front_id.disabled = false;
    document.article_form.front_id.id = "input";
  }
}

function userDeletePending(id)//
{
  if (confirm("Willst du die Einladung wirklich löschen?"))
  {
    window.location.href = "config_user_delete_pending.php?id=" + id;
  }
}

function deleteFile(id)//
{
  if (confirm("Willst du die Datei wirklich löschen?"))
  {
    window.location.href = "config_file_delete.php?id=" + id;
  }
}

function deletePicture(id)//
{
  if (confirm("Willst du das Bild wirklich löschen?"))
  {
    window.location.href = "config_picture_delete.php?id=" + id;
  }
}

//#############################################################################

function buttonArticleSave()//
{
  if (document.article_form.title.value == "")
  {
    alert("Du musst wenigstens den Titel angeben.");
  }
  else
  {
    document.article_form.action = "config_article_save.php";
    document.article_form.submit();
  }
}

function buttonPictureForm()//
{
  if (document.article_form.title.value == "")
  {
    alert("Du musst wenigstens den Titel angeben.");
  }
  else
  {
    document.article_form.action = "config_article_save.php?add_pictures";
    document.article_form.submit();
  }
}

function buttonArticleDelete()//
{
  if (confirm("Willst du den Artikel wirklich löschen?"))
  {
    if (confirm("Willst du die zugehörigen Bilder auch löschen?"))
    {
      document.article_form.action = "config_article_delete.php?pictures";
    }
    else document.article_form.action = "config_article_delete.php";
    
    document.article_form.submit();
  }
}

function buttonPictureAdd()//
{
  if (document.picture_form.picture.value == "")
  {
    alert("Du musst ein Bild auswählen.");
  }
  else
  {
    document.picture_form.picture_add.value = "bitte warten";
    document.picture_form.action = "config_picture_add.php";
    document.picture_form.submit();
  }
}

function buttonPictureSave()//
{
  document.picture_form.action = "config_picture_add.php?update";
  document.picture_form.submit();
}

function buttonFileAdd()//
{
  if (document.file_form.file.value == "")
  {
    alert("Du musst eine Datei auswählen.");
  }
  else if (document.file_form.comment.value == "")
  {
    alert("Du musst eine Beschreibung abgeben.");
  }
  else
  {
    document.file_form.file_add.value = "bitte warten";
    document.file_form.action = "config_file_add.php";
    document.file_form.submit();
  }
}

function buttonFileSave()//
{
  if (document.file_form.comment.value == "")
  {
    alert("Du musst eine Beschreibung abgeben.");
  }
  else
  {
    document.file_form.action = "config_file_add.php?update";
    document.file_form.submit();
  }
}

function buttonUserInvite()//
{
  if (document.user_invite_form.email.value == "")
  {
    alert("Du musst eine Email-Adresse angeben.");
  }
  else
  {
    document.user_invite_form.action = "config_user_invite.php";
    document.user_invite_form.submit();
  }
}

function buttonUserActivate()//
{
  if (document.user_activate_form.name.value == "" || document.user_activate_form.userf.value == "" || document.user_activate_form.passf.value == "" || document.user_activate_form.pass2.value == "")
  {
    alert("Fülle bitte alle Felder aus.");
  }
  else
  {
    if (document.user_activate_form.passf.value != document.user_activate_form.pass2.value)
    {
      alert("Die Passwörter stimmen nicht überein.");
      
      document.user_activate_form.passf.value = "";
      document.user_activate_form.pass2.value = "";
      document.user_activate_form.passf.focus();
    }
    else
    {
      document.user_activate_form.action = "config_user_activate.php";
      document.user_activate_form.submit();
    }
  }
}

function buttonUserSave()//
{
  if (document.user_form.name.value == "")
  {
    alert("Du musst wenigstens den Namen (oberstes Feld) angeben.");
  }
  else
  {
    document.user_form.action = "config_user_save.php";
    document.user_form.submit();
  }
}

function buttonUserDelete()//
{
  if (confirm("Willst du das Benutzerkonto wirklich löschen?"))
  {
    document.user_form.action = "config_user_delete.php";
    document.user_form.submit();
  }
}

