<div class="actionPanelLeft">
	<div class="actionPanelRight p16">
		<div id="actionTop" class="filterBox">
			<form action="{FILTER_LINK}" method="POST" id="filterForm">
			<table width="100%" cellspacing="0" cellpadding="0" border="0">
			<tr>
			<td>
				<div class="button" id="actionNew">
					<div class="buttonRight">
						<div class="buttonMiddle">{rs:ACTION_ADD} {rs:SUBSCRIBER}</div>
					</div>
				</div>
			</td>

			<td class="space"><div class="labelBox">{rs:COUNT_PER_PAGE}:</div></td>
			<td>
				<select name="_cp">
				{row:REC_COUNT}
				<option value="{title}" {selected}>{title}</option>
				{/row}
				</select>
			</td>
			</tr>

			<tr>
			<td width="100%"><img src="{global:PATH}img/spacer.gif" width="1" height="1" border="0" /></td>
			<td><img src="{global:PATH}img/spacer.gif" width="1" height="1" border="0" /></td>
			<td><img src="{global:PATH}img/spacer.gif" width="1" height="1" border="0" /></td>
			<td><img src="{global:PATH}img/spacer.gif" width="1" height="1" border="0" /></td>
			<td><img src="{global:PATH}img/spacer.gif" width="1" height="1" border="0" /></td>
			</tr>
			</table>


			<div id="advancedFilters" align="right">
				<table cellspacing="0" cellpadding="0" border="0">
				<tr>
				<td><div class="labelBox">{rs:MAILING_GROUP}:</div></td>
				<td>
					<select name="g_id">
					<option value="0">{rs:ANY}</option>
					{row:GROUPS_SELECT}<option value="{id}" {selected}>{title}</option>{/row}
					</select>
				</td>

				<td class="space"><div class="labelBox">{rs:SYSTEM_STATUS}:</div></td>
				<td>
					<select name="status">
					<option value="-1">{rs:ANY}</option>
					{row:STATUS_SELECT}<option value="{id}" {selected}>{title}</option>{/row}
					</select>
				</td>

				<td class="space"><div class="labelBox">{rs:CUSTOM_FIELD}:</div></td>
				<td>
					<select name="cf_id">
					<option value="0">{rs:ANY}</option>
					{row:CUSTOM_FIELDS_SELECT}<option value="{id}" {selected}>{title}</option>{/row}
					</select>
				</td>

				<td class="space"><div class="labelBox">{rs:VALUE}:</div></td>
				<td><div class="inputBox"><input type="text" name="cf_value" id="cf_value_field" value="{cf_value}"></div></td>
				</tr>

				</tr>
				</table>
			</div>
			<input type="hidden" name="_search" value="{search}">
			</form>
		</div>
	</div>
</div>
<form action="{LINK}" method="POST" id="recordsList">
<div class="middleLeft">
	<div class="middleRight p16">

		{ERROR}
		{MESSAGE}
		<input type="hidden" name="act" value="">
		<table width="100%" cellspacing="0" cellpadding="5" border="0" class="table">
		<tr class="header">
		<td><input type="checkbox" name="all" value=""></td>
		<td><a href="{sort_by_name}" class="{sort_name_img}">{rs:NAME}</a></td>
		<td><a href="{sort_by_mail}" class="{sort_mail_img}">{rs:MAIL}</a></td>
		<td>&nbsp;</td>
		</tr>

		{row:LINE}
		<tr class="line{if:disabled} grey{/if}">
		<td><input type="checkbox" name="ids[]" value="{id}"></td>
		<td class="title">{name}{if:!name}&nbsp;{/if}</td>
		<td><a href="mailto:{mail}">{mail}</a></td>
		<td class="action"><a href="{global:LINK}{if:global:LINK}&{/if}{unless:global:LINK}?{/unless}edit={id}">{rs:ACTION_EDIT}</a></td>
		</tr>
		{/row}

		{if:!count}<tr><td class="emptyResult" colspan="4">{rs:EMPTY}</td></tr>{/if}

		<tr>
		<td><img src="{global:PATH}img/spacer.gif" width="20" height="1" border="0" /></td>
		<td width="50%"><img src="{global:PATH}img/spacer.gif" width="100" height="1" border="0" /></td>
		<td width="50%"><img src="{global:PATH}img/spacer.gif" width="100" height="1" border="0" /></td>
		<td><img src="{global:PATH}img/spacer.gif" width="50" height="1" border="0" /></td>
		</tr>
		</table>
		{if:offset}<div class="offset">{offset}</div>{/if}
	</div>
