<!--Script Documentation
/*******************************************************************
* Author      : Josh Moody                                         *
* Date Written: June, 2002                                         *
* Home Page   : http://users.conwaycorp.net/jmoody                 *
* Email       : jmoody@conwaycorp.net                              *
* Notice      :                                                    *
*   This script was written by Josh Moody. It seems to me that the *
*   primary purpose of the internet to to share thoughts and ideas *
*   with people around the world.  In that spirit, feel free to    *
*   use any of my scripts, but please observe the following        *
*   request: Leave this documentation intact at the top of the     *
*   script. I did the work, so I believe I deserve the credit.     *
*   That's not too much to ask, is it?                             *
*******************************************************************/
//End of Documentation-->

<!-- Begin How Old

function findDaysOfMonth()
{
  //Find number of days in each month
  var i = 0;
  this[i++] = 0;  //Initialize
  this[i++] = 31; //January
  this[i++] = 29; //February
  this[i++] = 31; //March
  this[i++] = 30; //April
  this[i++] = 31; //May
  this[i++] = 30; //June
  this[i++] = 31; //July
  this[i++] = 31; //August
  this[i++] = 30; //September
  this[i++] = 31; //October
  this[i++] = 30; //November
  this[i  ] = 31; //December
  this.length = i;
}

function howOld(mm,dd,yy)
{
  //DOB
  var monthArray = new findDaysOfMonth();
  var birthYear  = parseInt(yy);		// Year of birth (4 digits)
  var birthMonth = parseInt(mm);		// Month of birth (1-12)
  var birthDate  = parseInt(dd);		// Date of birth (1-31)
  var ageMonths  = 0;				// Age in Months

  //Check for invalid DOB
  //if (monthArray[birthMonth] < birthDate || birthDate < 1) return -1;

  //Current Date
  var newDate    = new Date();			// Get current date
  var thisYear   = newDate.getFullYear();	// Get year of current
  var thisMonth  = newDate.getMonth() + 1;	// Get month of current
  var thisDate   = newDate.getDate();		// Get date of current

  var age = thisYear - birthYear;

  //Had birthday yet?
  if ((thisMonth < birthMonth) || (birthMonth == thisMonth && thisDate < birthDate))
  	age -- ;
  return age;

}
//End Script-->

