function AktualisiereExportTermin(select, saison) {
  var wert = select.options[select.options.selectedIndex].value;

  window.location.href = "exportTermin.php?Saison="+saison+"&Verein="+wert;
}

function ExportiereTabellePDF () {

  window.location.href = "tabelleExp.php";

}



function AktualisiereAdminMain(select) {

  var wert = select.options[select.options.selectedIndex].value;

  window.location.href = "adminMain.php?Saison="+wert;

}



function AktualisiereSpielliste(select, klasse, runde, saison, beglaubigt, verein, sortierung, aktualisierungtyp) {

  if (aktualisierungtyp == "klasse") {

  var wert = select.options[select.options.selectedIndex].value;

    window.location.href = "spiele.php?Saison="+saison+"&Klasse="+wert+"&Runde="+runde+"&Beglaubigt="+beglaubigt+"&Verein="+verein+"&Sortierung="+sortierung;

  }

  if (aktualisierungtyp == "runde") {

    var wert = select.options[select.options.selectedIndex].value;

    window.location.href = "spiele.php?Saison="+saison+"&Klasse="+klasse+"&Runde="+wert+"&Beglaubigt="+beglaubigt+"&Verein="+verein+"&Sortierung="+sortierung;

  }

  if (aktualisierungtyp == "beglaubigt") {

    var wert = select.options[select.options.selectedIndex].value;

    window.location.href = "spiele.php?Saison="+saison+"&Klasse="+klasse+"&Runde="+runde+"&Beglaubigt="+wert+"&Verein="+verein+"&Sortierung="+sortierung;

  }

  if (aktualisierungtyp == "verein") {

    var wert = select.options[select.options.selectedIndex].value;

    window.location.href = "spiele.php?Saison="+saison+"&Klasse="+klasse+"&Runde="+runde+"&Beglaubigt="+beglaubigt+"&Verein="+wert+"&Sortierung="+sortierung;

  }

  if (aktualisierungtyp == "sortierung") {

    var wert = select.options[select.options.selectedIndex].value;

    window.location.href = "spiele.php?Saison="+saison+"&Klasse="+klasse+"&Runde="+runde+"&Beglaubigt="+beglaubigt+"&Verein="+verein+"&Sortierung="+wert;

  }

}



function AktualisiereSpieleingabe(select, saison, neuanlage) {

  if (neuanlage == "1") {

    var wert = select.options[select.options.selectedIndex].value;

    window.location.href = "spieldetailEdit.php?Saison="+saison+"&Klasse="+wert+"&neuesSpiel="+neuanlage;

  }

}



function AktualisiereSpielerliste (select, saison) {

  var wert = select.options[select.options.selectedIndex].value;

  window.location.href = "spieler.php?Saison="+saison+"&Verein="+wert;

}



function AktualisiereTabelle (select, saison, export1, runde, verein, typ) {

  var wert = select.options[select.options.selectedIndex].value;

  if (export1 == "") {
    if (typ == 'verein') {
      window.location.href = "tabelle.php?Saison="+saison+"&Runde="+runde+"&Verein="+wert;
    }
    if (typ == "runde") {
      window.location.href = "tabelle.php?Saison="+saison+"&Runde="+wert+"&Verein="+verein;
    }
  }

  else {

    window.location.href = "tabelle.php?Saison="+saison+"&Runde="+wert+"&Export="+export1;

  }

}



