function update_dates(control_id) {
	m = document.getElementById("module_question_date_m_"+control_id);
	d = document.getElementById("module_question_date_d_"+control_id);
	y = document.getElementById("module_question_date_y_"+control_id);
	if(typeof d.options!="undefined") {	
		if(d.options.length>0)
			currd = d.selectedIndex;
		d.options.length = 0;
		var x = document.createElement("OPTION");
		x.text = "-- Select --";
		x.value = 0;
		d.options[0] = x;
	}
	if(m.selectedIndex>0) {
		v = m.value;
		if(v=="09" || v=="04" || v=="06" || v=="11") {
			maxd=30;
		} else if(v=="02") {
			if(y.value.length==4) {
				if(y.value%4==0) {
					maxd=29;
				} else {
					maxd=28;
				}
			} else {
				maxd=29;
			}

		} else {
			maxd=31;
		}
		el = 1;
		if(typeof d.options!="undefined") {	
			for(i=1;i<=maxd;i++) {
				s = i.toString();
				if(s.length==1) s="0"+s;
				var x = document.createElement("OPTION");
				x.text = s;
				x.value = s;
				d.options[el++] = x;
			}
			if(currd<d.options.length) {
				d.selectedIndex = currd;
			} else if(currd>0) {
				d.selectedIndex = d.options.length-1;
			}
		}
	}
	update_years(control_id)
}