     @_addKeyDownHandlers()
 
   syncWithMap: ()->
-    @gmap.setMarker('address', $(@selector).val()) if $(@selector).val()
+    @gmap.setMarker('address', @$el.val()) if @$el.val()
 
   _addKeyDownHandlers: ()->
-    $(@selector).bind 'keydown', (event)=>
+    @$el.bind 'keydown', (event)=>
       if event.keyCode == 13
-        @gmap.setMarker  'address', $(_this.selector).val()
-        $(@selector).autocomplete "disable"
+        @gmap.setMarker  'address', @$el.val()
+        @$el.autocomplete "disable"
       else
-        $(@selector).autocomplete "enable"
+        @$el.autocomplete "enable"
 

  change: ()=>
  minChars: 2

  constructor: (@selector)->
    @$el = $(@selector)

  apply: ()->
    $(@selector).autocomplete
      source: @source
      select: @select
      change: @change

#  autoComplete.apply()
class root.GmapAutocomplete extends Autocomplete

  constructor: (selector, @gmap)->
    super selector
    @gmap.onSucceed.push (address)=>
      @$el.val address

  source: (request, response) =>
    @gmap.searchGeocodes request.term, (results)->
