[% PROCESS "_component/boxes/dialogue_box.cfg" %]
[% USE pl = Eval %]

[% IF !box_border_size;
	box_border_size = 1;
	END
%]

[%
	box_true_width = pl.execute('#1-#2-#3-(#4*2)',$box_width,$box_left_padding,$box_right_padding,$box_border_size);
	box_label_left_spacing = pl.execute('10-#1',$box_left_padding)
%]

[% IF box_rows;
	box_rows1 = pl.execute('#1+4',$box_rows)
	box_rows2 = pl.execute('#1+2',$box_rows);
	ELSE;
	box_rows1 = box_dynamic_rows1
	box_rows2 = box_dynamic_rows2;
	END
%]

[% IF !box_cols;
	box_cols = box_dynamic_cols;
	END
%]


[% IF (!box_continue) && box_button1_form_action %]
<form[% " name=$box_button1_form_name" IF box_button1_form_name %] method=$box_button1_form_method action=$box_button1_form_action[% " $box_button1_form_misc" IF box_button1_form_misc %]>
[% END %]
<table border=0 cellspacing=0 cellpadding=0 [% "align=$box_alignment " IF box_alignment != 'none' %]width=$box_width class=box-background-color>
<tr class=box-border-color>
<td rowspan=$box_rows1 width=$box_border_size><spacer type=block width=1></td>
<td width=$box_left_padding height=$box_border_size><spacer type=block width=$box_left_padding></td>
<td[% " colspan=$box_cols" IF box_cols > 1 %] width=$box_true_width><spacer type=block width=1></td>
<td width=$box_right_padding><spacer type=block width=$box_right_padding></td>
<td rowspan=$box_rows1 width=$box_border_size><spacer type=block width=1></td>
</tr>
<tr>
<td rowspan=$box_rows2 width=$box_left_padding><spacer type=block width=1></td>
<td[% " colspan=$box_cols" IF box_cols > 1 %][% " valign=top" IF box_label %] width=$box_true_width height=$box_top_padding>[% IF box_label %]<div style='position:relative; top:-9px[% "; left:${box_label_left_spacing}px" IF box_label_left_spacing != 0 %]'><table border=0 cellspacing=0 cellpadding=0 class=box-background-color><tr><td[% " class=$box_label_class" IF box_label_class %]>&nbsp;$box_label&nbsp;</td></tr></table></div>[% ELSIF box_blurb_top %]<br>$box_blurb_top<br><br>[% ELSE %]<spacer type=block width=1>[% END %][% "$box_blurb_top<br><br>" IF box_label && box_blurb_top %]</td>
<td rowspan=$box_rows2 width=$box_left_padding><spacer type=block width=1></td>
</tr>

[% "$box_fields" IF box_fields %]
[% IF box_filename; INCLUDE $box_filename; END %]

<tr><td[% " colspan=$box_cols" IF box_cols > 1 %][% " height=$box_bottom_padding" IF !box_blurb_bottom || !box_buttons_inside %]>[% IF box_blurb_bottom %]<br>$box_blurb_bottom<br><br>[% ELSIF !box_buttons_inside %]<spacer type=block width=1>[% END %]
[% IF box_button1_value && box_buttons_inside %][% "<br>" IF !box_blurb_bottom %]
<table border=0 cellspacing=0 cellpadding=0 align=center>
<tr valign=top>
<td align=[% IF box_button2_value %]right[% ELSE %]center[% END %] height=32><input[% " name=$box_button1_name" IF box_button1_name %] type=submit value='$box_button1_value'[% " class=$box_buttons_class" IF box_buttons_class %]>[% "&nbsp;&nbsp;" IF box_button2_value %]</form></td>
	[% IF box_button2_value %]
<td[% " align=center" IF box_button3_value %]><form[% " name=$box_button2_form_name" IF box_button2_form_name %] method=$box_button2_form_method action=$box_button2_form_action>&nbsp;&nbsp;<input[% " name=$box_button2_name" IF box_button2_name %] type=submit value='$box_button2_value'[% " class=$box_buttons_class" IF box_buttons_class %]>[% "&nbsp;&nbsp;" IF box_button3_value %]</form></td>
	[% END %]
	[% IF box_button3_value %]
<td><form[% " name=$box_button3_form_name" IF box_button3_form_name %] method=$box_button3_form_method action=$box_button3_form_action>&nbsp;&nbsp;<input[% " name=$box_button3_name" IF box_button3_name %] type=submit value='$box_button3_value'[% " class=$box_buttons_class" IF box_buttons_class %]></form></td>
	[% END %]
</tr>
</table>
[% END %]</td></tr>
<tr class=box-border-color>
<td height=$box_border_size><spacer type=block width=1></td>
<td[% " colspan=$box_cols" IF box_cols > 1 %]><spacer type=block width=1></td>
<td><spacer type=block width=1></td>
</tr>
</table>

[% IF box_button1_value && !box_buttons_inside %]
<table border=0 cellspacing=0 cellpadding=12 [% "align=$box_alignment " IF box_alignment != 'none' %]width=$box_width>
<tr valign=top>
<td align=[% IF box_button2_value %]right [% IF box_button3_value %]width=33%[% ELSE %]width=50%[% END %][% ELSE %]center[% END %]><input[% " name=$box_button1_name" IF box_button1_name %] type=submit value='$box_button1_value'[% " class=$box_buttons_class" IF box_buttons_class %]></form></td>
	[% IF box_button2_value %]
<td [% IF box_button3_value %]align=center width=34%[% ELSE %]width=50%[% END %]><form[% " name=$box_button2_form_name" IF box_button2_form_name %] method=$box_button2_form_method action=$box_button2_form_action><input[% " name=$box_button2_name" IF box_button2_name %] type=submit value='$box_button2_value'[% " class=$box_buttons_class" IF box_buttons_class %]></form></td>
	[% END %]
	[% IF box_button3_value %]
<td width=33%><form[% " name=$box_button3_form_name" IF box_button3_form_name %] method=$box_button3_form_method action=$box_button3_form_action><input[% " name=$box_button3_name" IF box_button3_name %] type=submit value='$box_button3_value'[% " class=$box_buttons_class" IF box_buttons_class %]></form></td>
	[% END %]
</tr>
</table>
[% END %]