Index: branches/LCSv2/views/default/submit.html.bak
===================================================================
--- branches/LCSv2/views/default/submit.html.bak	(revision 621)
+++ branches/LCSv2/views/default/submit.html.bak	(revision 622)
@@ -67,4 +67,65 @@
 </script>
 <script>
+/*  Dynamically generate lane closed checkboxes.
+  When user choses "Lane" as the closure type AND "Mainline" as the Facility, 
+  then display checkboxes for which lanes to close.
+*/
+function closuretypechanged() 
+{
+  // Define table of routes and number of lanes for current Scenario
+  const lanedict = {  "5": 5,  "73": 3,  "405": 4,  "55" : 4 };
+  // get references to UI elements
+  var rte = document.getElementById("routecombo");
+  var currentRoute = rte.options[rte.selectedIndex].text;
+  var boxes = document.getElementById("boxes")
+  boxes.textContent = '';
+  var e = document.getElementById("closuretype");
+  var currentType = e.options[e.selectedIndex].text;
+  var facility = document.getElementById("facilitycombo");
+  var currentFacility = facility.options[facility.selectedIndex].text;
+  var x = document.getElementById("lanechooser")
+  // See if the desired choices are selected
+  if (currentType == "Lane" && currentFacility=="Mainline")
+  {
+     // Validate that a route has been chosen
+     if (currentRoute == "")
+     {
+        alert("Must select a route before choosing lanes to close.")
+        e.selectedIndex = 0
+        return;
+      }
+      x.style.display = "block"  // make boxes visible
+      var boxlimit = 4;  // default number of checkboxes for unused routes
+      // Get the total number of lanes from the lookup table
+      if (currentRoute in lanedict)
+      {
+          boxlimit =  lanedict[currentRoute]
+      }
+      // assign limit to hidden field
+      document.getElementById("lanecount").value = boxlimit.toString()
+      // Create a new checkbox for the desired number of total lanes
+      for (boxno = 1; boxno<=boxlimit; boxno++)
+      {
+      var check = document.createElement('input')
+      check.type = 'checkbox';
+      check.name = "lanes"
+      check.id = "lane"+boxno
+      check.value = "#"+boxno.toString()
+      boxes.appendChild(check);
+      var label = document.createElement('label')
+      label.htmlFor = "lane"+boxno;
+        label.appendChild(document.createTextNode(boxno.toString()));
+      boxes.appendChild(label)
+      }
+    }
+  else // hide the checkboxes
+    {
+        x.style.display = "none";
+    }
+ 
+ }
+</script>
+<script>
+// Handle a user click on a radio button for "existing incident"
 function radioclicked()
 {
