A bit of cleanup in JavaScript, removed repeated var declarations.
[timetracker.git] / WEB-INF / templates / time_edit.tpl
index a4e26a6..863cdb1 100644 (file)
@@ -145,37 +145,38 @@ function fillTaskDropdown(id) {
 function formDisable(formField) {
   var formFieldValue = eval("document.timeRecordForm." + formField + ".value");
   var formFieldName = eval("document.timeRecordForm." + formField + ".name");
+  var x;
 
   if (((formFieldValue != "") && (formFieldName == "start")) || ((formFieldValue != "") && (formFieldName == "finish"))) {
-    var x = eval("document.timeRecordForm.duration");
+    x = eval("document.timeRecordForm.duration");
     x.value = "";
     x.disabled = true;
     x.style.background = "#e9e9e9";
   }
 
   if (((formFieldValue == "") && (formFieldName == "start") && (document.timeRecordForm.finish.value == "")) || ((formFieldValue == "") && (formFieldName == "finish") && (document.timeRecordForm.start.value == ""))) {
-    var x = eval("document.timeRecordForm.duration");
+    x = eval("document.timeRecordForm.duration");
     x.value = "";
     x.disabled = false;
     x.style.background = "white";
   }
 
   if ((formFieldValue != "") && (formFieldName == "duration")) {
-    var x = eval("document.timeRecordForm.start");
+    x = eval("document.timeRecordForm.start");
     x.value = "";
     x.disabled = true;
     x.style.background = "#e9e9e9";
-    var x = eval("document.timeRecordForm.finish");
+    x = eval("document.timeRecordForm.finish");
     x.value = "";
     x.disabled = true;
     x.style.background = "#e9e9e9";
   }
 
   if ((formFieldValue == "") && (formFieldName == "duration")) {
-    var x = eval("document.timeRecordForm.start");
+    x = eval("document.timeRecordForm.start");
     x.disabled = false;
     x.style.background = "white";
-    var x = eval("document.timeRecordForm.finish");
+    x = eval("document.timeRecordForm.finish");
     x.disabled = false;
     x.style.background = "white";
   }
@@ -186,7 +187,7 @@ function setNow(formField) {
   var x = eval("document.timeRecordForm.start");
   x.disabled = false;
   x.style.background = "white";
-  var x = eval("document.timeRecordForm.finish");
+  x = eval("document.timeRecordForm.finish");
   x.disabled = false;
   x.style.background = "white";
   var today = new Date();