function AktualisiereSchnittliste (select, verein, saison, runde, geschlecht, minSpiele, aktualisierungtyp, export1, markierung, mitHeimAusw) {
  if (aktualisierungtyp == "verein") {
    var wert = select.options[select.options.selectedIndex].value;
    window.location.href = "schnittliste.php?Saison="+saison+"&Verein="+wert+"&Runde="+runde+"&Geschlecht="+geschlecht+"&MinSpiele="+minSpiele+"&Export="+export1+"&Markierung="+markierung+"&MitHeimAusw="+mitHeimAusw;
  }

  if (aktualisierungtyp == "runde") {
    var wert = select.options[select.options.selectedIndex].value;
    window.location.href = "schnittliste.php?Saison="+saison+"&Verein="+verein+"&Runde="+wert+"&Geschlecht="+geschlecht+"&MinSpiele="+minSpiele+"&Export="+export1+"&Markierung="+markierung+"&MitHeimAusw="+mitHeimAusw;
  }

  if (aktualisierungtyp == "geschlecht") {
    var wert = select.options[select.options.selectedIndex].value;
    window.location.href = "schnittliste.php?Saison="+saison+"&Verein="+verein+"&Runde="+runde+"&Geschlecht="+wert+"&MinSpiele="+minSpiele+"&Export="+export1+"&Markierung="+markierung+"&MitHeimAusw="+mitHeimAusw;
  }

  if (aktualisierungtyp == "minSpiele") {
    var wert = select.options[select.options.selectedIndex].value;
    window.location.href = "schnittliste.php?Saison="+saison+"&Verein="+verein+"&Runde="+runde+"&Geschlecht="+geschlecht+"&MinSpiele="+wert+"&Export="+export1+"&Markierung="+markierung+"&MitHeimAusw="+mitHeimAusw;
  }

  if (aktualisierungtyp == "markierung") {
    var wert = select.options[select.options.selectedIndex].value;
    window.location.href = "schnittliste.php?Saison="+saison+"&Verein="+verein+"&Runde="+runde+"&Geschlecht="+geschlecht+"&MinSpiele="+minSpiele+"&Export="+export1+"&Markierung="+wert+"&MitHeimAusw="+mitHeimAusw;
  }

  if (aktualisierungtyp == "mitHeimAusw") {
    var wert = select.options[select.options.selectedIndex].value;
    window.location.href = "schnittliste.php?Saison="+saison+"&Verein="+verein+"&Runde="+runde+"&Geschlecht="+geschlecht+"&MinSpiele="+minSpiele+"&Export="+export1+"&Markierung="+markierung+"&MitHeimAusw="+wert;
  }
}



function AktualisiereBesteSaisonergebnisse (select, verein, saison, geschlecht, einzel, kegelbahn, aktualisierungtyp) {

  if (aktualisierungtyp == "verein") {

  var wert = select.options[select.options.selectedIndex].value;

    window.location.href = "besteSaisonergebnisse.php?Saison="+saison+"&Verein="+wert+"&Geschlecht="+geschlecht+"&Einzel="+einzel+"&Kegelbahn="+kegelbahn;

  }

  if (aktualisierungtyp == "geschlecht") {

    var wert = select.options[select.options.selectedIndex].value;

    window.location.href = "besteSaisonergebnisse.php?Saison="+saison+"&Verein="+verein+"&Geschlecht="+wert+"&Einzel="+einzel+"&Kegelbahn="+kegelbahn;

  }

  if (aktualisierungtyp == "einzel") {

    var wert = 0;

    if (select.checked) {

      wert = 1;

    }

    window.location.href = "besteSaisonergebnisse.php?Saison="+saison+"&Verein="+verein+"&Geschlecht="+geschlecht+"&Einzel="+wert+"&Kegelbahn="+kegelbahn;

  }

  if (aktualisierungtyp == "kegelbahn") {

    var wert = select.options[select.options.selectedIndex].value;

    window.location.href = "besteSaisonergebnisse.php?Saison="+saison+"&Verein="+verein+"&Geschlecht="+geschlecht+"&Einzel="+einzel+"&Kegelbahn="+wert;

  }

}



function AktualisiereBesteMannschaftsergebnisse(select, saison, einzel, kegelbahn, heimausw, aktualisierungtyp) {

  if (aktualisierungtyp == "kegelbahn") {

    var wert = select.options[select.options.selectedIndex].value;

    window.location.href = "besteMannschaftsergebnisse.php?Saison="+saison+"&Kegelbahn="+wert+"&Einzel="+einzel+"&HeimAusw="+heimausw;

  }

  if (aktualisierungtyp == "einzel") {

    var wert = 0;

    if (select.checked) {

      wert = 1;

    }

    window.location.href = "besteMannschaftsergebnisse.php?Saison="+saison+"&Kegelbahn="+kegelbahn+"&Einzel="+wert+"&HeimAusw="+heimausw;

  }

  if (aktualisierungtyp == "heimausw") {

    var wert = select.options[select.options.selectedIndex].value;

    window.location.href = "besteMannschaftsergebnisse.php?Saison="+saison+"&Kegelbahn="+kegelbahn+"&Einzel="+einzel+"&HeimAusw="+wert;

  }

}



function StarteSpielNeuanlage (saison) {

  window.location.href = "spieldetailEdit.php?neuesSpiel=1&Saison="+saison;

}



