<%-
local rowcnt = 1
function rowstyle()
	rowcnt = rowcnt + 1
	return (rowcnt % 2) + 1
end
-%>

<style type="text/css">
	.center { text-align: center }
	.nowrap { white-space: nowrap }
	.wrap   { word-break: break-all; min-width: 100px }
	.red    { color: #b20000 }
	.green  { color: #00a100 }
	.blue   { color: #0000bf }
	.bold   { font-weight: bold }
	table.cbi-section-table a:link { color: #404040 }
	table.cbi-section-table a:visited { color: #404040 }
</style>

<%+rtorrent/tabmenu%>
<fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
	<div class="cbi-section-descr"><%=self.description%></div>
	<div class="cbi-section-node">
		<div class="table">
			<div class="tr cbi-rowstyle-2">
			<%- for i, k in pairs(self.children) do -%>
				<div class="td <% if i ~= (self.headcol or 1) then %> center nowrap<% else %> wrap<% end -%>
				"<%=ifattr(k.hint, "title", k.hint)%><%=ifattr(k.onclick, "onclick", k.onclick)%>><b><%=k.title%></b></div>
			<%- end -%>
			</div>

			<%- for j, k in ipairs(self:cfgsections()) do
				section = k
				scope = { valueheader = "rtorrent/empty", valuefooter = "rtorrent/empty" }
			-%>
				<div class="tr cbi-rowstyle-<%=rowstyle()%>" id="cbi-<%=self.config%>-<%=section%>">
				<%- for i, node in ipairs(self.children) do -%>
					<div class=" td cbi-value-field<% if i ~= (self.headcol or 1) then %> center nowrap<% else %> wrap
					<%- end if j > 1 and j == table.getn(self:cfgsections()) then %> bold<% end %>">
						<div id="cbi-<%=node.config.."-"..section.."-"..node.option%>">
							<%- node:render(section, scope or {}) -%>
						</div>
						<div id="cbip-<%=node.config.."-"..section.."-"..node.option%>"></div>
					</div>
				<%- end -%>
				</div>
			<%- end -%>
		</div>
	</div>
</fieldset>
