<!--
 ! Excerpted from "Rails Recipes",
 ! published by The Pragmatic Bookshelf.
 ! Copyrights apply to this code. It may not be used to create training material, 
 ! courses, books, articles, and the like. Contact us if you are in doubt.
 ! We make no guarantees that this code is fit for any purpose. 
 ! Visit http://www.pragmaticprogrammer.com/titles/rr2 for more book information.
-->
<html>                                           
  <head>   
    <%= javascript_include_tag :defaults %>
    <script src="/book/authors_for_lookup" type="text/javascript"></script>
    <style>
      div.auto_complete {
        width: 350px;
        background: #fff;
      }
      div.auto_complete ul {
        border:1px solid #888;
        margin:0;
        padding:0;
        width:100%;
        list-style-type:none;
      }
      div.auto_complete ul li {
        margin:0;
        padding:3px;
      }
      div.auto_complete ul li.selected { 
        background-color: #ffb; 
      }
      div.auto_complete ul strong.highlight { 
        color: #800; 
        margin:0;
        padding:0;
      }
    </style>
  </head>
  <body>
    <label for="author_lookup">Author Search</label>
    <input type="text" id="author_lookup" name="author_lookup" />                    
    <div class="auto_complete" id="author_lookup_auto_complete">
    </div>
    <%= javascript_tag("new Autocompleter.Local('author_lookup', 
                                   'author_lookup_auto_complete', 
                                   authors, 
                                   {fullSearch: true, 
                                      frequency: 0, 
                                      minChars: 1
                                    }
                                    );") %>
  </body>
</html>                                                              
