$(document).ready(function() {
	if (!$("#get_directions_top_wrapper").length) {
		return false;
	}
	console.log("Running directions page JS...");
	
	var toLocation = new GLatLng($("#toLatitude input").val(), $("#toLongitude input").val());
	var fromLocation = new GLatLng($("#fromLatitude input").val(), $("#fromLongitude input").val());
	
	var dirs = new BenefulMap.Directions("#directions_map", "#suggested_route", fromLocation, toLocation, "input.fromAddress", "input.toAddress", ".directions_switch", ".directions_available ul li a", "#directions-headline", "span.button_get_directions");

	var dirsNearbySpots = new BenefulMap.NearbySpotsPane(BenefulMap.Constants.Snippets.PANE_NEARBY_SPOTS, "#nearby-spots-pane", {}, "directions-nearby-spots", fromLocation, jQuery.url.param("id"), "#nearby-spots input:checkbox", "#nearby-spots select");
});
