<!--PROPERTIES SETUP-->
<table border=0 cellspacing=0 cellpadding=5 width="100%">
	<tr class="table_header">
		<td class="main_header_text" align="left" colspan="10">
			{$lang.forms.control_type}:&nbsp;{$lang.forms.$type}
		</td>
	</tr>
	{if $type=='checkbox'}
		<tr class="even">
			<td class="main_content_text" width="240px">
				{$lang.forms.default_status}:
			</td>
			<td class="main_content_text" align="left">
				<input type="checkbox" name="def_value" {if $attr.setup.def_value==1}checked{/if}>
			</td>
		</tr>
	{/if}
	{if $type=='text'}
		<tr class="odd">
			<td class="main_content_text" width="240px">
				{$lang.forms.default_value}:
			</td>
			<td align="right">
				<input type="text" name="def_value" value="{$attr.setup.def_value}" style="width:200px">
			</td>
		</tr>
		<tr class="even">
			<td class="main_content_text">
				{$lang.forms.max_len}:
			</td>
			<td align="right">
				<input type="text" name="max_len" {if isset($attr)==true} value="{$attr.setup.max_len}" {else} value="20" {/if} style="width:40px">
			</td>
		</tr>
		<tr class="odd">
			<td class="main_content_text">
				{$lang.forms.ass_reg_exp}:
			</td>
			<td class="main_content_text" align="right">
				<select name="reg_exp" style="width: 200px">
					{foreach from=$regs name=s item=reg key=id_reg}
						<option value="{$id_reg}" {if $attr.setup.reg_exp==$id_reg}selected{/if}>{$reg.name}</option>
					{/foreach}
				</select>
			</td>
		</tr>
	{/if}
	{if $type=='select'}
		<tr class="even">
			<td class="main_content_text" width="150px" style="height:30px">
				{$lang.forms.choose_ds}:
			</td>
			<td>
				{if $attr.is_const=='Y'} <input type="hidden" name="datasource" value="{$attr.setup.datasource}">{/if}
				<select name="datasource" style="width:200px" onchange="javascript: GetDsValues(this.value)" {if $attr.is_const=='Y'} disabled{/if}>
					<option value="-1">{$lang.forms.create_ds}</option>
					{section name=s loop=$ds}
						<option value="{$ds[s].id}" {if $attr.setup.datasource==$ds[s].id}selected{/if}>{if $ds[s].type=='fixed'}{assign var=lang_ref value=$ds[s].name}{$lang.admin_menu.$lang_ref}{else}{$ds[s].name}{/if}</option>
					{/section}
				</select>
			</td>
			<td rowspan="5" width="115px">
				<input name="s_data" type="hidden" value="{$s_data}">
				<div id="values_div" style="width: 115px">
					<select name="values" multiple size="10" style="width:110px">
						{section name=p loop=$attr.setup.values}
							<option value="{$attr.setup.values[p].id}">{$attr.setup.values[p].name}</option>
						{/section}
					</select>
				</div>
			</td>
		</tr>
		<tr class="odd">
			<td class="main_content_text" width="150px"  style="height:30px">
				{$lang.forms.new_value}:
			</td>
			<td>
				<input type="text" name="new_value" value="" style="width:200px">
			</td>
		</tr>
		<tr class="even">
			<td class="main_content_text" colspan="2" valign="top" align="left">
				<input type="button" name="add_btn" value="{$lang.button.add}" class="button" onclick="javascript: addElement();">&nbsp;
				<input type="button" name="del_btn"  value="{$lang.button.delete}" class="button" onclick="javascript: delElement();">&nbsp;
				<input type="button" name="mu_btn"  value="{$lang.button.up}" class="button" onclick="javascript: moveUp();">&nbsp;
				<input type="button" name="md_btn"  value="{$lang.button.down}" class="button" onclick="javascript: moveDown();">
			</td>
		</tr>
		<tr class="odd">
			<td class="main_content_text">
				{$lang.forms.appearance}:
			</td>
			<td class="main_content_text">
				<select name="select_type" style="width:200px" onchange="DisableListboxSetup(this.value)">
					<option value="dropdown" {if $attr.setup.select_type=='dropdown'}selected{/if}>{$lang.forms.dropdown}</option>
					<option value="listbox" {if $attr.setup.select_type=='listbox'}selected{/if}>{$lang.forms.listbox}</option>
					<option value="boxes" {if $attr.setup.select_type=='boxes'}selected{/if}>{$lang.forms.boxes}</option>
					<option value="radio" {if $attr.setup.select_type=='radio'}selected{/if}>{$lang.forms.radio}</option>
				</select>
			</td>
		</tr>
		<tr class="even">
			<td class="main_content_text" colspan="2">
				{$lang.forms.size}:&nbsp;<input type="text" style="width:30px" name="vsize" {if $attr.setup.select_type=='dropdown' || isset($attr)==false}disabled value="4" {else} value="{$attr.setup.vsize}" {/if}>&nbsp;
				{$lang.forms.multiple}&nbsp;<input type="checkbox" name="is_mult" {if $attr.setup.select_type=='dropdown' || isset($attr)==false}disabled{/if} {if $attr.setup.is_mult==1}checked{/if}>
			</td>
		</tr>
	{/if}
	{if $type=='textarea'}
		<tr class="odd">
			<td class="main_content_text" width="240px">
				{$lang.forms.default_value}:
			</td>
			<td align="right">
				<textarea name="def_value" style="width:200px">{$attr.setup.def_value}</textarea>
			</td>
		</tr>
		<tr class="even">
			<td class="main_content_text">
				{$lang.forms.ass_reg_exp}:
			</td>
			<td class="main_content_text" align="right">
				<select name="reg_exp" style="width: 200px">
					{foreach from=$regs name=s item=reg key=id_reg}
						<option value="{$id_reg}" {if $attr.setup.reg_exp==$id_reg}selected{/if}>{$reg.name}</option>
					{/foreach}
				</select>
			</td>
		</tr>
	{/if}
	{if $type=='password'}
		<tr class="odd">
			<td class="main_content_text" width="240px">
				{$lang.forms.ass_reg_exp}:
			</td>
			<td class="main_content_text" align="right">
				<select name="reg_exp" style="width: 200px">
					{foreach from=$regs name=s item=reg key=id_reg}
						<option value="{$id_reg}" {if $attr.setup.reg_exp==$id_reg}selected{/if}>{$reg.name}</option>
					{/foreach}
				</select>
			</td>
		</tr>
	{/if}
	{if $type=='file'}
		<tr class="even">
			<td class="main_content_text" width="240px">
				{$lang.forms.file_type}:
			</td>
			<td class="main_content_text" align="right">
				<select name="f_type" style="width:200px">
					<option value="image" {if $attr.setup.f_type=='image'}selected{/if}>{$lang.forms.image}</option>
					<option value="video" {if $attr.setup.f_type=='video'}selected{/if}>{$lang.forms.video}</option>
					<option value="audio" {if $attr.setup.f_type=='audio'}selected{/if}>{$lang.forms.audio}</option>
				</select>
			</td>
		</tr>
		<tr class="odd">
			<td class="main_content_text">
				{$lang.forms.max_size}:
			</td>
			<td class="main_content_text" align="right">
				<input type="text" name="max_size" value="{$attr.setup.max_size}" style="width:200px">
			</td>
		</tr>
	{/if}
	{if $type=='date'}
		<tr class="even">
			<td class="main_content_text" width="240px">
				{$lang.forms.age_limit}:
			</td>
			<td class="main_content_text" align="center">
				{$lang.forms.from}&nbsp;<input type="text" name="min_age" value="{$attr.setup.min_age}" style="width:50px">&nbsp;
				{$lang.forms.to}&nbsp;<input type="text" name="max_age" value="{$attr.setup.max_age}" style="width:50px">
			</td>
		</tr>
	{/if}
	{if $type=='text_range'}
		<tr class="odd">
			<td class="main_content_text">
				{$lang.forms.no_params}
			</td>
		</tr>
	{/if}
	{if $type=='place'}
		<tr class="even">
			<td class="main_content_text">
				{$lang.forms.no_params}
			</td>
		</tr>
	{/if}
