<!-- JavaScript zu lohntab.htm  - letzte Änderung 12.3.2009


  function loesch() {
  document.eingabe.anwert.value="";
  document.eingabe.endwert.value="0";
  document.eingabe.anwert.focus();
  document.eingabe.anwert.select();
  }
  function anfang() {
  auswahl()
  stklbeginn = new Array (0, 19440, 20196, 10332, 0)
  if(j>4) stklbeginn[j]=10764;
  document.eingabe.anwert.value=Math.round(((stklbeginn[j])*euro*100)/ze)/100;
  document.eingabe.endwert.value=Math.round(((stklbeginn[j])*euro*100)/ze)/100+ Math.round(20*teiler[j]*euro/ze)
  if(j>3)document.eingabe.endwert.value= 36 + Math.round(((stklbeginn[j])*euro*100)/ze)/100;
  document.eingabe.anwert.focus();
  document.eingabe.anwert.select();

 }
   function auswahl() {
        j=1;
         for (ij=0;ij<document.jahr.zahl.length;++ij) {
              if (document.jahr.zahl.options[ij].selected == true)
                 j=ij+1;
      if (j==4) j=3;
   }

     if (document.eingabe.wert.checked && j>2)
        euro=1.95583;
     else
       euro=1;
      dis = " &nbsp; ";
      if(j<3 || euro != 1) {
         wh=" DM ";
         tit= "ab ";

     document.eingabe.dm1.value ="DM";
    }
  else {
      wh = " € ";
      tit="ab ";

     document.eingabe.dm1.value =" €";
    }
     // -----------------  die Arrays ------------------------------

     Zeitangab = new Array ("Tages-","Wochen-", "Monats-", "Jahres-");
     jang= new Array ("1999","2000", "2001", "2002 und 2003"," ", "2004", "2005", "2006", "2007", "2008", "2009");
     rvgrenzw= new Array(62400,63000,63000,63600,64800);
     anfst= new Array(13067, 13499, 14093, 7235, 0);
     if(j>4) anfst[j]=7664; anfst[10]=7834;
     midst = new Array(66365, 17495, 18089, 9251, 0);
     if(j>4) midst[j]=12739; midst[10]=13139;
     endst = new Array(120041, 114695, 107567, 55007, 0);
     if(j>4) endst[j]=52151; endst[10]=52551;
     y1 = new Array(350.35, 262.76, 387.89, 768.85, 0, 793.10);
     if(j>5) y1[j]=883.74; y1[10]=939.68;
     yzahl = new Array(2390, 2290, 1990, 1990, 0, 1600);
     if(j>5) yzahl[j]=1500; yzahl[10]=1400;
     z1 = new Array(151.93, 133.74, 142.49, 278.65, 0, 265.78);
     if(j>5) z1[j]=228.74;
     zzahl1 = new Array(3669, 2500, 2300, 2300, 0, 2405);
     if(j>5) zzahl1[j]=2397
     zzahl2 = new Array(16637, 957, 857, 432, 0, 1016);
     if(j>5) zzahl2[j]=989; zzahl2[10]=1007;
     x1 = new Array(0.53, 0.51, 0.485, 0.485, 0, 0.45);
     if(j>5) x1[j]=0.42;
     xzahl = new Array(22886, 20575, 19299, 9872, 0, 8845);
     if(j>5) xzahl[j]=7914; xzahl[10]=8064;
     ztausy = new Array(13014, 13446, 14040, 7200, 0);
     if(j>4) ztausy[j]= anfst[j];
     ztausx = new Array(66312, 17442, 18036, 9216, 0);
     if(j>4) ztausx[j] = midst[j];
     teiler = new Array(54, 54, 54, 36);
     if(j>3) teiler[j]=1;
     teilervor = new Array(0,0,53,35);
     if(j>3) teilervor[j]=0
     st6deckel=new Array(64476, 57348, 53784, 27306, 0, 26072);
     if(j>5) st6deckel[j]=25812; st6deckel[10]=26276;
     st6grenz=new Array( 0, 17118, 17442, 8946, 0, 9228);
     if(j>5) st6grenz[j]=9144; st6grenz[10]=9225;
     adder = new Array(0, 0, 27, 18);
     if(j>3) adder[j]=0;
     anfsteuer= new Array(1,12,16);
     if(j>2) anfsteuer[j]=10
     solibas = ( j < 3 ? 1836 : 972);
     reichenmax = new Array(0,0,0,0,0,0,0,0,250000,250000,250400);
     reichensub = new Array(0,0,0,0,0,0,0,0,15414,15414,15576);
     reichenmaxst6 = new Array(0,0,0,0,0,0,0,0,200000,200000,200320);

     if (document.eingabe.zeit.options[0].selected){
                 ze=360; zr=0;}
     if (document.eingabe.zeit.options[1].selected) {
                 ze=360/7; zr=1;}
     if (document.eingabe.zeit.options[2].selected) {
                 ze=12; zr=2;}
     if (document.eingabe.zeit.options[3].selected) {
                 ze=1; zr=3;}

     klass= new Array(0,"I","II","III","IV","V","VI");
     stklass = new Array(0,0,0,0,0,0,0);
      for(k=0;k<6;k++) {
      if(document.eingabe.elements[k].checked)
        stklass[k+1]=1;
     }
     kiklass= new Array(0,0,0,0,0,0,0,0,0,0);
     for(k=6;k<14;k++) {
      if(document.eingabe.elements[k].checked)
            kiklass[k-4]=(k-5)*0.5;
       }

     if (document.eingabe.KiSt.options[0].selected)kist=8;;
     if (document.eingabe.KiSt.options[1].selected)kist=9;

     if(document.eingabe.tabteiler[0].selected)teil=1;
     if(document.eingabe.tabteiler[1].selected)teil=2;
     if(document.eingabe.tabteiler[2].selected)teil=3;

      altzus="";
      altersentlast=0;
      versorgtxt="";
      versorgfrei=0;
      vfrei=0;

    if (document.eingabe.tabelle[0].selected)
         typ=("Allgemeine ");
    else
         typ=("Besondere ");


     function change(z){
             z=z.replace(/,/,".");
             z=parseFloat(z);
             if (isNaN(z)) z=0;
             return Math.abs(z);
  }
     // ------ hier kann Abfrage fuer groessere Schritte eingefuegt werden

  }

