hasStarted = false;              

function setTime(mode) {
	time = new Date();
	millis = time.getTime();
	if(mode == "start") {
		if(hasStarted == false) {
			hasStarted = true;
			document.editForm.s.value = millis;
		}
	}
	else if(mode == "finish") {
		document.editForm.f.value = millis;
		totalMillis = Math.round(document.editForm.f.value) - Math.round(document.editForm.s.value);
		totalMinutes = (totalMillis/1000)/60;
		document.editForm.t.value = decimalizeIt(totalMinutes,2);
	}
}

function decimalizeIt(the_number,desired_accuracy) {
	the_number = the_number + '';

	if(the_number.search(/\./) != -1) {
		var actual_length = the_number.length;
		var the_dec_point = the_number.search(/\./);
		var actual_accuracy = actual_length - (the_dec_point+1);
		var zeros_to_add = desired_accuracy - actual_accuracy;
			
		if(zeros_to_add > 0) {
			for(x=0;x<zeros_to_add;x++) {
				the_number = the_number + '' + '0';
			}
		}
		else if(zeros_to_add < 0) {
			desired_remaining = actual_length - actual_accuracy + desired_accuracy;
			the_number = the_number.substring(0,(desired_remaining));
		}	

	}
	else {
		the_number = the_number + '.';
		for(x=0;x<desired_accuracy;x++) {
			the_number = the_number + '' + '0';
		}
	}
			
	return(the_number);
}
