function dateChanged(day, month, year) {

	var dayAmount = 31;

	if(month.selectedIndex == 4 || month.selectedIndex == 6 || month.selectedIndex == 9 || month.selectedIndex == 11) {
		dayAmount = 30;	
	} else if(month.selectedIndex == 2) {
		dayAmount = year.selectedIndex != 0 && year.selectedIndex % 4 != 1 ? 28 : 29;	
	}

	while(day.length - 1 > dayAmount) {
		day.remove(day.length - 1);
	}

	for(var i = day.length; i <= dayAmount; i++) {

		var option = document.createElement('option');

		option.value = i;
		option.text = i;

		try {
			day.add(option, null);	// Standards compliant but doesn't work in IE
		} catch(ex) {
			day.add(option);		// IE only
		}
	}
}

