// JavaScript Document

function setDay(obj){
	obj = obj.form;
	var years = parseInt(obj.years.options[obj.years.selectedIndex].value);
	var months = parseInt(obj.months.options[obj.months.selectedIndex].value);
	var lastday = monthday(years,months);
	var itemnum = obj.days.length;
	if (lastday - 1 < obj.days.selectedIndex) {
		obj.days.selectedIndex = lastday - 1;
	}
	obj.days.length = lastday;
	for (cnt = itemnum + 1;cnt <= lastday;cnt++) {
		obj.days.options[cnt - 1].text = cnt;
	}
}
function monthday(years,months){
	var lastday = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	if (((years % 4 == 0) && (years % 100 != 0)) || (years % 400 == 0)){
		lastday[1] = 29;
	}
	return lastday[months - 1];
}
