 $.fn.autocomplete_collection.Constructor = AutocompleteCollection
 
 $ ->
-
   $('[data-provide="autocomplete-collection"]').each ->
     $this = $(@)
     return if $this.data('autocomplete-collection')

    prev.addClass('active')
    @

  listen: ->
    @$element
      .on('blur',     $.proxy(@blur, @))
      .on('keypress', $.proxy(@keypress, @))
      .on('keyup',    $.proxy(@keyup, @))

    if $.browser.webkit or $.browser.msie
      @$element.on('keydown', $.proxy(@keypress, @))

    @$menu
      .on('click', $.proxy(@click, @))
      .on('mouseenter', 'li', $.proxy(@mouseenter, @))


  move: (e) ->
    if !@shown
      if e.keyCode == 13
        return false
      else
        return

    switch e.keyCode
      when 9, 13, 27
        e.preventDefault()


  mouseleave: (e) ->
    @mousedover = false
    @hide() if not @focused and @shown

$.fn.autocomplete_collection = (option) ->
  @each ->
