<% if Snorby::Worker.running? %>

	<%= snorby_box("Email Event Information", false) do %>

		<div id='snorbybox-content' class=''>

			<%= form_tag '/email', :class => 'email-event-information validate' do %>

			<div class='grid_17' style='disply:block;'>

				<%= hidden_field_tag :sid, params[:sid] %>

				<%= hidden_field_tag :cid, params[:cid] %>
				
				<%= hidden_field_tag 'email[user_id]', @current_user.id %>

				<br />

				<p>
					<%= label_tag 'Recipients:' %> <i>(separate email addresses by comma. Example: demo@snorby.org, example@example.com)</i><br />
					<br />
					
					<div class='grid_4 alpha' style='padding-top:7px;'>
						<%= select_tag 'ignore', dropdown_select_tag(User.all, :email, false, ['<option value=''>Please Select A User</option>']), :class => 'email-user-select' %><br />
					</div>
					
					<div class='grid_10' style='margin-bottom:7px;'>
						<%= text_field_tag 'email[to]', nil, :class => 'input-small required', :style => 'width:475px;', :placeholder => 'demo@snorby.org, example@example.com' %><br />
					</div>
					
				</p>

				<br />

				<p>
					
					<div class='grid_10 alpha' style='margin-bottom:7px;'>
						<%= label_tag 'Email Subject:' %><br />
						<%= text_field_tag 'email[subject]', "#{@event.timestamp.strftime('%D %H:%M')} - #{@event.signature.sig_name}", :class => 'input-small required', :style => 'width:640px;' %><br />
					</div>
				
				</p>

				<br />

				<p>
					<div class='grid_10 alpha' style='margin-bottom:20px;'>
						<%= label_tag 'Email Body:' %><br />
						<%= text_area_tag 'email[body]', nil, :style => 'width:645px;height:150px' %><br />
					</div>
				</p>

			</div>
			
			<br />

			<% end %>


      <%= snorby_box_footer do %>
        <%= form_actions do %>
          <%= button "Email Event Information", :class => 'success email-event-information' %>
          <%= button "Cancel", :class => 'warning cancel-snorbybox' %>
        <% end %>
      <% end %>

		</div>

	<% end %>

<% else %>

	<%= snorby_box("The Snorby Worker Is Not Running!") do %>
		
		<div id='note-box' class='error'>
			<%= image_tag('icons/note-icon-white.png') %>
			The Snorby worker is not currently running. It's imperative you start the worker immediately!
			All backend calculations are performed asynchronously using the Snorby Worker.
		</div>
		
	<% end %>

<% end %>
