<div id="resource_agent_<%=@resource.name%>" style="float:left;">
  <form method=POST action="/update_resource">
    <div id="resource_group">
      <table><tr>
	  <td nowrap><div class="bold">Resource Group:</div></td>
	  <td>
	    <select name="resource_group">
		<option value="">None</option>
	      <% @groups.each do |g| %>
		<option <%= "selected" if @cur_resource and g == @cur_resource.group %> value="<%=g%>"><%=g%></option>
	      <% end %>
	    </select>
	    <input type=hidden name="_orig_resource_group" value="<%= @cur_resource.group if @cur_resource %>">
	  </td>
	</tr>
	<tr>
	  <td nowrap><div class="bold">Clone:</div></td>
	  <td>
	    <input type="hidden" name="_orig_resource_clone" value="<%= @cur_resource.clone if @cur_resource %>">
	    <input type=checkbox name="resource_clone" <%= "checked" if @cur_resource && @cur_resource.clone %>>
	  </td>
	</tr>
	<tr>
	  <td nowrap><div class="bold">Master/Slave:</div></td>
	  <td>
	    <input type="hidden" name="_orig_resource_ms" value="<%= @cur_resource.ms if @cur_resource %>">
	    <input type=checkbox name="resource_ms" <%= "checked" if @cur_resource && @cur_resource.ms %>>
	  </td>
	</tr>
      </table>
    </div>
    <table style="clear:left; float:left; margin-top: 25px;">
      <% if @new_resource %>
	<tr>
	  <td class="reg">
	    Resource ID
	  </td>
	  <td>
	    <input style="margin-right: 50px;" type="text" name="name" size="35" class="text_field">
	  </td>
	</tr>
      <% end %>

      <% if @existing_resource %>
	<input type="hidden" name="resource_id" value="<%=@cur_resource.id%>">
      <% end %>

      <input type="hidden" name="resource_type" value="<%=@resource.name%>">
      <% @resource.required_options.each { |name, desc|  %>
	<tr title="<%=desc[1]%>">
	  <td class="reg">
	    <%= name %>
	  </td>
	  <td>
	    <input placeholder="<%=desc[0]%>" style="margin-right: 50px;" type="text" name="<%= @cur_resource && @cur_resource.options[name] ? "_res_paramne_" : "_res_paramempty_"%><%=name%>" value="<%=@cur_resource.options[name] if @existing_resource %>" size="35" class="text_field">
	  </td>
	</tr>
      <% } %>
      <tr>
	<td id="<%= @new_resource ? "optional_args_new" : "optional_args_existing" %>" nowrap class="reg" onclick="show_hide_constraints(this)" colspan=2>
	  <span class="rightarrow sprites"></span><span class="downarrow sprites" style="display: none;"></span>
	  <div class="bold">Optional Arguments:</div>
	</td>
      </tr>
      <% @resource.optional_options.each { |name, desc|  %>
	<tr title="<%=desc[1]%>" style="display:none;">
	  <td class="reg">
	    <%= name %>
	  </td>
	  <td>
	    <input placeholder="<%=desc[0]%>" style="margin-right: 50px;" type="text" name="<%= @cur_resource && @cur_resource.options[name] ? "_res_paramne_" : "_res_paramempty_"%><%=name%>" value="<%=@cur_resource.options[name] if @existing_resource %>" size="35" class="text_field">
	  </td>
	</tr>
      <% } %>
      <tr class="stop"><td class="center" style="padding-top:20px;height:26px;" colspan=2>
	  <input class="apply_changes" type=submit class="text_field" onclick="$(this).hide();create_resource($(this).parents('form'),<%=@existing_resource ? 'true':'false'%>); return false;" value="<%= @existing_resource ? "Apply Changes" : "Create Resource" %>">
	</td>
      </tr>
    </table>
  </form>
</div>
