<div id="variableEditorElement" style="display: none;">
	{****************************************************
	<script>
		function debug_show_variableEditorElement(){
			var control=Controls.getGlobal('focus');
			var lastFocus=Controls.getGlobal('targetInput');
			var value="invAddUserLastName";
			var textElement = null;
			if(control) {
				var attributesControls = control.child.getAttributesControls();
				var attributeName = null;

				if(lastFocus){
					textElement = attributesControls[$(lastFocus).identify()];
					attributeName = lastFocus;
				} else {
					textElement = $(attributesControls.text);
					attributeName = 'text';
				}
			}

			var variableEditor = new _variableEditor(value, { textElement: textElement, control: control, attributeName: attributeName });
			return variableEditor;
		}
	</script>
	****************************************************}

	<table id="functionAttributesContainer" cellpadding="0" cellspacing="0">
		<tr>
			<td colspan="3">
				<input
					id="variableEditor_text_"
					readonly="readonly" />

				<div id="variableEditor_status_"></div>
			</td>
			<td style="padding-left:32px;">
				<a href="#"
					class="closeContainer"
					tooltip="{$_LANG.DTM.functions.tooltips.close}"
					onclick="variableEditor.close(); return false;"
				>X</a>

				<a href="#"
					class="icon-add"
					tooltip="{$_LANG.DTM.functions.tooltips.add}"
					onclick="variableEditor.addFunction(); return false;"
				></a>
			</td>
		</tr>

		<tbody id="templateFunctionAttributes_.:index:._row" increment=".:index:." class="functionAttributesRow row.:cycle:.">
			<tr>
				<td class="dummy_counterContainer">
					.
				</td>
				<td class="dummy_selectContainer">
					<select
						name="functionAttributes[.:index:.][type]"
						id="functionAttributes_.:index:.__type_"
						class="dummy_select"
						onchange="variableEditor.changeFunction($(this).up('tbody'), this);"
						>
					</select>
				</td>
				<td class="dummy_paramsContainer">
					<div id="functionAttributes_.:index:.__params_">
						-
					</div>
				</td>
				<td class="dummy_optionsContainer">
					<div id="functionAttributes_.:index:.__operations_">
						<a href="#"
							class="icon-delete"
							onclick="variableEditor.removeFunction($(this).up('tbody'), this);return false;"
							tooltip="{$_LANG.DTM.functions.tooltips.deleteFunction}"
						></a>

						<a href="#"
							class="icon-arrowsDown"
							onclick="variableEditor.moveFunctionDown($(this).up('tbody'), this);return false;"
							tooltip="{$_LANG.DTM.functions.tooltips.moveFunctionDown}"
						></a>

						<a href="#"
							class="icon-arrowsUp"
							onclick="variableEditor.moveFunctionUp($(this).up('tbody'), this);return false;"
							tooltip="{$_LANG.DTM.functions.tooltips.moveFunctionUp}"
						></a>
					</div>
				</td>
			</tr>
		</tbody>
	</table>

	<script type="text/javascript">
		var APP_URL='{$APP_URL}';
		var LANG_noResults='{$_LANG.autocompleteNoResults}';

		Event.observe(document,'dom:loaded',function(){ldelim}
			// create the template factory
			templateFunctionAttributes = new _cloneFactory($('templateFunctionAttributes_.:index:._row'),
				{ldelim}
					'index' : {ldelim}	type:'int',		start:'1'	{rdelim},
					'cycle' : {ldelim}	type:'cycle',	start:'1',	values:	'1,2'{rdelim}
				{rdelim},{ldelim}bulkEval:false{rdelim});
			{rdelim});
	</script>

	<div style="display: none;">
		<div
			id="template_functionAttributes__"
			>
		</div>
		<select id="dummy_functionAttributes_">
			<option functionName="">-</option>
			{foreach from=$CFG.DTM.module.functionAttributes key=functionName item=functionAttributes}
			<option functionName="{$functionName}"
				value="{$functionName}"
				>{$_LANG.DTM.functions.names[$functionName]|default:$functionName}</option>
			{/foreach}
		</select>

		{foreach from=$CFG.DTM.module.functionAttributes key=functionName item=functionAttributes}
			<div
				id="template_functionAttributes_{$functionName}"
				functionName="{$functionName}"
				>

				{if $_LANG.DTM.functions.attributes[$functionName]}
					<a href="#"
						class="icon-infoBlue help"
						{if $_LANG.DTM.functions.attributes[$functionName]|@is_array}
							tooltip="<div style='white-space: nowrap;'>{foreach from=$_LANG.DTM.functions.attributes[$functionName] item=tooltip}{$tooltip}<br/>{/foreach}</div>";
						{else}
							tooltip="{$_LANG.DTM.functions.attributes[$functionName]}";
						{/if}
						onclick="return false;"
					></a>
				{/if}
				{if $functionAttributes.parameters}
					{foreach from=$functionAttributes.parameters key=paramName item=param}
						<input
							type="text"
							style="{if $param.size}width: {$param.size}em;{elseif $param.value}width: 5em;{/if}"
							name="functionAttributes[.:index:.][{$functionName}][param][{$paramName}]"
							class="dummy_param functionAttribute param{if $param.optional}Optional{else}Mandatory{/if}"
							{if $param.optional && $param.value}
								value="{$param.value}"
							{else}
								value=""
							{/if}
							tooltip="{$paramName}"
							onchange="variableEditor.refreshFilters($(this).up('tbody'), this);return false;"
							/>
					{/foreach}
				{/if}
			</div>
		{/foreach}
	</div>
</div>
