<div class="actionPanelLeft">
	<div class="actionPanelRight p16">
		<div id="actionTop" class="right">
			<div class="button actionSave">
				<div class="buttonRight">
					<div class="buttonMiddle">{rs:ACTION_SAVE}</div>
				</div>
			</div>

			<div class="button actionCancel">
				<div class="buttonRight">
					<div class="buttonMiddle">{rs:ACTION_CANCEL}</div>
				</div>
			</div>

			<div class="br"><img src="{global:PATH}img/spacer.gif" width="1" height="1" border="0" /></div>
		</div>
	</div>
</div>
<div class="middleLeft">
	<div class="middleRight p16">
		{ERROR}
		<form method="post" id="editForm">
		<table width="100%" cellspacing="0" cellpadding="5" border="0">
	
		<tr class="line">
		<td><div class="labelBox">{rs:NAME}<span class="red">*</span>:</div></td>
		<td><div class="inputBox"><input type="text" name="r[name]" value="{name}"></div></td>
		</tr>

		<tr class="line">
		<td><div class="labelBox">{rs:MAIL}<span class="red">*</span>:</div></td>
		<td><div class="inputBox"><input type="text" name="r[mail]" value="{mail}"></div></td>
		</tr>

		<tr class="line">
		<td><div class="labelBox">{rs:FORMAT}:</div></td>
		<td>
			<select name="r[receive_format]">
			{row:RECEIVE_FORMAT_SELECT}<option value="{id}" {selected}>{title}</option>{/row}
			</select>
		</td>
		</tr>

		<tr class="line">
		<td><div class="labelBox">{rs:ENCODING}:</div></td>
		<td>
			<select name="r[encoding]">
			{row:ENCODING_SELECT}<option value="{id}" {selected}>{title}</option>{/row}
			</select>
		</td>
		</tr>

		<tr class="line">
		<td valign="top"><div class="labelBox">{rs:MAILING_GROUPS}:</div></td>
		<td>
			{if:mg_list}
			<div class="checkBoxItem">
				<div class="checkBox"><input type="checkbox" name="all_groups" id="all_groups" value=""></div>
				<div class="label"><label for="all_groups"><b>{rs:SELECT_ALL}</b></label></div>
			</div>
			{/if}
			{if:!mg_list}<b>{rs:NO_MG_LIST}</b>{/if}
			{row:GROUPS_SELECT}
			<div class="checkBoxItem">
				<div class="checkBox"><input type="checkbox" name="r[group_id][]" id="group_{id}" value="{id}"{if:selected} checked{/if}></div>
				<div class="label"><label for="group_{id}">{title}</label></div>
			</div>
			{/row}
			<div class="br"><img src="{global:PATH}img/spacer.gif" width="1" height="1" border="0"></div>
		</td>
		</tr>

		<tr class="line">
		<td><div class="labelBox">{rs:SYSTEM_STATUS}:</div></td>
		<td>
			<select name="r[status]">
			{row:STATUS_SELECT}<option value="{id}" {selected}>{title}</option>{/row}
			</select>
		</td>
		</tr>

		{row:CUSTOM_FIELDS}
		<tr class="line">
		<td valign="top"><div class="labelBox">{title}{if:not_null}<span class="red">*</span>{/if}:</div></td>
		<td>{line}</td>
		</tr>
		{/row}

		<tr>
		<td><img src="{global:PATH}img/spacer.gif" width="200" height="1" border="0" alt=""></td>
		<td width="100%"><img src="{global:PATH}img/spacer.gif" width="1" height="1" border="0" alt=""></td>
		</tr>
		</table>
		<input type="hidden" name="save" value="1" class="hidden">
		</form>

		<div class="info">
			{if:!id}{rs:INFO_SUBSCRIBERS_CREATE}{/if}
			{if:id}{rs:INFO_SUBSCRIBERS_EDIT}{/if}
		</div>
	</div>
</div>
<div class="actionPanelLeft">
	<div class="actionPanelRight">
		<div class="actionPanelBottom">
			<div class="actionPanelBottomLeft">
				<div class="actionPanelBottomRight p16">
					<div id="actionBottom" class="right">
						<div class="button actionSave">
							<div class="buttonRight">
								<div class="buttonMiddle">{rs:ACTION_SAVE}</div>
							</div>
						</div>

						<div class="button actionCancel">
							<div class="buttonRight">
								<div class="buttonMiddle">{rs:ACTION_CANCEL}</div>
							</div>
						</div>

						<div class="br"><img src="{global:PATH}img/spacer.gif" width="1" height="1" border="0" /></div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<script>
	$(".actionSave").click(function() {
		$("#editForm").submit();
	});
	$(".actionCancel").click(function() {
		if (confirm("{rs:SURE_CANCEL_EDIT}")) window.location.href="{global:BACK_LINK}";
	});
	$("input[name='all_groups']").click(function() {
		$("input[name*='r[group_id]']").attr('checked', this.checked);
	});
	$("#editForm").keydown(function(event) {
  		if (event.keyCode == '13' && event.target.nodeName!='TEXTAREA') $(".actionSave").triggerHandler('click');
  		if (event.keyCode == '27') {
			$(".actionCancel").triggerHandler('click');
		}
	});
</script>