 $ ->
   map.init()
+  map.get_current_location()
 
 map =
   #параметры карты
   dom: document.getElementById("map-canvas")
+  current_location: new google.maps.LatLng(55.751667, 37.617778)
   options:
-    center: new google.maps.LatLng(55.751667, 37.617778),
+    center: @current_location,
     disableDefaultUI: true,
     zoom: 12
 

    marker = new google.maps.Marker(place_marker_options)

    place_infobox = new InfoBox(infobox_options)
    infobox_content = "<b>" + place.type + ":</b> " + place.name

    google.maps.event.addListener marker, 'mouseover', ->
      place_infobox.setContent(infobox_content)


    google.maps.event.addListener marker, 'mouseout', ->
      place_infobox.close()


  rad:(x) ->
    #перевод в радианы
    x * Math.PI / 180

  get_distance:(place) ->
    cur_loc_lat = map.current_location.lat()
    cur_loc_lng = map.current_location.lng()
    earth_radius = 6371
    place_lat = place.lat
    place_lng = place.lng

    dLat = places.rad(place_lat - cur_loc_lat)
    dLong = places.rad(place_lng - cur_loc_lng)
    a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(places.rad(cur_loc_lat)) * Math.cos(places.rad(cur_loc_lat)) * Math.sin(dLong / 2) * Math.sin(dLong / 2)
    c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
    place.distance = earth_radius * c


infobox_options =
  #параметры отображения окна инфы при ховере поместу
