{extends file="layout.html"}
{block name=title}LMS: {$layout.pagetitle|striphtml}{/block}
{block name=module_content}
<!--// $Id$ //-->
<H1>{$layout.pagetitle}</H1>
<P><FORM name="domainadd" method="POST" action="?m=domainadd">
<INPUT type="submit" class="hiddenbtn">
<TABLE class="lmsbox">
    <THEAD>
	<TR>
		<TD width="1%">
			<IMG src="img/domain.gif" alt="">
		</TD>
		<TD width="150" align="left" NOWRAP>
			<B>{trans("Domain:")}</b>
		</TD>
		<TD width="98%" NOWRAP>
			<INPUT type="text" name="domainadd[name]" value="{$domainadd.name}" required {tip text="Enter domain name" trigger="name"} size="20">
		</TD>
	</TR>
    </THEAD>
    <TBODY>
	<TR>
    		<TD width="1%">
            		<img src="img/customer.gif" alt="">
	        </TD>
		<TD width="1%">
			<B>{trans("Owner:")}</B>
		</TD>
		<TD width="98%"class="fright">
			<SELECT SIZE="1" NAME="domainadd[ownerid]" {tip text="Select owner or 'SYSTEM DOMAIN' if you don't want to assign it to any customer" trigger="ownerid"}>
				<OPTION VALUE="0"{if !$domainadd.ownerid} SELECTED{/if}>{trans("SYSTEM DOMAIN")}</OPTION>
				{foreach from=$customers item=customer}
				<OPTION VALUE="{$customer.id}"{if $domainadd.ownerid == $customer.id} SELECTED{/if}>{$customer.customername|truncate:40:"&hellip;":true} ({$customer.id|string_format:"%04d"})</OPTION>
				{/foreach}
			</SELECT>
		</TD>
	</TR>
	<TR>
                <TD width="1%">
                        <img src="img/dns.gif" alt="">
                </TD>
                <TD width="1%" nowrap><B>{trans("Type:")}</B></TD>
                <TD width="98%">
                <SELECT  SIZE="1" NAME="domainadd[type]" {tip text="Select domain type" trigger="type"} id="domainadd[type]" style="float:left;" onchange=" if (this.value=='SLAVE') showslave(); else hideslave();" >
                                <OPTION VALUE="NATIVE" {if $domainadd.type == NATIVE} SELECTED{/if}>NATIVE</OPTION>
                                <OPTION VALUE="MASTER" {if $domainadd.type == MASTER} SELECTED{/if}>MASTER</OPTION>
                                <OPTION VALUE="SLAVE" {if $domainadd.type == SLAVE} SELECTED{/if}>SLAVE</OPTION>
                 </SELECT>
                   <div id="ipmaster" style="display: none; float:left; margin-left:10px;">
                           {trans("IP address of master NS:")}
                   <input type="text" name="domainadd[master]" value="{$domainadd.master}"  {tip text="Enter IP address of master NS" trigger="master" bold="1"}>
	           </div>
                </TD>
        </TR>
	<TR id="ipwebserver">
                <TD width="1%">
                        <img src="img/dns.gif" alt="">
                </TD>
                <TD width="1%" nowrap><B>{trans("IP address of webserver")}:</B></TD>
                <TD width="98%">
		<INPUT type="text"   name="domainadd[ipwebserver]" value="{$domainadd.ipwebserver}" {tip text="Enter IP address of webserver" trigger="ipwebserwer"} size="20">

                </TD>
        </TR>
	<TR id="ipmailserver">
                <TD width="1%">
                        <img src="img/dns.gif" alt="">
                </TD>
                <TD width="1%" nowrap><B>{trans("IP address of mailserver")}:</B></TD>
                <TD width="98%">
		<INPUT type="text"   name="domainadd[ipmailserver]" value="{$domainadd.ipmailserver}" {tip text="Enter IP address of mailserver" trigger="ipmailserwer"} size="20">

                </TD>
        </TR>
	<TR>
		<TD width="1%">
			<img src="img/mail.gif" alt="">
		</TD>
		<TD width="1%" nowrap>
			<B>{trans("Backup MX support:")}</B>
		</TD>
		<TD width="98%">
			<INPUT type="checkbox" name="domainadd[mxbackup]" value="1"{if $domainadd.mxbackup} checked{/if}>
		</TD>
	</TR>
	<TR>
		<TD width="1%">
			<IMG src="img/info.gif" alt="">
		</TD>
		<TD width="1%" align="left">
			<b>{trans("Description:")}</b>
		</TD>
		<TD width="98%">
			<TEXTAREA name="domainadd[description]" rows="5" cols="50" {tip text="Enter additional information (optional)"}>{$domainadd.description}</TEXTAREA>
		</TD>
	</TR>
	<TR>
		<TD colspan="3" align="right" NOWRAP>
			<A href="javascript: document.domainadd.submit();">{trans("Submit")} <IMG SRC="img/save.gif" alt=""></A>
			<A href="?m=domainlist">{trans("Cancel")} <IMG SRC="img/cancel.gif" alt=""></A><BR>
			<INPUT type="checkbox" name="domainadd[reuse]" id="reuse" value="ON" {if $domainadd.reuse}checked{/if}> <label for="reuse">{trans("Display this form again, when this domain is saved")}</label>
		</TD>
	</TR>
    </TBODY>
</TABLE>
</FORM>
<script type="text/javascript">
<!--
function showslave() {
	document.getElementById('ipmaster').style.display = "block";
	document.getElementById('ipwebserver').style.display = "none";
	document.getElementById('ipmailserver').style.display = "none";
}

function hideslave() {
	document.getElementById('ipmaster').style.display = "none";
	document.getElementById('ipwebserver').style.display = '';
	document.getElementById('ipmailserver').style.display = '';
}

$(function() {
	$('form[name="domainadd"] [name="domainadd[name]"]').focus();
});

if (document.getElementById('domainadd[type]').value == 'SLAVE')
	showslave();
//-->
</script>
{/block}
