//General Array Function
function MakeArray(n) {
   this.length = n;
   for (var i = 1; i <=n; i++) {
     this[i] = 0;
   }
}

//Initialize Days of Week Array
days = new MakeArray(7);
days[0] = "Samstag"
days[1] = "Sonntag"
days[2] = "Montag"
days[3] = "Dienstag"
days[4] = "Mittwoch"
days[5] = "Donnerstag"
days[6] = "Freitag"

//Initialize Monate Array
months = new MakeArray(12);
months[1] = "Januar" 
months[2] = "Februar" 
months[3] = "März" 
months[4] = "April" 
months[5] = "Mai" 
months[6] = "Juni" 
months[7] = "Juli" 
months[8] = "August"
months[9] = "September" 
months[10] = "Oktober"
months[11] = "November"
months[12] = "Dezember"

//Initialize Months Array
monthe = new MakeArray(12);
monthe[1] = "January" 
monthe[2] = "February" 
monthe[3] = "March" 
monthe[4] = "April" 
monthe[5] = "May" 
monthe[6] = "June" 
monthe[7] = "July" 
monthe[8] = "August"
monthe[9] = "September" 
monthe[10] = "October"
monthe[11] = "November"
monthe[12] = "December"
//Day of Week Function
function compute(form) {
   var val1 = parseInt(form.day.value, 10)
   if ((val1 < 0) || (val1 > 31)) {
      alert("Kein korrektes Tagesdatum")
   }
   var val2 = parseInt(form.month.value, 10)
   if ((val2 < 0) || (val2 > 12)) {
      alert("Monatszahl ist zu groß")
   }  
   var val2x = parseInt(form.month.value, 10)
   var val3 = parseInt(form.year.value, 10)
   if (val3 < 1900) {
      alert("Na, wenn das stimmt......")
   }
   if (val2 == 1) {
      val2x = 13;
      val3 = val3-1
   }
   if (val2 == 2) {
      val2x = 14;
      val3 = val3-1
   }
   var val4 = parseInt(((val2x+1)*3)/5, 10)
   var val5 = parseInt(val3/4, 10)
   var val6 = parseInt(val3/100, 10)
   var val7 = parseInt(val3/400, 10)
   var val8 = val1+(val2x*2)+val4+val3+val5-val6+val7+2
   var val9 = parseInt(val8/7, 10)
   var val0 = val8-(val9*7)
   

        var toyear = 1997;
        var birthyear = form.year.value;
        var birthpet="Ochse";

        x = (toyear - birthyear) % 12
        if ((x == 1) || (x == -11)) {
            birthpet="Maus"      }
            else  {
             if (x == 0)             {
             birthpet="Ochse"           }
             else  {
              if ((x == 11) || (x == -1)) {
              birthpet="Tiger"          }
              else  {
               if ((x == 10) || (x == -2)) {
               birthpet="Hase"         }
               else  {
                if ((x == 9) || (x == -3))  {
                birthpet="Drache"         }
                else  {
                 if ((x == 8) || (x == -4))  {
                 birthpet="Schlange"          }
                 else  {
                  if ((x == 7) || (x == -5))  {
                  birthpet="Pferd"          }
                  else  {
                   if ((x == 6) || (x == -6))  {
                   birthpet="Schaf"          }
                   else  {
                    if ((x == 5) || (x == -7))  {
                    birthpet="Affe"         }
                    else  {
                     if ((x == 4) || (x == -8))  {
                     birthpet="Hahn"        }
                     else  {
                      if ((x == 3) || (x == -9))  {
                      birthpet="Hund"            }
                      else  {
                       if ((x == 2) || (x == -10))  {
                       birthpet="Schwein"             }
                      }
                     }
                    }
                   }
                  }
                 }
                }
               }
              }
             }
            }
        
         
         var today = new Date();

         var psj=0;      

 

         var birth = new Date(monthe[val2]+" "+form.day.value +", "+form.year.value);

         birth.setYear(today.getYear()); 

         var astrosign="Steinbock"

 

         var birthsecs = birth.getTime()

 

         astro = new Date("January 20,1997");

         astro.setYear(today.getYear());

         if (birthsecs > astro.getTime()) astrosign="Wassermann "

 

         astro = new Date("February 19,1997");

         astro.setYear(today.getYear());

         if (birthsecs > astro.getTime()) astrosign="Fische "

         

         var astro = new Date("March 21,1997");

         astro.setYear(today.getYear());

         if (birthsecs > astro.getTime()) astrosign="Schütze "

 

         astro = new Date("April 20,1997");

         astro.setYear(today.getYear());

         if (birthsecs > astro.getTime()) astrosign="Stier "

 

         astro = new Date("May 21,1997");

         astro.setYear(today.getYear());

         if (birthsecs > astro.getTime()) astrosign="Zwillinge "

 

         astro = new Date("June 22,1997");

         astro.setYear(today.getYear());

         if (birthsecs > astro.getTime()) astrosign="Krebs "

 

         astro = new Date("July 23,1997");

         astro.setYear(today.getYear());

         if (birthsecs > astro.getTime()) astrosign="Löwe "

 

         astro = new Date("August 23,1997");

         astro.setYear(today.getYear());

         if (birthsecs > astro.getTime()) astrosign="Jungfrau "

 

         astro = new Date("September 23,1997");

         astro.setYear(today.getYear());

         if (birthsecs > astro.getTime()) astrosign="Waage "

 

         astro = new Date("October 23,1997");

         astro.setYear(today.getYear());

         if (birthsecs > astro.getTime()) astrosign="Skorpion"

 

         astro = new Date("November 23,1997");

         astro.setYear(today.getYear());

         if (birthsecs > astro.getTime()) astrosign="Widder"

 

         astro = new Date("December 22,1997");

         astro.setYear(today.getYear());

         if (birthsecs > astro.getTime()) astrosign="Steinbock"

 

 
         form.result1.value = form.day.value+" "+ months[val2] +" "+form.year.value
         form.result2.value = days[val0]
         form.astro.value = astrosign
		 form.birth.value = birthpet
      

 } 
function went(form) {
var zeiger = form.birth.value;
open(zeiger+'.html',"_self");
}
