
<% if params[:place_type] == "postal_code" %>
  
  
  $('.place_search').find('#place_city').val('');
  $('.place_search').find('#place_country').val('<%= @result.country %>');
  $('.place_search').find('#place_type').val(2);
  $('.place_search').find('#place_cp').val('<%= @result.postal_code %>');


<% elsif params[:place_type] == "locality" %>
  
  
  $('.place_search').find('#place_city').val('<%= @result.city %>');
  $('.place_search').find('#place_country').val('<%= @result.country %>');
  $('.place_search').find('#place_type').val(5);
  $('.place_search').find('#place_cp').val('');
  
  
<% elsif params[:place_type] == "administrative_area_level_2" %>
  
  
  $('.place_search').find('#place_city').val('<%= @result.sub_state %>');
  $('.place_search').find('#place_country').val('<%= @result.country %>');
  $('.place_search').find('#place_type').val(3);
  $('.place_search').find('#place_cp').val('');
  

<% elsif params[:place_type] == "administrative_area_level_1" %>
  
  
  $('.place_search').find('#place_city').val('<%= @result.state %>');
  $('.place_search').find('#place_country').val('<%= @result.country %>');
  $('.place_search').find('#place_type').val(4);
  $('.place_search').find('#place_cp').val('');

<% elsif params[:place_type] == "country" %>
  
  $('.place_search').find('#place_city').val('');
  $('.place_search').find('#place_country').val('<%= @result.country %>');
  $('.place_search').find('#place_type').val(6);
  $('.place_search').find('#place_cp').val('');
  

<% end %>