{{function name="selectOptions" aOptions=0 mOption=0}}
	{{foreach from=$aOptions item=sOption}}
		<option value="{{$sOption@key}}" {{if ( is_array( $mOption ) && in_array( $sOption@key, $mOption ) ) || ( isset( $mOption ) && $sOption@key == $mOption )}}selected="selected"{{/if}}>{{$sOption}}</option>
	{{/foreach}}
{{/function}}

<script type="text/javascript">
	$(document).ready(function(){
		{{if isset( $smarty.get.activeTabId )}}$('ul.tab-headers li a[href="#{{$smarty.get.activeTabId}}"]').trigger('click');{{/if}}
	});
</script>

<div class="tabbed">
	<div class="clear"></div>
	<ul class="tab-headers">
		<li><a href="#attribute">{{$lang.Edit_attrib}}</a></li>
		{{if $aAttribute.iAttribute}}
			<li><a href="#attribute_values">{{$lang.Attribute_values}}</a></li>
			<li><a href="#attribute_values_groups">{{$lang.Attribute_values_groups}}</a></li>
		{{/if}}
	</ul>
	<h1>{{$lang.Edit_attrib}} "{{$aAttribute.sName}}"</h1>
	<div class="tab" id="attribute">
		<h2>{{$lang.Attribute}}</h2>
		<form action="?p={{$aActions.f}}-form&iAttribute={{$aAttribute.iAttribute}}" method="post">
			<table class="details" id="attribute">
				<thead>
					<tr><th colspan="3"><h2>{{$lang.Edit_attrib}} "{{$aAttribute.sName}}"</h2></th></tr>
				</thead>
				<tbody>
					<tr><th class="name">{{$lang.Name}}</th><td class="value"><input type="text" name="sName" value="{{$aAttribute.sName}}" /></td><td class="help">&nbsp;</td></tr>
					<tr>
						<th class="name">{{$lang.Alt_values}}</th>
						<td class="value"><textarea name="sAltValues" cols="80" rows="5">{{$aAttribute.sAltValues}}</textarea></td>
						<td class="help"><img class="tTip info" src="templates/images/info.png"  title="{{$lang.help_Alt_values}}" /></td>
					</tr>
					<tr>
						<th class="name">{{$lang.Replace_alt_values}}</th>
						<td class="value"><input type="checkbox" name="iReplaceAltValues" value="1" /></td>
						<td class="help"><img class="tTip info" src="templates/images/info.png"  title="{{$lang.help_Replace_alt_values}}" /></td>
					</tr>
					<tr>
						<th class="name">{{$lang.Position}}</th>
						<td><input type="text" name="iPosition" value="{{$aAttribute.iPosition}}" /></td>
						<td class="help"><img class="tTip info" src="templates/images/info.png"  title="{{$lang.help_attribute_position}}" /></td>
					</tr>
					<tr>
						<th class="name">{{$lang.Type}}</th>
						<td><select name="iType">{{foreach from=$aAttributesTypes item=sAttributeType}}<option value="{{$sAttributeType@key}}" {{if $sAttributeType@key == $aAttribute.iType}}selected="selected"{{/if}}>{{$sAttributeType}}</option>{{/foreach}}</select></td>
						<td class="help"><img class="tTip info" src="templates/images/info.png"  title="{{$lang.help_Type}}" /></td>
					<tr>
						<th class="name">{{$lang.FilterVisible}}</th>
						<td>
							<select name="iFilterVisible">
								{{selectOptions aOptions=[-1 => $lang['FilterVisible-1'], 0 => $lang['FilterVisible0'], 1 => $lang['FilterVisible1']] mOption=$aAttribute.iFilterVisible}}
							</select>
						</td>
						<td>&nbsp;</td></tr>
					<tr>
						<th class="name">{{$lang.BasketVisible}}</th>
						<td><input type="hidden" name="iBasketVisible" value="0"/><input type="checkbox" name="iBasketVisible" value="1" {{if $aAttribute.iBasketVisible}}checked="checked"{{/if}} /></td>
						<td class="help"><img class="tTip info" src="templates/images/info.png"  title="{{$lang.help_iBasketVisible}}" /></td>
					</tr>
					<tr>
						<th class="name">{{$lang.ProductListVisible}}</th>
						<td><input type="hidden" name="iProductListVisible" value="0"/><input type="checkbox" name="iProductListVisible" value="1" {{if $aAttribute.iProductListVisible}}checked="checked"{{/if}} /></td>
						<td class="help">{{*<img class="tTip info" src="templates/images/info.png"  title="{{$lang.help_iProductListVisible}}" />*}}</td>
					</tr>
					<tr class="actions">
						<td class="save" colspan="3"><input type="submit" class="submit" value="&laquo; {{$lang.return}}"  onclick="location.href = '?p=attributes-list'; return false;"> <input type="submit" value="{{$lang.Save}}" class="submit" /></td>
					</tr>
				</tbody>
			</table>
		</form>
	</div>
	{{if $aAttribute.iAttribute}}
		<div class="tab" id="attribute_values">
			<h2>{{$lang.Attribute_values}}</h2>
			<a href="?p={{$aActions.f}}-form_value&amp;iAttribute={{$aAttribute.iAttribute}}" class="new_element">{{$lang.New_attribute_value}}</a>
			<form action="?p=attributes-update_pos&amp;iAttribute={{$aAttribute.iAttribute}}" method="post">
				<table class="list" id="attribute-values">
					<thead>
						<tr><th class="id">{{$lang.Id}}</th><th class="name">{{$lang.Name}}</th><th class="position">{{$lang.Position}}</th><th class="actions">{{$lang.Actions}}</th></tr>
					</thead>
					<tfoot>
						<tr class="actions">
							<td class="save" colspan="4"><input type="submit" value="{{$lang.Save}}" class="submit" /></td>
						</tr>
					</tfoot>
					<tbody>
						{{foreach from=$aAttribute.aValues item=aValue}}
							<tr>
								<td class="id">{{$aValue.iAttributeValue}}</td>
								<td class="name"><a href="?p={{$aActions.f}}-form_value&amp;iAttributeValue={{$aValue.iAttributeValue}}&amp;iAttribute={{$aAttribute.iAttribute}}">{{$aValue.sValue}}</a></td>
								<td class="position"><input type="text" name="aPositions[{{$aValue.iAttributeValue}}]" value="{{$aValue.iPosition}}" /></td>
								<td class="actions">
									<a href="?p={{$aActions.f}}-form_value&amp;iAttributeValue={{$aValue.iAttributeValue}}&amp;iAttribute={{$aAttribute.iAttribute}}"><img src="{{$config.dir_templates}}admin/images/ico/edit.png" alt="{{$lang.Edit}}" title="{{$lang.Edit}}" /></a>
									<a href="?p={{$aActions.f}}-delete_value&amp;iAttributeValue={{$aValue.iAttributeValue}}&amp;iAttribute={{$aAttribute.iAttribute}}" class="delete" onclick="return del( );"><img src="{{$config.dir_templates}}admin/images/ico/delete.png" alt="{{$lang.Delete}}" title="{{$lang.Delete}}"/></a>
								</td>
							</tr>
						{{/foreach}}
					</tbody>
				</table>
			</form>
		</div>
		<div class="tab" id="attribute_values_groups">
			<h2>{{$lang.Attribute_values_groups}}</h2>
			<a class="new_element" href="?p={{$aActions.f}}-form_values_group&amp;iAttribute={{$aAttribute.iAttribute}}">{{$lang.New_attribute_values_group}}</a>
			<form action="?p=attributes-values_groups_update_pos&amp;iAttribute={{$aAttribute.iAttribute}}" method="post">
				<table class="list" id="attribute-values-groups">
					<thead>
						<tr>
							<th class="id">{{$lang.Id}}</th>
							<th class="name">{{$lang.Name}}</th>
							<th class="position">{{$lang.Position}}</th>
							<th class="actions">{{$lang.Actions}}</th></tr>
					</thead>
					<tfoot>
						<tr class="actions">
							<td class="save" colspan="4"><input type="submit" value="{{$lang.Save}}" class="submit" /></td>
						</tr>
					</tfoot>
					<tbody>
						{{foreach from=$aAttribute.aValuesGroups item=aValuesGroup}}
							<tr>
								<td class="id">{{$aValuesGroup.iFilterGroup}}</td>
								<td class="name">{{$aValuesGroup.sValue}}</td>
								<td class="position"><input type="text" name="aPositions[{{$aValuesGroup.iFilterGroup}}]" value="{{$aValuesGroup.iPosition}}" /></td>
								<td class="actions">
									<a href="?p={{$aActions.f}}-form_values_group&amp;iFilterGroup={{$aValuesGroup.iFilterGroup}}"><img src="{{$config.dir_templates}}admin/images/ico/edit.png" alt="{{$lang.Edit}}" title="{{$lang.Edit}}" /></a>
									<a href="?p={{$aActions.f}}-delete_values_group&amp;iFilterGroup={{$aValuesGroup.iFilterGroup}}" class="delete" onclick="return del( );"><img src="{{$config.dir_templates}}admin/images/ico/delete.png" alt="{{$lang.Delete}}" title="{{$lang.Delete}}"/></a>
								</td>
							</tr>
						{{/foreach}}
					</tbody>
				</table>
			</form>
		</div>
	{{/if}}
</div>
<div class="clear"></div>