/*birthday.js: Rechnet das Alter des Autors aus.
    Copyright (C) 2002  Andy Steinhauf

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*/

function getAge(bday,bmonth,byear,refyear,remind)
{
var cday, cmonth, cyear, age, geb
email="steini@genion.de"
heute=new Date()
  cday=heute.getDate()
  cmonth=heute.getMonth()
  cyear=heute.getFullYear()
  cmonth=cmonth+1
if (cyear > refyear || cyear == refyear)
 {
   if (cmonth > bmonth)
    {
     age = cyear - byear
    }
   if (cmonth < bmonth)
    {
     age = cyear - byear - 1
    }
   if (cmonth == bmonth && cday < bday)
    {
     age = cyear - byear -1
    }
   if (cmonth == bmonth && cday > bday)
    {
     age = cyear - byear
    }
   if (cmonth==bmonth && cday==bday)
    {
     age=cyear-byear
     geb=1
     }
 document.write (age)
    if (remind == 1 && geb==1)
       {
         mail = confirm ("Hey ! Ich bin heute " + age + " Jahre alt geworden !\nMöchtest Du mir eine Glückwunsch-Mail schicken ?? :-))")
         if (mail == true)
         {
         location.href="mailto:"+email+"?subject=Happy Birthday"
         }
         else
         {
          alert ("Dann eben nicht ! :-( \nWerd ich mir merken ! ")
         }
       }
     }
else
 {
alert ("Das Systemdatum ist nicht korrekt. Mein aktuelles Alter kann nicht berechnet werden.")
 document.write ("???")
}
}

