function checkDate(nForm){
	thismonth = document.forms[nForm].elements['month'].value;
	thisyear = document.forms[nForm].elements['year'].value;
	
	montharray=new Array(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	maxdays=montharray[thismonth-1];
	if (thismonth==2) {
		if ((thisyear/4)!=parseInt(thisyear/4) && (thisyear/400)!=parseInt(thisyear/400))
			maxdays=28;
		else
			maxdays=29;
	}

	dd = document.forms[nForm].elements['day'];
	v = dd.options.length;
	
	if ( v>maxdays ){
	
		if ( (dd.options[dd.selectedIndex].value)>maxdays )
			dd.selectedIndex = maxdays-1;
		for (;v>=maxdays;v--) {
			dd.options[v] = null;
		}
	
	}
	else if ( v<maxdays ){
		var ind = dd.selectedIndex;
		for (;v<=maxdays;v++) {
			dd.options[v-1] = new Option(v,v);
		}
		dd.selectedIndex = ind;		
	}
}