</div>
<div class="actionPanelLeft">
	<div class="actionPanelRight">
		<div class="actionPanelBottom">
			<div class="actionPanelBottomLeft">
				<div class="actionPanelBottomRight p16">
					<div id="actionBottom" class="moreActions">
						<div class="buttonsBox">
							<div class="button actionDelete">
								<div class="buttonRight">
									<div class="buttonMiddle">{rs:ACTION_DEL}</div>
								</div>
							</div>

							<div class="button actionActivate">
								<div class="buttonRight">
									<div class="buttonMiddle">{rs:ACTION_ACTIVATE}</div>
								</div>
							</div>

							<div class="button actionDeActivate">
								<div class="buttonRight">
									<div class="buttonMiddle">{rs:ACTION_DEACTIVATE}</div>
								</div>
							</div>

							<div class="button actionBanned">
								<div class="buttonRight">
									<div class="buttonMiddle">{rs:ACTION_BANNED}</div>
								</div>
							</div>

							<div class="button actionBlackList">
								<div class="buttonRight">
									<div class="buttonMiddle">{rs:ACTION_BLACK_LIST}</div>
								</div>
							</div>
							<div class="br"><img src="{global:PATH}img/spacer.gif" width="1" height="1" border="0" /></div>
						</div>

						<div id="advancedActions">
							<table cellspacing="0" cellpadding="0" border="0">
							<tr>
							<td>
								<select name="cm">
								<option value="copy">{rs:ACTION_COPY}</option>
								<option value="move">{rs:ACTION_MOVE}</option>
								</select>
							</td>
							<td><div class="labelBox">{rs:SUBSCRIBERS_TO_MAILING_GROUP}</div></td>
							<td>
								<select name="group_id">
								{row:GROUPS_SELECT}<option value="{id}">{title}</option>{/row}
								<option value="-1">{rs:ALL} {rs:TITLE_MAILING_GROUPS}</option>
								</select>
							</td>
							<td>
								<div class="button" id="actionCM">
									<div class="buttonRight">
										<div class="buttonMiddle">OK</div>
									</div>
								</div>
							</td>
							</tr>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
</form>
<script>
	$("#filterForm").submit(function() {
		$(this).find("input[name='_search']").val($("input[name='_searchContainer']").attr('value'));
	});
	$("#filterForm").find("select[name='g_id'],select[name='status'],select[name='_cp']").change(function() {
		$("#filterForm").submit();
	});
	$("#filterForm").find("input[name='cf_value']").keydown(function(event) {
		if (event.keyCode == '13') $("#filterForm").submit();
	});
	$("#actionOk").click(function() {
		$("#filterForm").submit();
	});
	$("#actionNew").click(function() {window.location.href="{global:LINK}{if:LINK}&{/if}{unless:LINK}?{/unless}edit=0";});
	$(".actionDelete").click(function() {
		if (confirm("{rs:SURE_DELETE_SUBSCRIBERS}")) {
			$("#recordsList").find("input[name='act']").attr('value', 'delete');
			$("#recordsList").submit();
		}
	});
	$(".actionActivate").click(function() {
		$("#recordsList").find("input[name='act']").attr('value', 'activate');
		$("#recordsList").submit();
	});
	$(".actionDeActivate").click(function() {
		$("#recordsList").find("input[name='act']").attr('value', 'deactivate');
		$("#recordsList").submit();
	});
	$(".actionBanned").click(function() {
		if (confirm("{rs:SURE_BANNED_SUBSCRIBERS}")) {
			$("#recordsList").find("input[name='act']").attr('value', 'banned');
			$("#recordsList").submit();
		}
	});
	$(".actionBlackList").click(function() {
		if (confirm("{rs:SURE_BLACK_LIST_SUBSCRIBERS}")) {
			$("#recordsList").find("input[name='act']").attr('value', 'black_list');
			$("#recordsList").submit();
		}
	});
	$("#actionCM").click(function() {
		$("#recordsList").find("input[name='act']").attr('value', 'copy/move');
		$("#recordsList").submit();
	});
	$("input[name='all']").click(function() {
		$("input[name*='ids']").attr('checked', this.checked);
	});
</script>
