function setFormDate() {
	thisForm = document.forms['DateForm'];
	setDDBox(thisForm.event_date_mn, thisForm.formMonth.value);
	setDDBox(thisForm.event_date_dy, thisForm.formDay.value);
	setDDBox(thisForm.event_date_yr, thisForm.formYear.value);
}
function setDDBox(oDDL, inVal) {
	for(i=0; i<oDDL.length; i++) {
		if(oDDL.options[i].value==inVal) {
			oDDL.selectedIndex=i
		}
	}
}


function daysInMonth(argDate){
	aMonthDays = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	if((argDate.getYear() % 1900)% 4 == 0) aMonthDays[1] = 29;
return aMonthDays[argDate.getMonth()];	 
}

function validateDay(argsThis){
//create a reference to each form object we will need.
	/*--- BEGIN: Block 1 ---
	var form = argsThis.form;
	var dateFld = form[argsThis.id.substring(0,argsThis.id.length-3)];
	var monthFld = document.getElementById('startDate_mn');
	var yearFld = document.getElementById('startDate_yr');
	var dayFld = document.getElementById('startDate_dy');		
	--- END: Block 1 ---*/
	alert('here I am');
	/*--- BEGIN: Block 2 ---*/
	var form = argsThis.form;
	var dateFld = form[argsThis.name.substring(0,argsThis.name.length-3)];
	var monthFld = form[dateFld.name+'_mn'];
	var yearFld = form[dateFld.name+'_yr'];
	var dayFld = form[dateFld.name+'_dy'];
	/*--- END: Block 2 ---*/	
			
//get selected indexes of each date part.
	var monthX = monthFld.options.selectedIndex;
	var yearX = yearFld.options.selectedIndex;
	var dayX = (dayFld.type == 'hidden')? null : dayFld.options.selectedIndex;
	
//get selected values of each date part.
	var monthVal = monthFld.options[monthX].value;
	var yearVal = yearFld.options[yearX].value;
	var dayVal = (dayFld.type == 'hidden')? '/' : '/'+dayFld.options[dayX].value+'/';

//if the day is included lets validate the day field for the current month
	//if(dayX){
		crrntLen = dayFld.options.length;
		maxLen = daysInMonth(new Date(yearVal,monthX,1)); 
	
		if(crrntLen > maxLen){
			//remove extra days
			for (var i=crrntLen; i>maxLen; i--){
				var tmpLen = dayFld.options.length;
				dayFld.options[tmpLen-1] = null;		
			}
			//reset the day index if existing index was removed.
			dayX = (dayX > maxLen-1)? maxLen-1 : dayX;
			dayVal = '/'+dayFld.options[dayX].value+'/';
			dayFld.options[dayX].selected = true;
			
		}else if(crrntLen < maxLen){
			//add additional days
			for (var i=crrntLen; i<maxLen; i++){
				var newOption = new Option(i+1,i+1);
				dayFld.options[i] = newOption;	
			}
		}
	//}

dateFld.value = monthVal+dayVal+yearVal;
}

function  _CF_checkCFForm_1(_CF_this) {
return true;
}
