<div id="left">

<div class="blue">Actions</div>
<div class="articles">
<%= link_to('Delete all statistics', :action => 'confirm_delete') %>
</div>

  <div class="blue">Order By:</div>
  <div class="articles">
  <%= start_form_tag :action => 'update', :controller => 'options' %>
 
  <select name="setting[stat_order_by]" id="page_order_by">
  <%= options_for_select(stat_order_by_options, config_value('stat_order_by')) %>
  </select>
  
  <select name="setting[stat_display_order]" id="stat_display_order">
  <%= options_for_select(['asc','desc'], config_value('stat_display_order')) %>
  </select>

  <%= submit_tag "Go" %>
  </div>
  
  <div class="blue">Display Number:</div>
  <div class="articles">
  <select name="setting[stat_display_number]" id="stat_display_number">
  <%= options_for_select(display_by_options, config_value('stat_display_number')) %>
  </select>
  <%= submit_tag "Go" %>
  <%= end_form_tag %>
</div>
</div>


<div id="content">
<div class="blue">Stats</div>
<div class="articles">

<div id="tablediv">
<table id="user-list" class="list" cellpadding="0" cellspacing="0">
  <thead>  

	 			  <tr class="header">
	 				<th scope="col" width="70">Ip</th>
	 				<th scope="col">Visited</th>
	 				<th scope="col">Page Title</th>
	 				<th scope="col">Referer</th>
	 				<th scope="col">Browser</th>
	 				<th scope="col">Actions</th>
	 			  </tr> 
		
  </thead>
  <tfoot>
  		  <tr>		<% if pagination_links(@stat_pages) %>
  		  		<th scope="row">Page: </th>
  		  		<td colspan="5"><%= pagination_links(@stat_pages) -%></td>
  		  		<% end %>
  		</tr>
 </tfoot>
  <tbody>
    
<% for stat in @stats %>
  <tr>
  
    <td><%= stat.remote_address %></td>
    <td><%= distance_of_time_in_words_to_now stat.created_at %> ago</td>
    <td><%= stat.page_title %></td>
    <td><%= stat.http_referer %></td>
    <td><%= stat.browser %></td>
    <td>
    	<%= link_to_remote('Overlay', 
   			{ :update => "boxcontent", 
   			:loading => "showLoader()", 
   			:complete => "showBox()", 
   			:url => { :action => 'overlay', :id => stat } },
   			{ :href => url_for(:action => 'show', :id => stat ) } )%>
   			<%= link_to 'Show', :action => 'show', :id => stat %>
   			<%= link_to 'Delete', :action => 'destroy', :id => stat %></td>
  </tr>
<% end %>
</table>
</div>

</div>

</div>