// JavaScript Document
function CountdownBirthday(year, month, day) {
	var now = new Date();
  	var today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
	var thisYear = now.getFullYear();
	var thisBirthDay = new Date(thisYear, month-1, day);
	var theYear = thisYear;
	if(thisBirthDay < today) theYear = thisYear+1;
	var myAge = theYear - year;
	var theDay = new Date(theYear, month-1, day);
	var timeToGo = theDay - today;
	var daysToGo = ((timeToGo >= 0) ? Math.ceil(timeToGo/86400000) : "");
	if(daysToGo == 0) {
		var msg = "<font color=red>" + myAge + "歳の誕生日です！</font>";
	} else if(daysToGo <= 31){
		var msg = myAge + "歳まであと" + daysToGo + "日";
	} else {
		var oldAge = myAge -1;
		var msg = oldAge + "歳になりました";
	}
	document.write(msg);
}
