[% IF formName %]
	<form 
		name='[% formName %]' 
		action='[% thisScript %]' 
		method='post' 
		[% IF formType %]enctype="[% formType %]"[% END %] 
		[% IF buttonFocus %]onkeyup  = "submitOnEnter(event,'[% buttonFocus %]')"[% END %]
	>
	<input type='hidden' id='buttonTmp_[% formName %]' name='buttonTmp' value='' />
	[% formCreated	= 1 %]
[% ELSE %]
	[% formName = parentFormName %]
[% END %]

[% trOpen	= 0 %]

<table id='boxT' border=0>

[% FOREACH entry IN menu %]  <!-- 1 -->
	[% UNLESS trOpen %]
		<tr 
			[% IF entry.name %]name='[% entry.name %]'[% END %]
			[% IF entry.onClick %]onclick='[% entry.onClick %]'[% END %]
		>
		[% trOpen	= 1 %]
	[% END %]
	[% IF entry.value.type == 'hline' %]  <!-- 2 -->
			[% IF entry.value.colspan %]
				<td colspan='[% entry.value.colspan %]'>
			[% ELSE %]
				<td>
			[% END %]
				<div id='boxHLine' name='[% entry.value.name %]' [% IF entry.onClick %]onClick='[% entry.onClick %]'[% END %] title='[% entry.value.title %]' >
				</div>
			</td>
		</tr>
		[% trOpen	= 0 %]
	[% ELSE %]
	<!-- ! HLINE -->
		[% FOREACH element IN entry.elements %] <!-- 3 -->
			[% UNLESS trOpen %]
				<tr 
					[% IF entry.name %]name='[% entry.name %]'[% END %]
					[% IF entry.onClick %]onclick='[% entry.onClick %]'[% END %]
				>
				[% trOpen	= 1 %]
			[% END %]
			<td id='boxEntry' nowrap='1' 
				[% IF element.target == 'key' %]style='background-color:#BBBBFF;text-align:right;font-weight:bold;white-space:nowrap;' [% END %]
				[% IF element.target == 'value' %]style='background-color:#DDDDFF;text-align:[% IF element.align %][% element.align %][% ELSE %]left[% END %];overflow:visible;white-space:nowrap;' [% END %]
				[% IF element.colspan %]colspan='[% element.colspan %]' [% END %]
				[% IF element.rowspan %]rowspan='[% element.rowspan %]' [% END %]
				[% IF element.width %]width='[% element.width %]' [% END %]
				[% IF element.height %]height='[% element.height %]' [% END %]
				[% IF element.bgColor %]style='background-color:#[% element.bgColor %];' [% END %]
				[% IF element.align %]align='[% element.align %]' [% ELSE %]
					[% IF align %]align="[% align %]" [% END %] 
				[% END %]
			>
				[% IF element.type == 'buttons' %] <!-- 4 -->
					[% FOREACH button IN element.buttons %] <!-- 5 -->
						[% IF button.picOnly %]
							<img 
								id		= 'boxButtonImage' 
								class	= 'tE3[% IF button.disabled %]Disabled[% END %]' 
								src		= "[% imagepathrel %]/[% button.img %]" 
								alt		= "[% button.title %]"
								title	= "[% button.title %]"
								[% UNLESS button.disabled %]
									onclick	= "[% IF button.onClick %][% button.onClick %];[% END %]implButton('buttonTmp_[% formName %]', '[% button.name %]', '[% button.value %]', '[% formName %]', '[% button.name %]', '[% button.type %]')" 
								[% END %]
							/>
						[% ELSE %]
							<div 
								id		= '[% button.name %]'
								class	= 'boxButton[% IF button.disabled %]Disabled[% END %]'
								title	= "[% button.title %]"
								[% UNLESS button.disabled %]
									onclick	= "[% IF button.onClick %][% button.onClick %];[% END %]implButton('buttonTmp_[% formName %]', '[% button.name %]', '[% button.value %]', '[% formName %]', '[% button.name %]', '[% button.type %]')" 
								[% END %]
							>
								<img id='boxButtonImage' src="[% imagepathrel %]/[% button.img %]" />
								[% button.value %]
							</div>
						[% END %]
					[% END %] <!-- FOREACH 5 -->
				[% ELSIF element.type == 'vline' %] <!-- 4 -->
					<span id='boxVLine' name='[% entry.value.name %]' [% IF entry.onClick %]onClick='[% entry.onClick %]'[% END %] title='[% entry.value.title %]'>|</span>
				[% ELSIF element.type == 'dline' %] <!-- 4 -->
					<span id='boxVLine' name='[% entry.value.name %]' [% IF entry.onClick %]onClick='[% entry.onClick %]'[% END %] title='[% entry.value.title %]'>/</span>
				[% ELSIF element.type == 'label' %] <!-- 4 -->
					[% IF element.hidden %]
						<input 
							type	= 'hidden' 
							name	= '[% element.name %]' 
							id		= '[% element.name %]'
							value	= '[% element.value %]'
							title	= "[% element.title %]" 
						/>
					[% END %]
					[% UNLESS element.noShow %]
						<span 
							id = '[% element.name %]' 
							style='
								[% IF element.bold %]font-weight:bold;[% END %]
								[% IF element.underline %]text-decoration: underline;[% END %]
								[% IF element.color %]color:[% element.color %];[% END %]
								[% IF element.wrap %]white-space:normal[% ELSE %]white-space:nowrap[% END %];
							'
						>
							[% element.value %]
						</span>
					[% END %]
				[% ELSIF element.type == 'textfield' %] <!-- 4 -->
					<input 
						class			= 'box'
						type			= 'text' 
						id				= '[% element.name %]'
						name			= '[% element.name %]' 
						size			= '[% element.size %]' 
						maxlength	= '[% element.maxlength %]' 
						value			= "[% element.value %]" 
						title			= "[% element.title %]" 
						onChange	= "[% element.onChange %]"
						onClick		=	"[% element.onClick %]"
						onKeyDown	= "[% element.onKeyDown %]" 
						[% IF element.disabled == '1' %]
							disabled	= 'disabled'
						[% END %]
						[% IF element.style %]
							style	= "[% element.style %]" 
						[% END %]
					/>
				[% ELSIF element.type == 'file' %] <!-- 4 -->
					<input 
						class			= 'box'
						type			= 'file' 
						id				= '[% element.name %]'
						name			= '[% element.name %]' 
						size			= '[% element.size %]' 
						maxlength	= '[% element.maxlength %]' 
						title			= "[% element.title %]" 
						[% IF element.disabled == '1' %]
							disabled	= 'disabled'
						[% END %]
					/>
				[% ELSIF element.type == 'passwordfield' %] <!-- 4 -->
					<input 
						class			= 'box'
						type			= 'password' 
						id				= '[% element.name %]'
						name			= '[% element.name %]' 
						size			= '[% element.size %]' 
						maxlength	= '[% element.maxlength %]' 
						title			= "[% element.title %]" 
						onKeyDown	= "[% element.onKeyDown %]" 
						value			= ''
						onChange	= '[% element.onChange %]' 
						[% IF element.disabled == '1' %]
							disabled	= 'disabled'
						[% END %]
					/>
				[% ELSIF element.type == 'textarea' %] <!-- 4 -->
					<textarea
						class			= 'box'
						type			= 'text' 
						id				= '[% element.name %]'
						name			= '[% element.name %]' 
						rows			= '[% element.rows %]' 
						cols			= '[% element.cols %]' 
						title			= "[% element.title %]" 
						onChange	= '[% element.onChange %]' 
						[% IF element.disabled == '1' %]
							disabled	= 'disabled'
						[% END %]
					/>[% element.value %]</textarea>
				[% ELSIF element.type == 'popupMenu' %] <!-- 4 -->
					<select 
						class			= 'box'
						id				= '[% element.name %]'
						name			= '[% element.name %]' 
						size			= '[% element.size %]' 
						[% IF element.title != '' %]
							title			= "[% element.title %]" 
						[% END %]
						[% IF element.onChange != '' %]
							onChange	= '[% element.onChange %]' 
						[% END %]
						[% IF element.onClick != '' %]
							onClick		= '[% element.onClick %]' 
						[% END %]
						[% IF element.disabled == '1' %]
							disabled	= 'disabled'
						[% END %]
						[% IF element.multiple == '1' %]
							multiple	= "multiple"
						[% END %]
					>
						[% FOREACH option IN element.values %] 
							<option 
								value = '[% option.ID %]' 
								[% FOREACH selected IN element.selected %] 
									[% IF option.ID == selected %] selected="selected" [% END %] 
								[% END %] > 
								[% option.name %] 
							</option> 
						[% END %]
					</select>
				[% ELSIF element.type == 'checkbox' %] <!-- 4 -->
					<input 
						type			= 'checkbox'
						class			= 'box'
						id				= '[% element.name %]'
						name			= '[% element.name %]'
						value			= '[% element.value %]'
						onChange	= '[% element.onChange %]' 
						title			= "[% element.title %]" 
						[% IF element.checked == '1' %]
							checked="checked"
						[% END %]
						[% IF element.disabled == '1' %]
							disabled	= 'disabled'
						[% END %]
					/>
					[% element.descr %]
				[% ELSIF element.type == 'radio' %] <!-- 4 -->
					[% FOREACH radio IN element.values %]
						<input 
							type	= "radio" 
							name	= "[% element.name %]"
							value	= "[% radio.value %]" 
							[% IF element.selected == radio.value %] checked [% END %]
						/>
						&nbsp;[% radio.label %]
						[% IF element.cr %]<br>[% END %]
					[% END %]
				[% ELSIF element.type == 'floatEnd' %] <!-- 4 -->
					<div style='clear:both'></div>
				[% END %] <!-- IF 4 -->
				[% IF element.focus == 1 %]
					[% focusName = element.name %]
				[% END %] <!-- IF -->
			</td>
			[% UNLESS element.target == 'key' OR element.target == 'single' %]</tr>[% trOpen = 0 %][% END %]
			[% END %] <!-- FOREACH 3 -->
		[% IF element.target == 'key' OR element.target == 'single' %]</tr>[% trOpen = 0 %][% END %]
	[% END %]  <!-- IF 2 -->
	[% IF trOpen %]</tr>[% trOpen = 0 %][% END %]
[% END %]  <!-- FOREACH 1 -->

[% FOREACH entry IN hiddens %]  <!-- 1(hidden) -->
	<input 
		type	= 'hidden' 
		name	= '[% entry.name %]' 
		id		= '[% entry.name %]'
		value	= '[% entry.value %]'
	/>
[% END %]  <!-- FOREACH 1 -->

</table>

[% IF formCreated %]
	</form>
[% END %]

<script>setFocus('[% focusName %]')</script>
