$(document).ready(function(){

  findUser();

  $('#address_submit').on('click', function(event){
    // event.preventDefault();
    findAddress();
  })
});


function findUser() {
  if (navigator.geolocation){

    function success(position) {
      var latitude  = position.coords.latitude;
      var longitude = position.coords.longitude;
      var data = {latitude: latitude, longitude: longitude};

      updatePage(data, 'Your Current Location')
    };
    navigator.geolocation.getCurrentPosition(success);
  }
}

function findAddress(){
  var data;
  var address = $('#address').val();
  $('#address').val('')
  var geocoder = new google.maps.Geocoder();
  geocoder.geocode({'address': address + 'chicago'}, function(results, status){
    var lat = results[0].geometry.location.k;
    var lng = results[0].geometry.location.B;
    data = {latitude: lat, longitude: lng};
    updatePage(data, address);
  });
}

function updatePage(data, location) {
  $.post('/update_surrounding', data, function(response){ 
    $('#active_map').replaceWith(response)
    // render new map at the bottom of the page? put it on the page in the right place
  });

  $.post('/current_position', data, function(response){ 
    $('.copy p:first-child').html('Next Street Cleaning<br>For ' + location + ' Is:<br>' + response.next_sweep);
    var days = response.sweep_days;
    str = "<h3>Street Cleaning Days</h3><ul>";
    for (var i=0; i<days.length; i++) {
      str += '<li>' + days[i] + '</li>';
    }
    $('.cleaning_col').html(str + '</ul>');
      // replace this response with something that renders new map on top of old map
  }, 'JSON');
}
@@ -95,39 +95,8 @@
 t)%7B%0A
-    // event.preventDefault();%0A
     
@@ -173,17 +173,16 @@
 ation)%7B%0A
-%0A
     func
@@ -1024,95 +1024,8 @@
 se)%0A
-    // render new map at the bottom of the page? put it on the page in the right place%0A
   %7D)
@@ -1415,93 +1415,8 @@
 ');%0A
-      // replace this response with something that renders new map on top of old map%0A
   %7D,

remove comments