{***********************************}
{******* $name must be set!! *******}
{******* $control must be set!! *******}

{if !$id}
	{assign var=id value=".:id:."}
{/if}

{********
	$loadingStage= true means then we are being called from a loader script, and a "load-object" was issued, as opposed to "create-object" from JS
**************}
{if $loadingStage}
	{assign var=source value=$fieldAttributes.list|@arraySortLike:$data[$name]:false}
	{assign var=ignoreKey value=true}
{else}
	{assign var=source value=$fieldAttributes.list}
	{assign var=ignoreKey value=false}
{/if}

<div id="container_{$control}_{$name}">
	<div style="height: 16px;">
		<a
			href="#;"
			class="icon-reload"
			onclick="updateAttribtuesVisibility(this);return false;"
			tooltip="{$_LANG.DTM.tpl.controls.sortable2.reload}"
		></a>
	</div>

	{foreach from=$source key=key item=item}
		{if $ignoreKey}
			{assign var=key value=$item}
		{/if}

		<div
			id="div_{$control}_{$name}_{$key}_"
			class="item_sortable order_{$key}"
			onmouseover="switchClasses(this,'','item_hover',true);"
			onmouseout ="switchClasses(this,'','item_hover',false);"
			{strip2}
				style="
					{if $fieldAttributes.style=='floats'}
						float:left;
						padding-right: 15px;
					{elseif $fieldAttributes.style=='ordered'}
						float:left;
						padding-right:5px;
						width:50px;
					{elseif $fieldAttributes.style=='multiline'}

					{/if}
				"
			{/strip2}
		>

			{************* hidden stuff ****************}
			<input
				type="hidden"
				id="{$name}_{$key}_"
				name="{$control}{$id}[{$name}][{$key}]"
				value="{$key}"
			/>

			{********** float stuff (icons) ************}
			<div style="float:right">
				{literal}
				<table cellpadding="0" cellspacing="0">
					<tr>
						<td>
							<a
								href="#"
								class="icon-arrowsUp"
								onclick="moveSortableUp($(this).up('div',2),$(this).up('div',1));this.blur();return false;"
							></a>
						</td>
						<td>
							<a
								href="#"
								class="icon-arrowsDown"
								onclick="moveSortableDown($(this).up('div',2),$(this).up('div',1));this.blur();return false;"
							></a>
						</td>
					</tr>
				</table>
				{/literal}
			</div>

			{*********** the real displayed data goes here ************}
			{if $fieldAttributes.extra.type=='checkbox'}
				<input
					type="checkbox"
					name="{$control}{$id}[{$fieldAttributes.extra.name}][{$key}]"
					id="{$fieldAttributes.extra.name}_{$key}_"
					value="{$item}"
					class="noBorder"
					onclick="toggleColumnSettings(this, $F(this));"

					{if $data[$fieldAttributes.extra.name][$key]}
						checked="checked"
					{else}
					{/if}
				/>
				<label onclick="emulateLabel_for('{$fieldAttributes.extra.name}_{$key}_',this,event);">{$LANG[$key]|default:$item}</label>
			{else}
				{$LANG[$key]|default:$item}
			{/if}
		</div>
	{/foreach}

	<script type="text/javascript">

	</script>
</div>