-<div id="geocoder">
- <% form_tag :controller => 'geocoder', :action => 'search' do %>
- <%= hidden_field_tag 'next_controller', @controller.controller_name %>
- <%= hidden_field_tag 'next_action', @controller.action_name %>
- <%= text_field 'query', 'postcode' %>
- <%= text_field 'query', 'place_name'%>
- <%= submit_tag 'Search' %>
+<script type="text/javascript">
+<!--
+ function startSearch() {
+ updateSidebar("Search Results", "<p class='search_results_entry'>Searching...<\/p>");
+
+ $("search_field").style.display = "none";
+ $("search_active").style.display = "inline";
+ }
+
+ function endSearch() {
+ $("search_field").style.display = "inline";
+ $("search_active").style.display = "none";
+ }
+
+ function describeLocation() {
+ var position = getPosition();
+
+ <%= remote_function(:loading => "startSearch()",
+ :complete => "endSearch()",
+ :url => { :controller => :geocoder, :action => :description },
+ :with => "'lat=' + position.lat + '&lon=' + position.lon") %>
+ }
+
+ <% if params[:query] %>
+ <%= remote_function(:loading => "startSearch()",
+ :complete => "endSearch()",
+ :url => { :controller => :geocoder, :action => :search, :query => h(params[:query]) }) %>