           @longitude
         ]
         options:
-          draggable: true
+          draggable: options.draggable or false
 
         events:
           dragend: (marker) ->
-            $(this).gmap3 getaddress:
-              latLng: marker.getPosition()
-              callback: (results) ->
-                map = $(this).gmap3("get")
-                infowindow = $(this).gmap3(get: "infowindow")
-
-                $.each results[0].address_components, (x, y) ->
-                  $.each this, (name, value) ->
-                    if value[0] is "route"
-                      address = y.long_name
-                      $("#event_address, #event_place_attributes_address, #address").val address
-
-                    else if value[0] is "street_number"
-                      @number = y.long_name
-                      $("#number, #place-number").val @number
-
-                    else if value[0] is "neighborhood"
-                      @neighborhood = y.long_name
-                      $("#neighborhood, #neighborhood-place, #neighborhood-name").val @neighborhood
-                    return
-
-                  return
-
-                content = (if results and results[0] then "Endereço encontrado!" else "Endereço não encontrado")
-
-                if infowindow
-                  infowindow.open map, marker
-                  infowindow.setContent content
-                else
-                  $(this).gmap3 infowindow:
-                    anchor: marker
-                    options:
-                      content: content
-
-                map = $(this).gmap3("get")
-                latLng = results[0].geometry.location
-                map.panTo latLng
-
-                return
-
+            Gmaps.getAddressOfMarker(this, marker)
             return
     return
 
 
-  @getLocationFrom: (address) ->
-    $("#map, #single-map, #place-map").gmap3
+  @getLocationFrom: (address, options) ->
+    $("#map").gmap3
       clear:
         name: "marker"
 

        clearTimeout timer
        timer = setTimeout(callback, ms)
        return
      )()

    return


  showMapCanvasIfHidden: ->
    if $('#map').css('display') is 'none'
      $('#map').show()

    return







  @showMapCanvasIfHidden: ->
    if $('#map').css('display') is 'none'
      $('#map').show()

    return



  @setCanvasSize: (width, height) ->
    if width is undefined  and height is undefined
      $('#map').width('100%').height(350)
    else if width is undefined
      $('#map').width('100%').height(height)
    else if height is undefined
      $('#map').width(width).height(350)
    else
      $('#map').width(width).height(height)



  @activeSearch: ->
    Gmaps.buttonToGetLocation()
    Gmaps.inputToGetLocationOnKeyup()
    return



  @buttonToGetLocation: ->
    $('.js-btn-geocoder-address-for-map').click ->
      address = $('#address').val()
      Gmaps.getLocationFrom(address,
        draggable: true
      )
      return
    return


  @inputToGetLocationOnKeyup: ->
    $('#address').keyup ->
      address = this.value
      if address.length > 5
        delay( ->
          Gmaps.getLocationFrom(address,
            draggable: true
          )
          return
        , 900)

