<!DOCTYPE html>
<html lang="en">
  <head>
    <% include ../partials/header %>
  </head>

<!-- Homepage -->

  <body>
    <div class="container-fluid">
      <div class="jumbotron text-center">
        <h1>Safe Routes</h1> 
        <p>The best way to find the safest routes.</p> 
      </div>

      <!--What are for and type for?-->
      <!-- current submit button takes you to the landing page -->
      <form action="/landing">
      <!-- First text field and label above the text field for current location -->
        <div class="form-group text-center">
          <label for="currentLocation">From</label>
          <input type="currentLocation" class="form-control" id="origin" placeholder="Enter Current Location" onchange="saveFrom()">
        </div>
        <!-- Second text field and label above the text field for destination -->
        <div class="form-group text-center">
          <label for="destination">To</label>
          <input type="destination" class="form-control" id="dest" placeholder="Enter Destination" onchange="saveTo()">
        </div>
        <!-- First travel option button, walking 
              This contains a row that holds buttons of type button. Buttons are highlighted upon selection. 
        -->
        <div class="row">
          <button type="button" class="btn-default img-thumbnail col-xs-4" onclick="walk();">
            <img class="img-responsive" src="images/pedestrian-walking.svg" alt="Walking Option" width="40" height="40">
          </button>

          <!-- Second travel button, driving -->
          <button type="button" class="btn-default img-thumbnail col-xs-4" onclick="drive();">
            <img class="img-responsive" src="images/car-compact.svg" alt="Walking Option" width="40" height="40">
          </button>

          <!-- Third travel button, bus -->
          <button type="button" class="btn-default img-thumbnail col-xs-4" onclick="bus();">
            <img class="img-responsive" src="images/bus.svg" alt="Walking Option" width="40" height="40">
          </button>
        </div>

        <div class="text-center">
          <button type="submit" class="btn btn-primary btn-space">Go</button>
        </div>
      </form>
    </div>

    <!-- Google Map functionality. -->    
    <script>
      function saveFrom() {
        var fromInput = document.getElementById("origin").value;
        localStorage.setItem("from", fromInput);  
      }
      function saveTo() {
        var toInput = document.getElementById("dest").value;
        localStorage.setItem("to", toInput);  
      }
      function walk() {
        localStorage.setItem("mode", "WALKING");  
      }
      function drive() {
        localStorage.setItem("mode", "DRIVING");  
      }
      function bus() {
        localStorage.setItem("mode", "TRANSIT");  
      }
    </script>

  </body>
</html>