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

{block name=input}
	<div id="{$element.id}" class="{$element.style.CSSClass} {$element.style.CSSClass}-{$element.style.renderMode}">
		{if $element.style.renderMode=='inline'}
			<table style="width:{$element.style.width}px;">
				<tr>
					{foreach $element.style.renderOrder as $renderBlock}
						{if $renderBlock=='main'}
							<td class="inputContainer inputContainer-{$renderBlock}">
								{foreach $element.elements[$renderBlock] as $elm}
									{$elm->render()}
								{/foreach}
							</td>
						{else}
							{foreach $element.elements[$renderBlock] as $elm}
								<td class="inputContainer inputContainer-{$renderBlock}">
									{$elm->render()}
								</td>
							{/foreach}
						{/if}
					{/foreach}
				</tr>
			</table>
		{else}
			{foreach $element.style.renderOrder as $renderBlock}
				{if $renderBlock=='main'}
					{foreach $element.elements[$renderBlock] as $elm}
						{$elm->render()}
					{/foreach}
				{else}
					<div {if !$element.value}style="display: none;"{/if}
							class="inputContainer inputContainer-{$renderBlock} inputCount-{$element.elements[$renderBlock]|count}"
					>
						{foreach $element.elements[$renderBlock] as $elm}
							{$elm->render()}
						{/foreach}
					</div>
				{/if}
			{/foreach}
		{/if}
	</div>
{/block}


<script type="text/javascript">
	{block name=script append}
		{if $element.style.renderMode!='inline'}
			MVC.scheduleOnLoad(function(){
				{foreach $element.elements['main'] as $elm}
					$('{$elm->getId()}').observe('keyup', function (evt) {
						if ($F(evt.element())) {
							$(evt.element()).up('td').down('div.inputContainer').show();
						}
						else {
							$(evt.element()).up('td').down('div.inputContainer').hide();
						}
					});
				{/foreach}
			});
		{/if}
	{/block}
</script>
