<% content_for :top_field do%>
  <%= render 'search_bar' %>
<% end %>

<div class="resource_sum" id="IE_resource_sum_css">
<% @attach_array.each_with_index do |k, index|%>
	<div class="line_block" >
		<p>
			<%= @str_arr[index] %>
		</p>

		<div class="table1">
			<div class='table_row1'>
				<div class='table_cell1 filename1' style='text-align: center;'>
                  <%=l(:label_attachment)%>
                </div>
				<div class='table_cell1 filedown1'>
                  <%=l(:field_downloads)%>
                </div>
				<div class='table_cell1 downicon1'>
                  <%=l(:button_download)%>
                </div>
			</div>
		</div>

		<div class="table1">
          <% if index == 2%>
		<% k.each do |c1|%>
			<div class="table_row1 <%= cycle 'odd', 'even' %>">
				<div class="filename table_cell1 filename1" >

                  <%= link_to_attachment c1, {:download => true}%>
				</div>
				<div  class="table_cell1 filedown1">
					<%= c1.downloads %>
				</div>
				<div class="table_cell1 downicon1 filename download_icon" >
					<%= link_to_attachment c1, {:download => true, :text => image_tag("/images/button/download.png", width: "22px", alt: l(:button_download)) }%>
				</div>
			</div>
		<% end -%>
        <%else%>
              <% k.each do |c1|%>
                  <div class="table_row1 <%= cycle 'odd', 'even' %>">
                    <div class="filename table_cell1 filename1" >
                      <%= link_to c1.filename, (attachFromUrl c1), {:title => c1.filename, :target => "_blank"} %>

                    </div>
                    <div  class="table_cell1 filedown1">
                      <%= c1.downloads %>
                    </div>
                    <div class="table_cell1 downicon1 filename download_icon" >
                      <%= link_to_attachment c1, {:download => true, :text => image_tag("/images/button/download.png", width: "22px", alt: l(:button_download)) }%>
                    </div>
                  </div>
              <% end -%>

        <% end %>
		</div>

	</div>
<% end; reset_cycle %>
</div>
<script type='text/javascript'>
 function validate_required(field,alerttxt)
  {
    with (field)
    {
      if (value==null||value=="")
        {alert(alerttxt);$.find('form').attr("data-submitted",'');return false}
      else {return true}
    }
  }

  function validate_form(thisform) {
    with (thisform)
    {
      if (validate_required(name,"name must be filled out!")==false)
        {name.focus();return false}
    }
  }
	$(document).ready(function($) {
		$('.download_icon').find("a").attr("target", "_blank");
		$('.download_icon').each(function(){
			$(this).mouseenter(function(event) {
				$(this).find('img').attr("src", "<%= path_to_image("/images/button/download_focus.png") %>")
			});
			$(this).mouseleave(function(event) {
				$(this).find('img').attr("src", "<%= path_to_image("/images/button/download.png") %>")
			});
		});
        if(navigator.appName=="Microsoft Internet Explorer"){
            $("#IE_resource_sum_css").children(".line_block").css("width","45%");
        }
	});
</script>
<% html_title(l(:label_stores_index)) -%>
