

loaded = false;
AT_NT  = -1;
Ester  = false;
Uebersetzung = 44;
 
function addUeb(fobj,ueb){
 if (!loaded) return;
 Uebersetzung = ueb;
}
 
function addBuch(fobj,vi_atnt){
 if (!loaded) return;
 AT_NT = vi_atnt;
 B = fobj.Buch;
 K = fobj.Kapitel;
 V = fobj.Vers;
 B.length = K.length = V.length = 1;
 for (i=0; i<Buecher[vi_atnt].length; i++) B.options[i+1] = new Option(Buecher[vi_atnt][i].Name,i);
 B.options[0].selected = K.options[0].selected = V.options[0].selected = true;
}
 
function addKapitel(fobj,nr){
 if (!loaded || AT_NT<0) return;
 Ester = false;
 B = fobj.Buch;
 K = fobj.Kapitel;
 V = fobj.Vers;
 V.length = K.length = 1;
 Kapitel_Anz = Buecher[AT_NT][B.options[nr].value].Kapitel;
 Verse_Anz   = Buecher[AT_NT][B.options[nr].value].Verse.split('-');
 if (AT_NT == 0 && nr == 19)
  {
    Ester = true;
    K.options[1] = new Option('(1)',18);
    for (i=1; i<Kapitel_Anz; i++) K.options[i+1] = new Option(i,Verse_Anz[i-1]);
    K.options[0].selected = V.options[0].selected = true;
    return;
  }
 if (B.options[nr].value<0)
  {
    K.options[0].selected = V.options[0].selected = true;
    return;
  }
 if (!Kapitel_Anz)
  {
    K.length = V.length = 1;
    B.options[0].selected = K.options[0].selected = V.options[0].selected = true;
    return;
  }
 for (i=0; i<Kapitel_Anz; i++) K.options[i+1] = new Option(i+1,Verse_Anz[i]);
 K.options[0].selected = V.options[0].selected = true;
}
 
 
/* fügt die verfügbaren Verse ein */
function addVers(fobj,nr){
 if (!loaded || AT_NT<0) return;
 K = fobj.Kapitel;
 V = fobj.Vers;
 V.length = 1;
 if (K.options[nr].value<0)
  {
    V.options[0].selected = true;
    return;
  }
 
 Vers_Anz = K.options[nr].value;
 
 
 if (!Vers_Anz)
  {
    K.options[0].selected = V.options[0].selected = true;
    return;
  }
 if (Ester)
  {
    if (nr==1)
     {
       for (i=0;  i<= 8; i++) V.options[i+1] = new Option('1'+String.fromCharCode(97+i),i+1);
       for (i=10; i< 18; i++) V.options[i]   = new Option('1'+String.fromCharCode(97+i),i);
     }
    else for (i=0; i<Vers_Anz; i++) V.options[i+1] = new Option(i+1,i+1);
  }
 else
  {
    for (i=0; i<Vers_Anz; i++) V.options[i+1] = new Option(i+1);
  }
 V.options[0].selected = true;
 
 
}
 
function checkForm(fobj){
 
 
 if (AT_NT < 0)
  {
    alert('Bitte wählen Sie zuerst Altes Testament oder Neues Testament.');
    return false;
  }
 Buch = fobj.Buch.options[fobj.Buch.selectedIndex].value
 if (Buch < 0)
  {
    alert('Bitte wählen Sie zuerst ein Buch aus.');
    return false;
  }
 
ka = fobj.Kapitel.options[fobj.Kapitel.selectedIndex].value
 if (ka < 0)
  {
    alert('Bitte wählen Sie zuerst ein Kapitel aus.');
    return false;
  }
 
 
 
 // Js Auswahl an PHP weiterleiten
 ue = Uebersetzung;
 ntat = AT_NT;
 bu = Buch;
 ka = fobj.Kapitel.options[fobj.Kapitel.selectedIndex].text;
 ve = fobj.Vers.options[fobj.Vers.selectedIndex].text;
 
 //bu=bu+1
 
 
location='ob.php?ntat='+ ntat +'&bu='+ bu +'&ka='+ ka +'&ve='+ ve +'&ue='+ ue + ' ';
}

