//Manuel Villanueva, 2003
function age(birYear, birMonth, birthDay) {

birDate = new Date(birYear, birMonth, birthDay);


ref = new Date();
if(navigator.appName.indexOf("Microsoft") != -1)
refYear = ref.getYear();
else 
refYear = 1900 + ref.getYear();
refMonth = ref.getMonth();
refDate = ref.getDate();

curDate = new Date(refYear, refMonth, refDate);

diffMilliseconds = curDate - birDate;
diffSeconds = diffMilliseconds / 1000;
diffMinutes = diffSeconds / 60;
diffHours = diffMinutes / 60;
diffDays = diffHours / 24;

diffWeeks = Math.floor(diffDays / 7);
diffMonths = Math.floor(diffDays / 30);
diffYears = Math.floor(diffDays / 365);
if (diffMonths <1){
document.write(diffWeeks + " weeks old");
}
else if (diffYears < 1) {
document.write(diffMonths + " months old");
}
else {
document.write(diffYears + " years old");
}
}

