 
   trim = (str) ->
     str.replace(/^\s\s*/, "").replace /\s\s*$/, ""
+
+  idify = (str) ->
+    str.replace(/[^a-z0-9]/g, "_")
 
   toggleMultiSearch: (e=null) ->
     e.preventDefault() if e?

      html = "<div><h3>"
    html += "<span class='serial-text'>#{serial}</span> - #{results} results</h3>"
    html += "<ul>#{@bikeList(bikes)}</ul></div>"
    $("##{serial}").append(html)

  searchSerialsFuzzy: (event) ->
    event.preventDefault()

    s_i.addClass('ms-match').removeClass('ms-nomatch')
    unless s_i.find('a').length > 0
      # make the li a link, add the returned bikes container
      s_i.append("<a href='##{idify(serial)}' class='scroll-to-ref'></a>")
      $('#bikes_returned').append("<div id='#{idify(serial)}' class='multiserial-results'></div>")
    s_i.find('a').addClass('blink-class')
    setTimeout (->
      s_i.find('a').removeClass('blink-class')
