Fullers.Views.Directions = Backbone.View.extend({  
  
  el: document.querySelector('body'),
 
  initialize: function(to){ //Where do you want directions to?
    _.bindAll(this, 'render'); // fixes loss of context for 'this' within methods
     this.render(to); // not all views are self-rendering. This one is.
  },

  setup: function(){
    Fullers.hideAll();
    Fullers.Modules.Map.refresh(); //Clears any old maps
    $('#map').show();
    $('#distance_from_location').show();
    Fullers.showLoad();
  },

  render: function(to){
    this.setup();
     Fullers.Modules.Geolocation.getLocation(function(lat, long){
     Fullers.Modules.Map.renderDirections(new google.maps.LatLng(lat,long), to);
     Fullers.hideLoad();
    });
    window.scrollTo(0,75);
  }
});
