function daysInMonth(iYear, iMonth) { return 32 - new Date(iYear, iMonth, 32).getDate(); }

function resetTheDays(yearID, monthID, dayID){
	number_of_days_it_should_be = daysInMonth( yearID.value, (monthID.value-1) );
	
	beforeDayValue = dayID.value;
	dayID.length = 0;
	
	dayID.options[dayID.options.length] = new Option("Day", "0");
	dayID.options[dayID.options.length] = new Option("-------", "0");

	for (var x = 1; x <= number_of_days_it_should_be; x++) {
		t_day = x;
		if (x < 10) { t_day = "0"+t_day; }
		the_option_item = dayID.options.length;
		dayID.options[the_option_item] = new Option(t_day, t_day);
		dayID.options[the_option_item].selected = false;
		if (beforeDayValue == t_day ) { dayID.options[the_option_item].selected = true; } 
   	}
}




