<script type="text/javascript"> 
{include file="$incpath/other/validate_js.tpl"}
<!-- //
$.validator.setDefaults({ldelim}
	submitHandler: function() 
	{ldelim}
		document.forms['kform'].submit();
	{rdelim}
{rdelim});

$().ready(function() 
{ldelim}
	$("#kform").validate(
	{ldelim}
		rules: 
		{ldelim}
				E_Titel1: {ldelim}required: true{rdelim},
				E_Anlage: {ldelim}required: true,range:[0,10]{rdelim},
				E_Email: {ldelim}required: true, email:true{rdelim}
				{if $new==1}
				,Name1: {ldelim}required: true{rdelim}
				{/if}
		{rdelim}, 
		messages: 
		{ldelim}
		{rdelim}
	{rdelim});
{rdelim});
// -->
</script>


<div class="popbox">
<div class="header">{if $new==1}{#ContactForms_new#}{else}{#ContactFormEdit#}{/if}</div>



<form method="post" name="kform" id="kform" autocomplete="off" action="">
<div class="subheaders"><strong>{#Global_props#}</strong></div>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
  <tr>
    <td width="180" class="row_left">{#Global_Name#} ({$language_long_1})</td>
    <td class="row_right"><input style="width:200px" class="input" type="text" name="E_Titel1" value="{$res->Titel1|koobispecialchars}" /></td>
  </tr>
  <tr>
    <td class="row_left">{#Global_Name#} ({$language_long_2})</td>
    <td class="row_right"><input style="width:200px" class="input" type="text" name="E_Titel2" value="{$res->Titel2|koobispecialchars}" /></td>
  </tr>
  <tr>
    <td class="row_left">{#Global_Name#} ({$language_long_3})</td>
    <td class="row_right"><input style="width:200px" class="input" type="text" name="E_Titel3" value="{$res->Titel3|koobispecialchars}" /></td>
  </tr>
  <tr>
    <td class="row_left">{#Global_Active#}</td>
    <td class="row_right">
    <label><input type="radio" name="E_Aktiv" value="1" {if $res->Aktiv == 1 || $new==1} checked="checked"{/if}/>{#Yes#}</label>
    <label><input type="radio" name="E_Aktiv" value="0" {if $res->Aktiv == 0 && $new!=1} checked="checked"{/if}/>{#No#}</label>    </td>
  </tr>
  <tr>
    <td class="row_left">{#ContactForms_allowedAtt#}</td>
    <td class="row_right"><input name="E_Anlage" type="text" class="input" style="width:40px" value="{$res->Anlage|default:0}" maxlength="2" /></td>
  </tr>
  <tr>
    <td class="row_left">
    <span {popup sticky=$config_vars.POPSTICKY   width=400 text=$config_vars.ContactForms_emailInf}><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span>
    {#Global_Email#}</td>
    <td class="row_right"><input style="width:200px" class="input" type="text" name="E_Email" value="{$res->Email|koobispecialchars}" /></td>
  </tr>
  <tr>
    <td class="row_left">
    <span {popup sticky=$config_vars.POPSTICKY   width=400 text=$config_vars.ContactForms_groupsInf}><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span>
    {#Groups_Name#}</td>
    <td class="row_right">
    <select name="E_Gruppen[]" size="5" multiple="multiple" class="input" style="width:200px">
    {foreach from=$groups item=g}
     <option value="{$g->Id}" {if $new==1}selected="selected"{else}{if in_array($g->Id,$res->Groups)}selected="selected"{/if}{/if}>{$g->Name_Intern|koobispecialchars}</option>
    {/foreach}
    </select>
    </td>
  </tr>
</table>

{if $new!=1}
<br />

<div class="subheaders"><strong>{#ContactFormFEdit#}</strong></div>
  <table width="100%" border="0" cellspacing="0" cellpadding="3">
    <tr class="headers">
      <td class="headers">{#ContactFormFt#} ({$language_long_1})</td>
      <td class="headers">{$language_long_2}</td>
      <td class="headers">{$language_long_3}</td>
      <td class="headers">{#Global_Type#}</td>
      <td nowrap="nowrap" class="headers">{#Global_Values#} <span {popup sticky=$config_vars.POPSTICKY   width=400 text=$config_vars.ContactForms_valInf}><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span></td>
      <td nowrap="nowrap" class="headers">{#Global_Must#} <span {popup sticky=$config_vars.POPSTICKY   width=400 text=$config_vars.ContactForms_mustInf}><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span></td>
      <td nowrap="nowrap" class="headers">{#ContactForms_number#} <span {popup sticky=$config_vars.POPSTICKY   width=400 text=$config_vars.ContactForms_numInf}><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span></td>
      <td nowrap="nowrap" class="headers">{#ContactForms_email#} <span {popup sticky=$config_vars.POPSTICKY   width=400 text=$config_vars.ContactForms_mailInf}><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span></td>
      <td class="headers">{#Global_Position#}</td>
      <td align="center" class="headers"><input {popup sticky=$config_vars.POPSTICKY  text=$config_vars.Global_SelAll}  name="allbox" type="checkbox" id="d" onclick="selall();" value="" /></td>
    </tr>
    {foreach from=$fields item=c}
  	<tr class="{cycle name=$cna values='second,first'}">
      <td><input class="input" style="width:120px" name="Name1[{$c->Id}]" type="text" value="{$c->Name1|koobispecialchars}"></td>
      <td><input class="input" style="width:120px" name="Name2[{$c->Id}]" type="text" value="{$c->Name2|koobispecialchars}"></td>
      <td><input class="input" style="width:120px" name="Name3[{$c->Id}]" type="text" value="{$c->Name3|koobispecialchars}"></td>
      <td>
        <select class="input" style="width:120px" name="Typ[{$c->Id}]" id="Typ[{$c->Id}]">
      <option value="textfield" {if $c->Typ=='textfield'} selected="selected"{/if}>{#ContactForms_tfo#}</option>
      <option value="textarea" {if $c->Typ=='textarea'} selected="selected"{/if}>{#ContactForms_tfm#}</option>
      <option value="dropdown" {if $c->Typ=='dropdown'} selected="selected"{/if}>{#ContactForms_dd#}</option>
      <option value="checkbox" {if $c->Typ=='checkbox'} selected="selected"{/if}>{#ContactForms_chb#}</option>
      <option value="radio" {if $c->Typ=='radio'} selected="selected"{/if}>{#ContactForms_rad#}</option> 
	</select>      
    </td>
      <td><input class="input" style="width:180px" name="Werte[{$c->Id}]" type="text" id="Werte{$c->Id}" value="{$c->Werte}"></td>
      <td>
      <select  class="input" style="width:50px"  name="Pflicht[{$c->Id}]">
      <option value="1" {if $c->Pflicht == 1} selected="selected"{/if}>{#Yes#}</option>
      <option value="0" {if $c->Pflicht == 0} selected="selected"{/if}>{#No#}</option>
      </select>     
      </td>
      <td>
      <select  class="input" style="width:50px"  name="Zahl[{$c->Id}]">
      <option value="1" {if $c->Zahl == 1} selected="selected"{/if}>{#Yes#}</option>
      <option value="0" {if $c->Zahl == 0} selected="selected"{/if}>{#No#}</option>
      </select>      
      </td>
      <td>
      <select  class="input" style="width:50px"  name="Email[{$c->Id}]">
      <option value="1" {if $c->Email == 1} selected="selected"{/if}>{#Yes#}</option>
      <option value="0" {if $c->Email == 0} selected="selected"{/if}>{#No#}</option>
      </select>      
      </td>
      <td><input name="Posi[{$c->Id}]" type="text" class="input" value="{$c->Posi}" size="2" maxlength="2"></td>
  	  <td><input {popup sticky=$config_vars.POPSTICKY  width=200 text=$config_vars.DelInfChekbox}  name="del[{$c->Id}]" type="checkbox"  value="1"></td>
  	</tr>
    {/foreach}
  </table>
<input type="submit" class="button big" value="{#Global_Save_Del#}" />
<input name="save" type="hidden" id="save" value="1" />
</form>
<br />
<br />
{/if}

<div class="subheaders"><strong>{#ContactForms_newfield#}</strong></div>

<form method="post" action="">

<table width="100%" border="0" cellspacing="0" cellpadding="3">
    <tr class="headers">
      <td class="headers">{#ContactFormFt#} ({$language_long_1})</td>
      <td class="headers">{$language_long_2}</td>
      <td class="headers">{$language_long_3}</td>
      <td class="headers">{#Global_Type#}</td>
      <td nowrap="nowrap" class="headers">{#Global_Values#} <span {popup sticky=$config_vars.POPSTICKY   width=400 text=$config_vars.ContactForms_valInf}><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span></td>
      <td nowrap="nowrap" class="headers">{#Global_Must#} <span {popup sticky=$config_vars.POPSTICKY   width=400 text=$config_vars.ContactForms_mustInf}><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span></td>
      <td nowrap="nowrap" class="headers">{#ContactForms_number#} <span {popup sticky=$config_vars.POPSTICKY   width=400 text=$config_vars.ContactForms_numInf}><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span></td>
      <td nowrap="nowrap" class="headers">{#ContactForms_email#} <span {popup sticky=$config_vars.POPSTICKY   width=400 text=$config_vars.ContactForms_mailInf}><img class="absmiddle" src="{$imgpath}/help.png" alt="" /></span></td>
      <td class="headers">{#Global_Position#}</td>
      </tr>
  	<tr class="second">
      <td><input name="Name1" type="text" class="input" id="Name1" style="width:120px" value="{#ContactForms_ndef#}"></td>
      <td><input name="Name2" type="text" class="input" id="Name2" style="width:120px" value="{#ContactForms_ndef#}"></td>
      <td><input name="Name3" type="text" class="input" id="Name3" style="width:120px" value="{#ContactForms_ndef#}"></td>
      <td>
        <select class="input" style="width:120px" name="Typ" id="Typ">
      <option value="textfield" >{#ContactForms_tfo#}</option>
      <option value="textarea" {if $new==1}selected="selected"{/if}>{#ContactForms_tfm#}</option>
      <option value="dropdown">{#ContactForms_dd#}</option>
      <option value="checkbox">{#ContactForms_chb#}</option>
      <option value="radio">{#ContactForms_rad#}</option> 
	</select>    </td>
      <td><input class="input" style="width:180px" name="Werte" type="text"></td>
      <td>
      <select  class="input" style="width:50px"  name="Pflicht">
      <option value="1"  {if $new==1}selected="selected"{/if}>{#Yes#}</option>
      <option value="0"  {if $new!=1}selected="selected"{/if}>{#No#}</option>
      </select>      </td>
      <td>
      <select  class="input" style="width:50px"  name="Zahl">
      <option value="1">{#Yes#}</option>
      <option value="0" selected="selected">{#No#}</option>
      </select>      </td>
      <td>
      <select  class="input" style="width:50px"  name="Email">
      <option value="1">{#Yes#}</option>
      <option value="0" selected="selected">{#No#}</option>
      </select>      </td>
      <td><input name="Posi" type="text" class="input" value="{$c->Posi|default:1}" size="2" maxlength="2"></td>
  	  </tr>
  </table>
<input type="submit" class="button big" value="{#Save#}" {if $new==1}onclick="window.opener.location.reload();"{/if} />
<input type="button" onclick="window.close();" class="button big" value="{#Close#}" />
<input name="new" type="hidden" value="1" />
</form>
</div>
