<div id= "poststuff">
<% # encoding: utf-8 %>

  <%= f.error_messages %>

	<!--Widget start-->
	
	<div id="sub-wiget"> 

		<div id="widget-date" class="widget-box widget-size-300"> 
			<h3 class="widget-title"><i class="icons-calendar"></i><%= t(:date_) %></h3>
				<div class="widget-content clear">
				<div class="control-group">
					<%= f.datetime_picker :mail_sentdate, :picker_type => 'separated', :label => t(:start) %>
				</div> 
			</div>
		</div>
  
	</div>
  
  
<!--Wiget End-->
<!--Post Start-->

	<div id="post-body">
		<div id="post-body-content" class="clear">
		
			<%= f.label :mail_subject ,t(:mail_subject)%> 
			<%= f.text_field :mail_subject %>
		
			<%= f.label :mail_from ,t(:mail_from)%> 
			<%= f.text_field :mail_from %>
		
			<%= f.label :mail_reply_to ,t(:mail_reply_to)%> 
			<%= f.text_field :mail_reply_to %>
		
			<%= f.label :mail_to ,t(:mail_to)%> 
			<%= f.text_field :mail_to %> 
		
			<%= f.label :mail_content ,t(:mail_content)%> 
			<%= f.text_area :mail_content, :class=>"span12", :cols=>"25", :rows=>"10" %>

		</div>





		<div>
					
			<div id='plugin_files' class="plugin_files_block">
				
			<table class="table table-condensed">
				<thead>
					<tr>
						<th>File</th>
						<th>File Name</th>
						<th class="span1"></th>
					</tr>
				</thead>
				<tfoot>
					<tr>
						<td style="text-align:center" colspan="3">
							<div id='add_plugin_file' class="info_input plugin_files_block">
								<%= hidden_field_tag 'plugin_file_field_count', @mail_cron.mail_cron_files.count %>
								<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i> ADD/新增</span></a>
							</div>
						</td>
					</tr>
				
				</tfoot>
				<tbody>
					
					<% @mail_cron.mail_cron_files.each_with_index do |mail_cron_file, i| %>
						<%= f.fields_for :mail_cron_files, mail_cron_file do |f| %>
							<%= render :partial => 'form_file', :object => mail_cron_file, :locals => {:f => f, :i => i} %>
						<% end %>
					<% end %>	
				</tbody>
			</table>
			
			</div>
			
		</div>


<!--Post End-->
	</div>

  
	<div class="form-actions">
	<%= f.submit t('submit'), :class=>'btn btn-primary' %>
	<%= link_to t('cancel'), get_go_back, :class=>"btn" %> 
	</div> 


	

<% content_for :page_specific_javascript do %>
	<%= javascript_include_tag "archive_plugin_form" %>
	<script>
		$('#add_plugin_file a.add').live('click', function(){
			var new_id = $(this).prev().attr('value');
			var old_id = new RegExp("new_add_plugin_files", "g");
			$(this).prev().attr('value', parseInt(new_id) + 1);
			$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :mail_cron_files) %>").replace(old_id, new_id));
		});
		
		$('.add_plugin_files_block a.delete').live('click', function(){
		  $(this).parents('.list_item').remove();
		});

		$('.action a.remove_existing_record').live('click', function(){
		  $(this).next('.should_destroy').attr('value', 1);
		  $("tr#add_plugin_file_" + $(this).prev().attr('value')).hide();
		});

	</script>
<% end %>


</div> 