1 <div id="search_results">
2 <table class="search_results_title" width="100%">
4 <td align="left">Search Results</td>
5 <td align="right"><a href="javascript:closeSearchResults()">Close</a></td>
8 <div id="search_results_content">
12 <script type="text/javascript">
14 function startSearch() {
15 $("search_results_content").innerHTML = "<p class='search_results_entry'>Searching...</p>";
16 $("search_field").style.display = "none";
17 $("search_active").style.display = "inline";
20 function endSearch() {
21 $("search_field").style.display = "inline";
22 $("search_active").style.display = "none";
25 function openSearchResults() {
26 $("search_results").style.display = "block";
30 function closeSearchResults() {
31 $("search_results").style.display = "none";
35 function describeLocation() {
36 var position = getPosition();
38 <%= remote_function(:loading => "startSearch()",
39 :complete => "endSearch()",
40 :url => { :controller => :geocoder, :action => :description },
41 :with => "'lat=' + position.lat + '&lon=' + position.lon") %>
44 <% if params[:query] %>
45 <%= remote_function(:loading => "startSearch()",
46 :complete => "endSearch()",
47 :url => { :controller => :geocoder, :action => :search, :query => params[:query] }) %>
52 <% content_for "optionals" do %>
53 <div class="optionalbox">
54 <span class="oboxheader">Search</span>
55 <span class="whereami"><a href="javascript:describeLocation()">Where am I?</a></span>
56 <div class="search_form">
57 <span id="search_field">
58 <% form_remote_tag(:loading => "startSearch()",
59 :complete => "endSearch()",
60 :url => { :controller => :geocoder, :action => :search }) do %>
61 <%= text_field_tag :query, params[:query] %>
64 <p id="search_active">Searching...</p>
66 <p class="search_help">
67 examples: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ',
68 or 'post offices near Lünen'
69 <a href="http://wiki.openstreetmap.org/index.php/Search">more examples...</a>