function StarteAlleSpiele (saison, runde, klasse) {

  window.location.href = "spiele.php?neuesSpiel=1&Saison="+saison+"&Runde="+runde+"&Klasse="+klasse;

}



function GeheZuAdminIndex (saison) {

  window.location.href = "adminMain.php";

}





function chkSpieler () {

  if (document.Formular.Nachname.value == "") {

    alert("Bitte geben sie einen Nachnamen ein!");

    document.Formular.Nachname.focus();

    return false;

  }

  if (document.Formular.Vorname.value == "") {

    alert("Bitte sie einen Vornamen ein!");

    document.Formular.Vorname.focus();

    return false;

  }

  var chkZ = 1;

  for (i = 0; i < document.Formular.Passnr.value.length; ++i)

    if (document.Formular.Passnr.value.charAt(i) < "0" ||

        document.Formular.Passnr.value.charAt(i) > "9")

      chkZ = -1;

  if (chkZ == -1) {

    alert("Passnummer keine Zahl!");

    document.Formular.Passnr.focus();

    return false;

  }

  if (!(PruefeDatum(document.Formular.Gebdat.value, 1900, 2100))) {

    alert("Kein gueltiges Geburtsdatum!\nBitte Datum in der Form: TT.MM.JJJJ eingeben!");

    document.Formular.Gebdat.focus();

    return false;

  }

  if (!(PruefeDatum(document.Formular.InaktivSeit.value, 1900, 2100))) {

    alert("Kein gueltiges Inaktivdatum!\nBitte Datum in der Form: TT.MM.JJJJ eingeben!");

    document.Formular.InaktivSeit.focus();

    return false;

  }

  if (!(PruefeDatum(document.Formular.Anmeldedatum.value, 1900, 2100))) {

    alert("Kein gueltiges Anmeldedatum!\nBitte Datum in der Form: TT.MM.JJJJ eingeben!");

    document.Formular.Anmeldedatum.focus();

    return false;

  }

}



function PruefeDatum(Datum, Startjahr, Endjahr) {

var Datum, Tag, Monat, Jahr, Laenge, tageMonat;

    Laenge=Datum.length;



  if (Datum == "") {

    return true;

  }

  if (Laenge==10 && Datum.substring(2,3)=="." && Datum.substring(5,6)==".") {

      Tag=parseInt(Datum.substring(0,2),10);

      Monat=parseInt(Datum.substring(3,5),10);

      Jahr=parseInt(Datum.substring(6,10),10);

  }

  else {

  return false;

  }

  if (Monat==4 || Monat==6 || Monat==9 || Monat==11) {

    tageMonat=30;

  }

  else if (Monat==1 || Monat==3 || Monat==5 || Monat==7 || Monat==8 || Monat==10 || Monat==12) {

    tageMonat=31;

    }

    else if(Monat==2 && Jahr%4==0 && Jahr%100!=0 || Jahr%400==0) {

      tageMonat=29;

      }

      else if(Monat==2 && Jahr%4!=0 || Jahr%100==0 && Jahr%400!=0) {

        tageMonat=28;

        }



  if (Tag>=1 && Tag<=tageMonat && Monat>=1 && Monat<=12 && Jahr>=Startjahr && Jahr<=Endjahr)  {

    return true;

  }

  else {

    return false;

  }

}



function CheckPassword(altesPwd) {

  if ((document.Formular.oldPwd.value == altesPwd) && (document.Formular.newPwd1.value == document.Formular.newPwd2.value)){

	return true;

  }

  else {

    alert("Eingaben ungültig!");

    document.Formular.oldPwd.focus();

    return false;

  }

}



function chkSpiel() {

  if (document.Formular.Datum.value == "") {

    alert("Bitte geben sie ein Datum ein!");

    document.Formular.Datum.focus();

    return false;

  }

  if (!(PruefeDatum(document.Formular.Datum.value, 2008, 2100))) {

    alert("Kein gueltiges Spieldatum!\nBitte Datum in der Form: TT.MM.JJJJ eingeben!");

    document.Formular.Datum.focus();

    return false;

  }

  if (document.Formular.Uhrzeit.value == "") {

    alert("Bitte geben sie eine Uhrzeit ein!");

    document.Formular.Uhrzeit.focus();

    return false;

  }



}
