<!--// $Id$ //-->
<H1>{$layout.pagetitle}</H1>
<FORM name="mailing" method="post" action="?m=mailing" enctype="multipart/form-data" target="_blank" >
<INPUT type="submit" class="hiddenbtn">
<SCRIPT>
<!--
	function Send()
	{
		if (document.mailing["mailing[sender]"].value == "" ||
			document.mailing["mailing[from]"].value == "" ||
			document.mailing["mailing[subject]"].value == "" ||
			document.mailing["mailing[body]"].value == "" ||
			!checkaddr(document.mailing["mailing[sender]"].value))
			document.mailing.target="";

		document.mailing.submit();
	}

	function checkaddr(email)
	{
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		if (filter.test(email))
			return 1
		else
			return 0;
	}
//-->
</SCRIPT>
<TABLE WIDTH="100%" CELLPADDING="3">
	<TR CLASS="DARK">
		<TD CLASS="FLEFTU" WIDTH="1%">
			<IMG SRC="modules/mailing/img/group.gif" ALT=""> 
		</TD>
		<TD CLASS="FBT" WIDTH="1%" NOWRAP>
			<B>{t}Recipients:{/t}</B>
		</TD>
		<TD CLASS="FRIGHTU" WIDTH="98%">
			{t}Customers:{/t}
			<SELECT NAME="mailing[group]" {tip trigger="group" text="Select recipients group"}>
				<option value="0"{if !$mailing.group} SELECTED{/if}>{t}— all customers —{/t}</option>
				<option value="3"{if $mailing.group == "3"} SELECTED{/if}>{t}connected<!plural>{/t}</option>
				<option value="2"{if $mailing.group == "2"} SELECTED{/if}>{t}awaiting{/t}</option>
				<option value="1"{if $mailing.group == "1"} SELECTED{/if}>{t}interested<!plural>{/t}</option>
				<option value="4"{if $mailing.group == "4"} SELECTED{/if}>{t}deleted<!plural>{/t}</option>
				<option value="5"{if $mailing.group == "5"} SELECTED{/if}>{t}disconnected<!plural>{/t}</option>
				<option value="6"{if $mailing.group == "6"} SELECTED{/if}>{t}in debt{/t}</option>
			</SELECT>&nbsp;
			{t}Network:{/t}
			<SELECT NAME="mailing[network]" {tip trigger="network" text="Select IP network"}>
				<option value="0">{t}— all networks —{/t}</option>
				{section name="networks" loop=$networks}
				<option value="{$networks[networks].id}"{if $mailing.network == $networks[networks].id} SELECTED{/if}>{$networks[networks].name}</option>
				{/section}
			</SELECT>&nbsp;
			{t}Group:{/t}
			<SELECT NAME="mailing[customergroup]" {tip trigger="customergroup" text="Select customers group"}>
				<option value="0">{t}— all groups —{/t}</option>
				{section name="customergroups" loop=$customergroups}
				<option value="{$customergroups[customergroups].id}"{if $mailing.customergroup == $customergroups[customergroups].id} SELECTED{/if}>{$customergroups[customergroups].name}</option>
				{/section}
			</SELECT>
		</TD>
	</TR>
	<TR CLASS="LIGHT">
		<TD CLASS="FLEFT" WIDTH="1%">
			<IMG SRC="modules/mailing/img/email.gif" ALT=""> 
		</TD>
		<TD WIDTH="1%" NOWRAP>
			<B>{t}Sender E-mail:{/t}</B>
		</TD>
		<TD CLASS="FRIGHT" WIDTH="98%">
			<INPUT type="text" NAME="mailing[sender]" SIZE="40" value="{if $mailing.sender}{$mailing.sender}{elseif $userinfo.email}{$userinfo.email}{/if}" {tip trigger="sender" text="Enter sender e-mail address"}>
		</TD>
	</TR>
	<TR CLASS="LIGHT">
		<TD CLASS="FLEFT" WIDTH="1%">
			<IMG SRC="modules/mailing/img/users.gif" ALT=""> 
		</TD>
		<TD WIDTH="1%">
			<B>{t}Sender:{/t}</B>
		</TD>
		<TD CLASS="FRIGHT" WIDTH="98%">
			<INPUT type="text" NAME="mailing[from]" SIZE="40"  VALUE="{if $mailing.from}{$mailing.from}{elseif $userinfo.name}{$userinfo.name}{/if}" {tip trigger="from" text="Enter sender name"}>
		</TD>
	</TR>
	<TR CLASS="LIGHT">
		<TD CLASS="FLEFT" WIDTH="1%">
			<IMG SRC="modules/mailing/img/mail.gif" ALT=""> 
		</TD>
		<TD WIDTH="1%">
			<B>{t}Subject:{/t}</B>
		</TD>
		<TD CLASS="FRIGHT" WIDTH="98%">
			<INPUT type="text" NAME="mailing[subject]" SIZE="80" VALUE="{$mailing.subject}" {tip trigger="subject" text="Enter message subject"}>
		</TD>
	</TR>
	<TR CLASS="LIGHT">
		<TD CLASS="FLEFT" WIDTH="1%">
			<IMG SRC="img/edit.gif" ALT=""> 
		</TD>
		<TD WIDTH="1%" NOWRAP>
			<B>{t}Message body:{/t}</B>
		</TD>
		<TD CLASS="FRIGHT" WIDTH="98%">
			<TEXTAREA NAME="mailing[body]" COLS="80" ROWS="20" {tip text="Use carriage return for indentation only. LMS will reformat paragraphs and break long lines." trigger="body"}>{$mailing.body}</TEXTAREA><BR>
		</TD>
	</TR>
	<TR CLASS="LIGHT">
		<TD WIDTH="1%" CLASS="fleft">
			<IMG src="modules/mailing/img/attach.gif" alt="">
		</TD>
		<TD WIDTH="1%" NOWRAP>
			<B>{t}Attachment:{/t}</B>
		</TD>
		<TD WIDTH="99%" CLASS="fright">
			<INPUT name="file" type="file" size="60" {tip text="Enter path to file or click 'Browse' button" trigger="file"}>
		</TD>
	</TR>
	<TR CLASS="LIGHT">
		<TD CLASS="FBOTTOMU" COLSPAN="3" ALIGN="RIGHT">
			 <A HREF="javascript:Send();" accesskey="s">{t}Send message{/t} <IMG SRC="img/save.gif" ALT=""></A>
		</TD>
	</TR>
</TABLE>
</FORM>
<SCRIPT>
<!--
document.forms['mailing'].elements['mailing[sender]'].focus();
//-->
</SCRIPT>
