	function Reset_onclick() {
	window.document.location.href = "../calculater.aspx"
	}

	function numcheck(theField){
		// Purpose: to validate numerical form fields
		var data = theField.value
		for (var i=0; i < data.length; i++){
			var digit = data.charAt(i)
			if ((digit < "0" || digit > "9") && digit != "."){
				if (digit == ","){
					alert("Leave out commas.")
					theField.value = "";
				} else {
					alert(digit + " is not a number.")
					theField.value = "";
				}
			}
		}
	}

	function validateForm(theForm) {
	  var total = 0
	  // Purpose: to validate the form before submission
	  if (theForm.txtNumTechs.value == "") {
		alert("Please enter number of technicians.")
	    return false;
	  }
	  
	  if (theForm.txtBillRate.value == "") {
		theForm.txtBillRate.value = 0;
	  }
	  
	  for(var i = 0; i < 4 ; i++){
		if(theForm.txtPct[i].value.length == 0){
			theForm.txtPct[i].value = "0"
		}
		total = total + parseInt(theForm.txtPct[i].value)
	  }
		
	  if (total != 100){
		var remainder = Math.abs(100 - total)
		var strOverUnder = "under"
		
		if (remainder < 0){
			strOverUnder = "over"
		}
			
		alert("ERROR: Technician's time must equal 100%\nYou are " + strOverUnder + " by " + remainder + "%")
		return false;
	  }
	  return true;
	}

	function calc_last(theForm){
		var t = 0
		var total = 0
		// Purpose: to fill in 4th "Technician's time" field with remaining %age of time
		for(var i = 0; i < 4 ; i++){
			if (parseInt(theForm.txtPct[i].value) > 0 ){
				t = t + 1
				total = total + parseInt(theForm.txtPct[i].value)
			}
		}
		if ((t==3) && (total < 100)){
			for(i = 0; i < 4; i++){
				if (theForm.txtPct[i].value < 1){
					theForm.txtPct[i].value = 100 - total;
				}
			}
		}		
	}