function erstellen() {
   auswahl()
   tabstring="";
   Text="";
   schritt=teiler[j];
     if(j>3){
    schritt=36;
    vschritt=prompt("Tabellenschritte wählen: mit OK (ohne Eingabe) wird offizielle Tabellen erstellt. Sonst gewünschten Tabellenschritt (für Jahrestabelle) eingeben.",Math.round(schritt) +wh+"(Neueingabe: nur Zahl, keine Währung eingeben!) ");
      schritt=parseInt(vschritt)
      if (isNaN(schritt)) schritt=1000;
      schritt=Math.round(schritt);
      if(schritt!= 36) tit="für ";
   }
   if(vschritt != null){
   win=window.open("","tabelle",'scrollbars=yes,status=yes,menubar=yes,resizable=yes');  //Fenstergroesse

   win.moveTo(0,0);
   win.resizeTo(screen.width*0.8,screen.height);

   tabstring+= ("<html><STYLE>TD {font-size: 8pt;font-family: arial;}></style><body>");

//  -------Tabellenanfangs- und Endbedingungen festlegen -----------
   stzahl = 1;
    for (n=1;n<7;n++) {
        if (stklass[n] ==1)
          stzahl+=1;
    }

   if (j==1) {                  // bei Tabellenwerte Zahlen hinterm Komma vorgeben (nur fuer 2000)
         tabkorr=2;
        if(ze==12)
         tabkorr1 = 0.16;
        if (ze==360/7)
          tabkorr1 = 0.03;
        if (ze==360)
          tabkorr1 = 0;
       if (ze==1)
          tabkorr1=2;
    }
      else  {
        tabkorr=0;
        tabkorr1=0;
   }

  if(document.eingabe.anwert.value=="")
     document.eingabe.anwert.value=0;
  an = parseInt(document.eingabe.anwert.value);
  if(isNaN(an))
  an=0;
  if(document.eingabe.anwert.value=="" || isNaN(an))
     document.eingabe.anwert.value=0;
  an=Math.max(an*ze/euro, 0);
   if(j>3) an=Math.floor(an/schritt)*schritt;
  aw = (Math.floor(an/teiler[j])*teiler[j])+tabkorr;
  en = parseInt(document.eingabe.endwert.value);
  if (isNaN(en))  en=0;
  en=en*ze/euro;
   if(j>3) en=Math.floor(en/schritt)*schritt;
  if (en < aw+schritt)
       en=aw+schritt*10;
  ew = (Math.floor(en/teiler[j])*teiler[j])+tabkorr;


// -------------------- Vorbedingungen-----------------------------

   steufreistr="";
   stfrei=0;
    kitab=("<TD colspan=2 align=center> <b> 0.0 </TD>");
    kitabstr=("<TD align=center>SolZ</TD><TD>KiStr</TD>");
    for (m=2;m<10;m++){
         if(kiklass[m] !=0) {
            kitab+=("<TD colspan=2 align=center> <b> " + kiklass[m] + " </TD>");
            kitabstr+=("<TD align=center>SolZ</TD><TD>KiStr</TD>");
            stfrei++;
       }
    }
    steufreistr+=("<TD colspan="+ 2*stfrei + ">&nbsp;</TD>");
    if (stfrei==0) steufreistr="";

    start=aw;
    kitablang = stfrei + 2;
    if(kitablang>3) teil=1;
    if(kitablang==3 && teil>=2) teil=2;

   // --------------------Anzahl der Seiten berechnen ----------------
  dz=0;
  zeile=parseInt(document.eingabe.zeile.value);
  vorgabzeilen=zeile;
  if(zeile<10 || isNaN(zeile))
   zeile=10;
  zeile=Math.floor(zeile/(stzahl-1));
  if (stzahl==2)
    zeile-=1;
  seitzahl=Math.floor((ew-aw)/(schritt*teil*zeile));
  seitrest=Math.floor((ew-aw)/(schritt*teil)) % zeile;
  if(seitrest>0)
  seitzahl=seitzahl+1;

 // Ladeanzeige


   if(!isNS) {    // geht nicht mit Netscape 8

   wintab=window.open('','','height=60,width=300')

   if(screen.width <= 800){
     fsize=2;fstyle=4;fsganz=130;
   }
   else {
     fsize=1;fstyle=2;fsganz=260;
     }

   wintab.document.write("<body bgcolor=d0d0d0>");
   wintab.document.write("<form><font size=2 face=arial><b>Tabelle wird erstellt. Bitte warten . . . . </b><br>");

    wintab.document.write("<input size="+fsganz+" style='font-size: " +fstyle+"pt; color: FF00FF;font-weight:bold;'><p><small><small>&#169; Parmentier</form>");

   wintab.document.write("</body>");

   }
   s="";


   // ------------------Beginn der Tabellenerstellung-----------------

 for (seite = 1; seite<seitzahl+1; seite+=1) {   // Seite kreieren

   um=(zeile)*(stzahl-1);
   zuzeile=(vorgabzeilen-um);
   zusatz="";
  for (zu=1;zu<zuzeile;zu++)
   zusatz+=("<BR>");
  ende=(seite*zeile*schritt*teil)+ start;
  ab=0;
  if (ze!=1 && j !=1)
    ab=1;
  tabanfang=(Math.floor(aw*euro*100/ze)/100);
  tabende=(Math.round((Math.round((ende-tabkorr)*euro*100/ze)/100)*100-ab)/100)+ tabkorr1;

   //--------- hier wird die Tabellenbreite festgelegt---------------

   zl=(tabende +"").length;
   breit=(5*zl)+2;
   if(kitablang>2)
   breit+=(kitablang-2)*zl*2;
   breit=breit*6.2*teil ;

   if(breit>screen.width){
    breittab=("width="+breit);
    pos="left";
   }
   else {
   pos="center";
   breittab="";
   }
  if(isNS)
    breittab=("width="+ Math.round(breit*1.2));


    tabstring+= ("<center><font size=4 face=arial><b>"+ typ + Zeitangab[zr]);
    if(j<4 || j>3 && schritt==36){
      tabstring+= ("Lohnsteuertabelle " + jang[j] + "</b></font>\n<br>");
      }
    else {
      tabstring+= ("Lohnsteuer " + jang[j] + ", tabellarisch<b></font>\n<br>");
    }
    if(zr!=3){
    tabanfang$ = punkt(tabanfang);
    tabende$ = punkt(tabende);
    }
    else {
    tabanfang$ = tausender(tabanfang);
    tabende$ = tausender(tabende);
    }

    tabstring+= ("<font face=arial size=2>von "  + tabanfang$ + wh + " bis  "  + tabende$ + wh + ", <b> Kirchensteuer " +  kist + "% </b>" + altzus + versorgtxt + "<Hr size=0 noshade>\n");

    tabstring+= ("<table cellpadding=0 cellspacing=10 border=0 " + breittab + "><tr><td valign=top align=" + pos + "><table bgColor=#F0F0F0 border=0 cellpadding=1 cellspacing=0>")

    tabstring+= ("<TR><TD>&nbsp;</TD><TD colspan=2 align=right> Kinderfreibetrag </TD>" + kitab + "</TR>\n");
    tabstring+= ("<TR bgColor=#C0C0C0><TD NoWrap><b>" + tit  + wh + " </TD><TD><b>StK</TD><TD align=center><b> Steuer </TD>" + kitabstr + "</TR>\n");

    for(i = aw; i<ende; i+=schritt){               //Tabellenbereich
      zve=i;

     freibetraege=0

         stzahl = 1;
      for (n=1;n<7;n++) {
        if (stklass[n] ==1)
          stzahl+=1;
       }

      zve=Math.floor(zve/teiler[j])*teiler[j];
      zvewert=Math.round((zve-tabkorr)*euro*100/ze)/100 + tabkorr1;
      if (j==1)
       zvewert=Math.round(zvewert*100)/100;

      if(zr != 3)
        zvewert = punkt(zvewert);
       else
        zvewert = tausender(zvewert);

tabstring+= ("<TR><TD valign=top rowSpan=" + stzahl + ">" + zvewert  + dis + "</TD></TR>");

      if (j>3 && schritt==36) zve=zve+(schritt-0.01);

      for (n=1;n<7;n++) {
        if(stklass[n] ==1) {
          stkl=n;
          KiZahl=0;
          tabstring+= ("<TR onmouseover=\"JavaScript:style.fontWeight='bold'\" onmouseout=\"JavaScript:style.fontWeight='normal'\"><TD align=center>" +  klass[n] + " </TD>");
          dz+=1;
          zveret=zve;
          Calc()
          zve=zveret;
  if(steuer != 0) {
       if(zr != 3)
         steuer = punkt(steuer);
       else
         steuer = tausender(steuer);

         tabstring+= ("<TD align=right NoWrap>" + steuer  + dis + "</TD><TD align=right NoWrap> " +  dis + soli +  " &nbsp; </TD><TD align=right NoWrap><font color=#0000FF>" + kisteuer + " &nbsp; </TD>");
          for(m=2;m<10;m++){
          if (stkl<5) {
           if(kiklass[m] !=0) {
            KiZahl=kiklass[m];
            zveret=zve;
            Calc()
            zve=zveret;

            tabstring+= ("<TD align=right NoWrap>" + dis + soli +  " &nbsp; </TD><TD align=right NoWrap><font color=#0000FF> " +  kisteuer + " &nbsp; </TD>");
              }
            }
        else {
           if(kiklass[m] !=0)
           tabstring+= ("<TD align=center> - </TD><TD align=center> - </TD>");
          }
         }
          tabstring+= ("</TR>\n");
        }
      else
       tabstring+= ("<TD colspan=3 align=center> - steuerfrei - </TD>" + steufreistr + "</TR>");
    }
   }

     if (dz>=um)  {  //Wert, bei dem n&auml;chste Seite anf&auml;ngt
       if (i>=ende-schritt)
           break;
       dz=0;
       tabstring+= ("</TABLE></TD><TD valign=top align=center>");
       tabstring+= ("<table bgColor=#F0F0F0 border=0 cellpadding=1 cellspacing=0>")
       tabstring+= ("<TR><TD>&nbsp;</TD><TD colspan=2 align=right> Kinderfreibetrag </TD>" + kitab + "</TR>\n");
    tabstring+= ("<TR bgColor=#C0C0C0><TD NoWrap><b>" + tit  + wh + " </TD><TD><b>StK</TD><TD align=center><b> Steuer </TD>" + kitabstr + "</TR>\n");
    }
   }
   tabstring+= ("</table></TD></TR></TABLE>");
   if(navigator.appName == "Microsoft Internet Explorer")
    tabstring+=("<h5 style='page-break-before:always'></h5>");
   else
    tabstring = tabstring+zusatz;
   win.document.write(tabstring);
   Text=Text+tabstring
   tabstring="";
   aw=(seite*zeile*schritt*teil)+start;

   dz=0;
   if(!isNS) {
   if(seitzahl>1){
     for (zei=1;zei<280/seitzahl;zei++){
     s=s+"I"
     }
     wintab.focus()
     wintab.document.forms[0].elements[0].value=s;

    }
   }
  }
  win.document.write("</body></html>");
  win.document.close();
  wintab.close()
  Text=Text+"</body></html>";

  if(navigator.appName == "Microsoft Internet Explorer"){
   if (document.datei.erstellen.checked){
      win.close()
      DateiErstellen(Text)
   }
  }
 }
}

