{extends file=$element.methods->getTemplatePath('general')}

{block name=input}
	<div id="{$element.id}" 
		class="{$element.class} flex-parent flex-direction-{$element.style['multiplierDirection']}"
		style="{if $element.style.totalWidth} width:{$element.style.totalWidth}px; {/if}"
	>
		{for $index=0 to $element.multiplier-1}
			{assign var=key value=$element.labelKeys[$index]|default:$index}

			{if $element.labels && $element.settings.labelVisibility}
			<div class="{$element.style.extraCSSClass} {$element.style.CSSClass}-container  flex-child">
				{if $element.labels[$index]}
					<div class="label"><label for="{$element.id}_{$key}_">{$element.labels[$index]}</label></div>
				{else}
					<div class="label">&nbsp;</div>
				{/if}
			{/if}

			{block name=inputElement}
				<div class="inputElement ">
					<input type="text"
						{if $element.style.CSSClass}
							class="{$element.style.CSSClass} {$element.style.extraCSSClass}"
						{/if}

						id="{$element.id}_{$key}_"
						name="{$element.name}[{$key}]"
						value="{$element.value[$index]}"
						{if $element.disabled || $element.disabledLabelKeys[$element.labelKeys[$index]]}disabled="disabled"{/if}

						style="	{if $element.style.height} height:{$element.style.height}px;{/if}"
					/>
					
				</div>
				{$elements[]="{$element.id}_{$key}_"}
			{/block}

			{if $element.labels && $element.settings.labelVisibility}
				</div>
			{/if}
		{/for}

		{if $element['element']->getTooltip()}
			<var class="icon-info" tooltip="{$element['element']->getTooltip()}"></var>
			{$tmp=$element['element']->setStyle('flag_tooltipRendered', true)}
		{/if}
	</div>

	<div style="clear: both;"></div>

	<div id="{$element.id}_messageContainer"></div>
{/block}


<script type="text/javascript">
	{block name=script}{** dont append to prev validators!! **}
		{if $element.hasValidator}

			var validatorFunc_multipliedText_{$element.id} = function() {

				{if $element.validatorParams_full.mandatory}
					_inputValidator.createOnLoad(['{$elements|join:"', '"}'], '{$element.validatorType}', { mandatory:true });
				{/if}

				{foreach from=$elements item=el}
					_inputValidator.createOnLoad('{$el}', '{$element.validatorType}', {$element.validatorParams|@json_encode}, {
						{if $element.labels && $element.settings.labelVisibility}
							container:$('{$element.id}_{$key}_').up('div.{$element.style.CSSClass}-container').up()
						{else}
							container:$('{$element.id}_{$key}_').up()
						{/if}
					});
				{/foreach}

			};

			if (MVC) {
				MVC.scheduleOnLoad(validatorFunc_multipliedText_{$element.id});
			} else {
				Event.observe(document,'dom:loaded', validatorFunc_multipliedText_{$element.id});
			}

		{/if}
	{/block}
</script>
