+directionsDisplay = {}
+directionsService = {}
+	
 window.main_stuff.init = ->
 	$("#load_scenario").click ->
       xml_text = $("#scenario_text").val()
       xml = $.parseXML(xml_text)
       window.textarea_scenario = window.aurora.Scenario.from_xml($(xml).children())
       window.main_stuff.display()
+	
+	myOptions =
+		center: new google.maps.LatLng(37, -122)
+		zoom: 14
+		mapTypeId: google.maps.MapTypeId.ROADMAP
+		mapTypeControl: false
+		zoomControl: true
+		zoomControlOptions: {
+			style: google.maps.ZoomControlStyle.DEFAULT,
+			position: google.maps.ControlPosition.TOP_LEFT
+		}
+	window.map = new google.maps.Map(document.getElementById("map_canvas"),myOptions)
+	
+	renderer_options =
+		map: window.map
 
-	myOptions =
-    center: new google.maps.LatLng(37, -122)
-    zoom: 14
-    mapTypeId: google.maps.MapTypeId.ROADMAP
-    mapTypeControl: false
-    zoomControl: true
-    zoomControlOptions: {
-      style: google.maps.ZoomControlStyle.DEFAULT,
-	    position: google.maps.ControlPosition.TOP_LEFT
-     }
-   window.map = new google.maps.Map(document.getElementById("map_canvas"),myOptions)
-  
+	directionsDisplay = new google.maps.DirectionsRenderer(renderer_options);
+	directionsService = new google.maps.DirectionsService();
+
 window.main_stuff.display = ->
+	node_markers = {}
 	network = window.textarea_scenario.get('network')
 	window.map.setCenter(new google.maps.LatLng(getLat(network), getLng(network)))
-	drawNodes(network.get('nodelist').get('node'))
+	#drawNodes(network.get('nodelist').get('node'))
 	drawSensors(network.get('sensorlist').get('sensor'))
 	drawLinks(network.get('linklist').get('link'))
   # node.lat = window.textarea_scenario.get('network').get('nodelist').get('node')[0].get('position').get('point')[0].get('lat')

  # marker1 = getMarker(new google.maps.LatLng(node1.lat, node1.lng))
  # getPolyLine(marker,marker1)

drawNodes = (nodes) ->
	for node in nodes 
			getMarker(node,"Node")

drawSensors = (sensors) ->
	for sensor in sensors
			getMarker(sensor,"Sensor")

getLat = (elem) ->
		elem.get('position').get('point')[0].get('lat')

getLng = (elem) ->
		elem.get('position').get('point')[0].get('lng')

drawPolyLine = (marker1, marker2) ->
	new google.maps.Polyline({
	    path: [marker1.getPosition(),marker2.getPosition()],
	    strokeColor: "#240489",
