function chkForm ( theForm ) {
		if ( !( chkValidDate( parseInt( theForm.monthone.value ), parseInt( theForm.dayone.value ), parseInt( theForm.yearone.value ) ) ) )
		{
			alert ( "Invalid Start Date, must be of form MM-DD-YYYY or M-DD-YYYY.  Take preceding 'O' out of month if applicable." );
			theForm.monthone.focus();
			return false;
		}
		if ( !( chkValidDate( parseInt( theForm.monthtwo.value ), parseInt( theForm.daytwo.value ), parseInt( theForm.yeartwo.value ) ) ) )
		{
			alert ( "Invalid Due Date, must be of form MM-DD-YYYY or M-DD-YYYY.  Take preceding 'O' out of month if applicable." );
			theForm.monthtwo.focus();
			return false;
		}
		if (  theForm.bedTime.value != "" && (parseInt(theForm.bedTime.value) > 12 || parseInt(theForm.bedTime.value < 1)) )
		{
			alert ( "Invalid Bed Time, must be between 1 and 12" );
			theForm.bedTime.focus();
			return false;
		}
    return true;
}

function chkValidDate ( iMonth, iDay, iYear)
{
	if ( !(iMonth) || !(iDay) || !(iYear) )
	{
		return false;
	} else {
		var iMonthOffset = 2;
		
		switch ( iMonth )
		{
			case 2:
				iMonthOffset = 0;
				break;
			case 4:
			case 6:
			case 9:
			case 11:
				iMonthOffset = 1;
				break;
			case 1:
			case 3:
			case 5:
			case 7:
			case 8:
			case 10:
			case 12:
				iMonthOffset = 2;
				break;
			default:
				iMonthOffset = 2;
		}
		if (iMonth<1 || iMonth>12 || iDay<1 || iDay>29+iMonthOffset || iYear<100)
		{
			return false;
		}
	}
	return true;
}