</table>
<!--/PROPERTIES SETUP-->

<table border=0 cellspacing=0 cellpadding=5 width="100%">
	<tr class="table_header">
		<td class="main_header_text" align="left" colspan="10">
			{$lang.forms.search_setup}
		</td>
	</tr>
<!--SEARCH SETUP-->
	{if $type=='text' || $type=='text_range'}
		<tr class="even">
			<td align="left" class="main_content_text" width="240px">
				{$lang.forms.ass_type}:
			</td>
			<td align="center" class="main_content_text">
				<input type="radio" name="ass_type" value="value" {if $act=='new' || $attr.setup.assoc_type=='value'}checked{/if} onclick="javascript: LoadPossibleFields({$id_attr}, this.value, '{$type}', 'ass_field_div');">&nbsp;{$lang.forms.ass_value}&nbsp;
				<input type="radio" name="ass_type" value="age" {if $attr.setup.assoc_type=='age'}checked{/if} onclick="javascript: LoadPossibleFields({$id_attr}, this.value, '{$type}', 'ass_field_div');">&nbsp;{$lang.forms.ass_age}&nbsp;
				<input type="radio" name="ass_type" value="year" {if $attr.setup.assoc_type=='year'}checked{/if} onclick="javascript: LoadPossibleFields({$id_attr}, this.value, '{$type}', 'ass_field_div');">&nbsp;{$lang.forms.ass_year}&nbsp;
			</td>
		</tr>
	{/if}
	{if $type=='checkbox' || $type=='text' || $type=='select' || $type=='date' || $type=='text_range' || $type=='place'}
		<tr class="odd">
			<td align="left" class="main_content_text" width="240px">
				{$lang.forms.ass_field}:
			</td>
			<td align="right" class="main_content_text">
				<div id="ass_field_div">
					<select name="assoc_field" style="width: 200px;">
						<option value="-1">{$lang.forms.none}</option>
						{foreach name=s from=$ass_fields item=item key=key}
							<option value="{$key}" {if $attr.setup.assoc_field==$key}selected{/if}>{$item.field_name}</option>
						{/foreach}
					</select>
				</div>
			</td>
		</tr>
	{else}
		<tr class="even">
			<td class="main_content_text" align="left" colspan="10">
				{$lang.forms.no_search}
			</td>
		</tr>
	{/if}
<!--/SEARCH SETUP-->
</table>
<script language="javascript" type="text/javascript">

//If field determine gender disable listbox panel
var temp_id={if isset($max_ref)}{$max_ref+1}{else}0{/if};
{if $attr.setup.datasource==10 && $type=='select'}
	DisableListboxPanel(true);
{/if}
{if $type=='select' && $attr.setup.select_type!='listbox'}
	DisableListboxSetup('$attr.setup.select_type');
{/if}
</script>