       this.getActiveResult().addClass "active"
 
   moveSelection: (modifier) ->
-    console.log "moveSelection", @active_result, @results.length, @MAX_RESULTS
-    max_result = Math.min(@results.length, @MAX_RESULTS)
+    max_result = this.getMaxResult()
     @active_result += modifier
     @active_result = max_result-1 if @active_result < 0
     @active_result = 0 if @active_result > max_result-1

      title: @search_link
    results


OUT.lazyTimerIds = {}
OUT.setLazyTimer = (name, delay, func) ->

    out = this.renderResultsToString(query)
    if out != ""
      out += '<li class="divider after-results"></li>'
    if query == ""
      out += ('<li class="result"><a href="/%{type}s" class="result">'+@parent.index_link+'</a></li>').replace(/%\{type\}/g, @parent.type).replace(/%\{query\}/g, query)
    else
      out += ('<li class="result"><a href="/%{type}s/new?%{type}[title]=%{query}"><i class="icon-plus"></i> '+@parent.new_template+'</a></li>').replace(/%\{type\}/g, @parent.type).replace(/%\{query\}/g, query)

    last_li = $(@selector).find("li.insert-results-after")
    last_li.nextAll().remove()
