 # Place all the behaviors and hooks related to the matching controller here.
 # All this logic will automatically be available in application.js.
 # You can use CoffeeScript in this file: http://coffeescript.org/
-
-# success = (x, pos) ->
-# 	x.innerHTML = "Latitude: " + pos.coords.latitude
-# 	x.innerHTML += "<br>Longitude: " + pos.coords.longitude
-
-# failure = (x) ->
-# 	x.innerHTML += 'Error'
-
-# write_to_kml = (xml, coord) ->
-#     xmlDoc = xml.responseXML
-#     new_coord =  xmlDoc.getElementsByTagName("coordinates")[0].nodeValue+'\n'+coord
-#     xmlDoc.getElementsByTagName("coordinates")[0].nodeValue += new_coord
-
-# print_kml = (xml) ->
-# 	xmlDoc = xml.responseXML
-# 	document.getElementById("button-area").innerHTML += item.nodeValue for item in xmlDoc.getElementsByTagName("coordinates")
 
 buildmap = (handler,route) ->
 	

  					handler.fitMapToBounds()
  				)
	)
		
	x = 0

	cur_location = navigator.geolocation.watchPosition( 
		(pos) ->
			data =  {hoaroute: {

  		polylines = handler.addPolylines(route, 
  			{strokeColor: "#cc00cc", strokeWeight: 4}
  			)
  		handler.bounds.extendWith(polylines)
  		handler.fitMapToBounds()
  	)


$(document).on('ready ["#route-page"]', ->
