function validateForm(form) {

	if (document.forms[0].EmpNumber.selectedIndex == 0) {
      alert('Please choose an Employee ID.');
      return false;
  	}

	if (document.forms[0].date) {
	  var str = document.forms[0].date.value;
	  if (str.length != 8) {alert('Date is incorrect.  Must be in the MM/DD/YY format.'); return false }
	
	  for (j=0; j<str.length; j++) {
	    if ((j == 2) || (j == 5)) {
	      if (str.charAt(j) != "/") {alert('Date is incorrect.  Must be in the MM/DD/YY format.'); return false }
	    } else {
	      if ((str.charAt(j) < "0") || (str.charAt(j) > "9")) {alert('Date is wrong!'); return false }
	    }
	  }
	
	  var month = str.charAt(0) == "0" ? parseInt(str.substring(1,2)) : parseInt(str.substring(0,2));
	  var day = str.charAt(3) == "0" ? parseInt(str.substring(4,5)) : parseInt(str.substring(3,5));
	  var begin = str.charAt(6) == "0" ? (str.charAt(7) == "0" ? (str.charAt(8) == "0" ? 9 : 8) : 7) : 6;
	  var year = parseInt(str.substring(begin, 8));
	
	  if (day == 0) {alert('Date is incorrect.  That date does not exist.  Please enter a new date.'); return false }
	  if (month == 0 || month > 12) {alert('Date is incorrect.  That month does not exist. Please enter a new date.'); return false }
	  if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
	    if (day > 31) {alert('Date is incorrect.  That date does not exist.  Please enter a new date.'); return false }
	  } else {
	    if (month == 4 || month == 6 || month == 9 || month == 11) {
	      if (day > 30) {alert('Date is incorrect.  That date does not exist.  Please enter a new date.'); return false }
	    } else {
	      if (year%4 != 0) {
	        if (day > 28) {alert('Date is incorrect.  That year is not a leap year.  Please enter a new date.'); return false }
	      } else {
	        if (day > 29) { alert('Date is incorrect.  That date does not exist.  Please enter a new date.'); return false }
	      }
	    }
	  }
	} // End Date Check
	
   	if (form.activity_item.selectedIndex == 0) {
      alert('Please choose an activity item from the list.');
      return false;
  	}
	
   	if (form.cjb_select.selectedIndex == 0) {
      alert('Please choose either Job or Administrative as the type.');
      return false;
  	}

   	if (form.cjb_select.selectedIndex == 1 && form.job_id.selectedIndex == 0) {
      alert('You have chosen job, but not a Job ID. Please select a Job ID.');
      return false;
  	}

	if (form.job_id.selectedIndex != 0 && form.ticket_description.value == "") {
		alert('You have a Job ID selected.  Please enter a ticket description.'); return false
	}

    if (document.forms[0].man_time.checked){
		if (document.forms[0].start_time) {
		  var str = document.forms[0].start_time.value;
		  var l = str.length;
		  if ((l != 5)) {alert('Start time is incorrect.  Must be in the HH:MM format.'); return false 
		  } else {
		  if (str.charAt(0) > "1")  {alert('Start time is incorrect.  Cannot exceed 12:59.');return false}
		  if (str.charAt(0) == "1" && str.charAt(1) > "2")  {alert('Start time is incorrect.  Cannot exceed 12:59.');return false}
		  if (str.charAt(2) != ":") {alert('Start time is incorrect.  Must be in the HH:MM format.');return false}
		  if (str.charAt(3) > "5")  {alert('Start time is incorrect.  Cannot exceed 12:59.');return false}
			}
		}
		if (document.forms[0].end_time) {
		  var str = document.forms[0].end_time.value
		  var l = str.length;
		  if ((l != 5)) { alert('End time is incorrect.  Must be in the HH:MM format.'); return false 
		  } else {
		  if (str.charAt(0) > "2")  {alert('End time is incorrect. Cannot exceed 23:59.'); return false}
		  if (str.charAt(0) == "2" && str.charAt(1) > "3")  {alert('End time is incorrect. Cannot exceed 23:59.'); return false}
		  if (str.charAt(2) != ":") {alert('End time is incorrect. Must be in the HH:MM format.'); return false}
		  if (str.charAt(3) > "5")  {alert('End time is incorrect. Cannot exceed 23:59.'); return false}
		  }
		}
	} // End Manual Time Check 
	else if (document.forms[0].dur_time.checked) {
		if (document.forms[0].duration) {
		  var str = document.forms[0].duration.value
		  var l = str.length;
		  if ((l != 5)) { alert('Duration is incorrect.  Must be in the HH:MM format.'); return false 
		  } else {
		  if (str.charAt(0) > "2")  {alert('Duration is incorrect. Cannot exceed 23:59.'); return false}
		  if (str.charAt(0) == "2" && str.charAt(1) > "3")  {alert('Duration is incorrect. Cannot exceed 23:59.'); return false}
		  if (str.charAt(2) != ":") {alert('Duration is incorrect. Must be in the HH:MM format.'); return false}
		  if (str.charAt(3) > "5")  {alert('Duration is incorrect. Cannot exceed 23:59.'); return false}
		  }
		}
	} // End Duration Time Check
	else {
		alert('Please check the either manual time entry or timed duration.'); return false
	}
	
	if (document.forms[0].bill_rate.value == "") {
		alert('Please enter a billing rate.'); return false
	}


}

