//Calculate persons age in years
function getyearsold(birthday, birthmonth, birthyear)
{      
var currentdate = new Date();
var birthdate = new Date;
birthdate.setYear(birthyear);
birthdate.setMonth(birthmonth - 1);
birthdate.setDate(birthday); 
birthdate.setHours(0);
birthdate.setMinutes(0);
birthdate.setSeconds(0);    
        
//See how old in years
if (birthdate.getYear() < 2000) // Allow for born before or after 2000
       	{
       		var yearsold = currentdate.getYear() - (1900 + birthdate.getYear());
       	}
else
       	{
       		var yearsold = currentdate.getYear() - birthdate.getYear();
       	}
        	                         
//Check if coming up to Birthday in year
if (birthdate.getMonth() > currentdate.getMonth() || (birthdate.getMonth() == currentdate.getMonth() && birthdate.getDate() > currentdate.getDate()))
      	{
       		yearsold = yearsold - 1;
       	}            
       	
document.write (yearsold)
}