//------------------------------------------------------------

    function punkt(wert) {
         wert+="";
         if(wert.indexOf(".") == -1) wert+=".00";
         if (wert.length - wert.indexOf(".") == 2) wert+="0";
         wert = wert.slice(0,wert.length-3) + "," + wert.slice(wert.length-2,wert.length);
         if(wert.length > 5 && wert.length < 10 && wert.length-6 > 0)
          wert = wert.slice(0,wert.length-6) + "." + wert.slice(wert.length-6,wert.length);
         return wert;
    }

    function tausender(wert) {
         wert+="";
         if(wert.length/3 > 1)
          wert = wert.slice(0,wert.length-3) + "." + wert.slice(wert.length-3,wert.length);
         if(wert.length/7 > 1)
          wert = wert.slice(0,wert.length-7) + "." + wert.slice(wert.length-7,wert.length);
         return wert;
   }
// --------------------Steuerberechnung ----------------------
   function Calc() {
     zvesoz = zve
     zve=(Math.floor((zve-freibetraege)/teiler[j])*teiler[j]);
     Split = (stkl==3 ? 2  : 1);
     VorsorgAbzug();
     vx= Math.floor((fzve-vspausch)/(Split*teiler[j]))*teiler[j];
     x = vx + adder[j];
     if (stkl<5) {                                // Berechnung StKl I bis IV
       EkSt()
       solisteuer = result*Split*euro;
       steuer=Math.floor(100*solisteuer/ze)/100;
     if (KiZahl>0) {
        x = Math.floor((fzve-vspausch-KiAbzug*Split)/(Split*teiler[j]))*teiler[j]+adder[j];
       EkSt()
       solisteuer = result*Split*euro;
     }
    }
    else {                                        // Berechnung StKl V und VI
    if(j<3)
      x= vx-adder[j];

     st6betrag=x;
     if(x>st6deckel[j]) {
      st6x = st6deckel[j];
      steuer6()
    }
     else {
      st6x = st6betrag;
      steuer6()
     }

    reichenst6=0;
    if(j>7)
     reichenst6 = Math.max(0,st6betrag-reichenmaxst6[j]);   // Reichensteuer bei StKl 5+6
    if(reichenst6 > 0 && j>7)
       st6betrag=reichenmaxst6[j];

    fac = Math.max((st6betrag  * yzahl[j]/10000 ), st6diff + Math.max(0, (st6betrag  - st6deckel[j]) * x1[j]));

    st6x=st6grenz[j];
    steuer6()
    st6 = Math.min(fac, st6diff + Math.max(0,(st6betrag - st6grenz[j]) * x1[j]));
    st6 = Math.floor(st6);
    st6 = Math.floor(st6 + Math.floor(reichenst6*0.45));

    solisteuer= st6*euro;
    steuer=Math.floor(100*solisteuer/ze)/100;
    if (steuer < ((anfsteuer[j]-1)*euro/ze))
     steuer=0;
    }
    soli = Math.max((Math.min(0.055 * solisteuer,(solisteuer-(solibas*Split*euro))* 0.2)),0);
    soli = Math.floor(Math.round(soli*10000/ze )/100)/100;

         kisteuer=Math.floor(Math.round(solisteuer*kist*100/ze)/100)/100;
         soli = punkt(soli);
         kisteuer = punkt(kisteuer);

        if(stkl==2 && KiZahl==0){soli=" - ";kisteuer= " - ";}  // StKl II nur mit Kind(er)
 }
    function steuer6() {
          x=st6x*1.25;
          EkSt();
         st1=result;
          x=st6x*0.75;
          EkSt()
         st2=result;
    st6diff= 2*(st1-st2);


 }
    function EkSt() {
     z = (x-ztausx[j])/10000;
     y = (x-ztausy[j])/10000;
    c9 = (x > anfst[j] && x < midst[j]+1) ? Math.floor((y1[j]*y+yzahl[j])*y) : 0;
    c10 = (x > midst[j] && x < endst[j]+1) ? Math.floor((z1[j]*z+zzahl1[j])*z+zzahl2[j]) : c9;
    result = x > endst[j] ? Math.floor(x1[j] * x - xzahl[j]) : c10;

     // ---------"Reichensteuer" ab 2007 --------------------

    if(j>7 && x > reichenmax[j])
       result = Math.floor(x * 0.45 - reichensub[j])

  // ----------------------------------------------------

    }

   function VorsorgAbzug() {
   if (stkl<5) {
    vsf=new Array(6000, 2610, 1305, 2214); //DM
    if (j>2)
       vsf=new Array(3068, 1334, 667, 1134); //EURO (Glättungsgesetz)
    if(j != 1 && j < 4) {
    aufbas = (Math.floor(zve/teiler[j])*teiler[j])+teilervor[j];
    }
   else
    aufbas=zve;
    aufw=0.2*aufbas;
    if (document.eingabe.tabelle[0].selected)  {
    vspau1= Math.max(0,Split*vsf[0]-(0.16*aufbas));
    vspau2= Math.min(Split*vsf[1],aufw-vspau1);
    vspau3= Math.min(Split*vsf[2],(aufw-vspau1-vspau2)/2);
    vspau4= Math.min(aufw,vspau1+vspau2+vspau3);
   }
  else
   vspau4= Math.min(aufw,vsf[3]*Split);

   vspausch = Math.floor(vspau4);

   if(j<8)
     vspausch = Math.ceil(vspau4);
   if (j<6)
    vspausch = Math.floor(vspau4/teiler[j])*teiler[j];
  }
  else
   vspausch = 0;
     // ------------------- neu ab 2005 -----------------------------------------------
   if (j>5 && vspausch>0) {   //Berücksichtigung des Alterseinkünftegesetzes

      gekvor = 1500*Split;
      gekvspausch = (zve*0.11<gekvor ? zve*0.11 : gekvor);
      sozberech()
      rente=1.95;
      if(j>7) rente=1.99;
      rentanteil = Math.floor(bemesrv*(rente*(1+(j-6)*0.2)))/100;
      if (typ=="Besondere ") rentanteil=0
      if(Math.floor(rentanteil+gekvspausch) >= vspausch)  //Günstigerprüfung
        vspausch=Math.ceil(rentanteil+gekvspausch);

      zl=zl+1
 }
     else {
     gekvspausch=0;rentanteil=0;vspau4=0;
     }
// --------------------------------------------------------------------------

  if(j<3){
  pausch = new Array( 2108, 7724, 2216, 2108, 2000, 2); // DM
  if (j>1 ) {
    pausch[5]=0;
    pausch[4]=1998;
   }  KiAbzug = (stkl<4 ? KiZahl*6912/Split : KiZahl*3456); }
  else {
  pausch= new Array(1080, 3420,1116, 1080, 1044,0);  //EURO (Glättungsgesetz)
  if(j>4) pausch = new Array(956, 2264, 992, 956, 920, 0);
   KiAbzug = (stkl<4 ? KiZahl*5808/Split : KiZahl*2904);
  if(j>9) KiAbzug = (stkl<4 ? KiZahl*6024/Split : KiZahl*3012);
  }
  if(stkl>4)
   KiAbzug=0;

  if(j>1 && stkl<5)
    zve=Math.floor(zve/teiler[j])*teiler[j];

  fzve = Math.max(0,zve-pausch[stkl-1]);

 }
 function sozberech() {
     if(document.eingabe.tabelle[0].selected==false) zvesoz=0;

     bemesrv= Math.min(rvgrenzw[j-6],zve);
 }
// Ende-->