function validateForm_edit(form) {

	if (document.forms[0].EmpNumber.selectedIndex == 1) {
      alert('Please choose an Employee ID.');
      return false;
  	}

	if (document.forms[0].date) {
	  var str = document.forms[0].date.value;
	  if (str.length != 8) {alert('Date is incorrect.  Must be in the MM/DD/YY format.'); return false }
	
	  for (j=0; j<str.length; j++) {
	    if ((j == 2) || (j == 5)) {
	      if (str.charAt(j) != "/") {alert('Date is incorrect.  Must be in the MM/DD/YY format.'); return false }
	    } else {
	      if ((str.charAt(j) < "0") || (str.charAt(j) > "9")) {alert('Date is wrong!'); return false }
	    }
	  }
	
	  var month = str.charAt(0) == "0" ? parseInt(str.substring(1,2)) : parseInt(str.substring(0,2));
	  var day = str.charAt(3) == "0" ? parseInt(str.substring(4,5)) : parseInt(str.substring(3,5));
	  var begin = str.charAt(6) == "0" ? (str.charAt(7) == "0" ? (str.charAt(8) == "0" ? 9 : 8) : 7) : 6;
	  var year = parseInt(str.substring(begin, 8));
	
	  if (day == 0) {alert('Date is incorrect.  That date does not exist.  Please enter a new date.'); return false }
	  if (month == 0 || month > 12) {alert('Date is incorrect.  That month does not exist. Please enter a new date.'); return false }
	  if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
	    if (day > 31) {alert('Date is incorrect.  That date does not exist.  Please enter a new date.'); return false }
	  } else {
	    if (month == 4 || month == 6 || month == 9 || month == 11) {
	      if (day > 30) {alert('Date is incorrect.  That date does not exist.  Please enter a new date.'); return false }
	    } else {
	      if (year%4 != 0) {
	        if (day > 28) {alert('Date is incorrect.  That year is not a leap year.  Please enter a new date.'); return false }
	      } else {
	        if (day > 29) { alert('Date is incorrect.  That date does not exist.  Please enter a new date.'); return false }
	      }
	    }
	  }
	} // End Date Check
	
   	if (form.activity_item.selectedIndex == 1) {
      alert('Please choose an activity item from the list.');
      return false;
  	}
	
   	if (form.cjb_select.selectedIndex == 1) {
      alert('Please choose either Job or Administrative as the type.');
      return false;
  	}

   	if (form.cjb_select.selectedIndex == 2 && form.job_id.selectedIndex == 1) {
      alert('You have chosen job, but not a Job ID. Please select a Job ID.');
      return false;
  	}

	if (form.job_id.selectedIndex != 0 && form.ticket_description.value == "") {
		alert('You have a Job ID selected.  Please enter a ticket description.'); return false
	}

    if (document.forms[0].man_time.checked){
		if (document.forms[0].start_time) {
		  var str = document.forms[0].start_time.value;
		  var l = str.length;
		  if ((l != 5)) {alert('Start time is incorrect.  Must be in the HH:MM format.'); return false 
		  } else {
		  if (str.charAt(0) > "1")  {alert('Start time is incorrect.  Cannot exceed 12:59.');return false}
		  if (str.charAt(0) == "1" && str.charAt(1) > "2")  {alert('Start time is incorrect.  Cannot exceed 12:59.');return false}
		  if (str.charAt(2) != ":") {alert('Start time is incorrect.  Must be in the HH:MM format.');return false}
		  if (str.charAt(3) > "5")  {alert('Start time is incorrect.  Cannot exceed 12:59.');return false}
			}
		}
		if (document.forms[0].end_time) {
		  var str = document.forms[0].end_time.value
		  var l = str.length;
		  if ((l != 5)) { alert('End time is incorrect.  Must be in the HH:MM format.'); return false 
		  } else {
		  if (str.charAt(0) > "2")  {alert('End time is incorrect. Cannot exceed 23:59.'); return false}
		  if (str.charAt(0) == "2" && str.charAt(1) > "3")  {alert('End time is incorrect. Cannot exceed 23:59.'); return false}
		  if (str.charAt(2) != ":") {alert('End time is incorrect. Must be in the HH:MM format.'); return false}
		  if (str.charAt(3) > "5")  {alert('End time is incorrect. Cannot exceed 23:59.'); return false}
		  }
		}
	} // End Manual Time Check 
	else if (document.forms[0].dur_time.checked) {
		if (document.forms[0].duration) {
		  var str = document.forms[0].duration.value
		  var l = str.length;
		  if ((l != 5)) { alert('Duration is incorrect.  Must be in the HH:MM format.'); return false 
		  } else {
		  if (str.charAt(0) > "2")  {alert('Duration is incorrect. Cannot exceed 23:59.'); return false}
		  if (str.charAt(0) == "2" && str.charAt(1) > "3")  {alert('Duration is incorrect. Cannot exceed 23:59.'); return false}
		  if (str.charAt(2) != ":") {alert('Duration is incorrect. Must be in the HH:MM format.'); return false}
		  if (str.charAt(3) > "5")  {alert('Duration is incorrect. Cannot exceed 23:59.'); return false}
		  }
		}
	} // End Duration Time Check
	else {
		alert('Please check the either manual time entry or timed duration.'); return false
	}
	
	if (document.forms[0].bill_rate.value == "") {
		alert('Please enter a billing rate.'); return false
	}


}

// -->
