<inp2:adm_SetPopupSize width="800" height="640"/>

<inp2:m_include t="incs/header"/>
<inp2:m_Get var="form_id" result_to_var="form_id"/>

<inp2:m_RenderElement name="combined_header" prefix="formsubs" section="in-portal:submissions:$form_id" title_preset="submission_edit_logs" tab_preset="Default" />

<!-- ToolBar --->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
	<tr>
		<td>
			<table width="100%" cellpadding="0" cellspacing="0">
				<tr>
					<td>
						<script type="text/javascript">
							a_toolbar = new ToolBar();

							a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
										submit_event('formsubs', '<inp2:formsubs_SaveEvent/>');
									}
							 ) );

							a_toolbar.AddButton(
								new ToolBarButton(
									'cancel',
									'<inp2:m_phrase label="la_ToolTip_Close" escape="1"/>',
									function() {
										submit_event('formsubs', 'OnGoBack');
									}
								)
							);

							a_toolbar.AddButton( new ToolBarSeparator('sep1') );

							a_toolbar.AddButton(
								new ToolBarButton(
									'prev',
									'<inp2:m_phrase label="la_ToolTip_Prev" escape="1"/>',
									function() {
										go_to_id('formsubs', '<inp2:formsubs_PrevId/>');
									}
								)
							);

							a_toolbar.AddButton(
								new ToolBarButton(
									'next',
									'<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>',
									function() {
										go_to_id('formsubs', '<inp2:formsubs_NextId/>');
									}
								)
							);

							a_toolbar.AddButton( new ToolBarSeparator('sep2') );

							function edit()
							{
								std_edit_temp_item('submission-log', 'submissions/submission_log_edit');
							}

							a_toolbar.AddButton(
								new ToolBarButton(
									'edit',
									'<inp2:m_phrase label="la_ToolTip_View" escape="1"/>',
									edit
								)
							);

							a_toolbar.AddButton(
								new ToolBarButton(
									'reply',
									'<inp2:m_phrase label="la_ToolTip_Reply" escape="1"/>',
									function() {
										Application.SetVar('client_mode', 0);
										std_new_item('submission-log', 'submissions/submission_log_edit');
									}
								)
							);

							a_toolbar.AddButton(
								new ToolBarButton(
									'delete',
									'<inp2:m_phrase label="la_ToolTip_Delete" escape="1"/>',
									function() {
										std_delete_items('submission-log')
									}
								)
							);

							a_toolbar.AddButton(
								new ToolBarButton(
									'resend',
									'<inp2:m_phrase label="la_ToolTip_Resend" escape="1"/>',
									function() {
										Application.SetVar('from_list', 1);
										submit_event('submission-log', 'OnResendReply');
									}
								)
							);

							a_toolbar.AddButton( new ToolBarSeparator('sep3') );

							a_toolbar.AddButton(
								new ToolBarButton(
									'view',
									'<inp2:m_phrase label="la_ToolTip_View" escape="1"/>',
									function(id) {
										show_viewmenu(a_toolbar, 'view');
									}
								)
							);

							a_toolbar.Render();

							<inp2:m_if check="formsubs_IsSingle">
								a_toolbar.HideButton('prev');
								a_toolbar.HideButton('next');
								a_toolbar.HideButton('sep1');
							<inp2:m_else/>
								<inp2:m_if check="formsubs_IsLast">
									a_toolbar.DisableButton('next');
								</inp2:m_if>
								<inp2:m_if check="formsubs_IsFirst">
									a_toolbar.DisableButton('prev');
								</inp2:m_if>
							</inp2:m_if>
						</script>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>

<inp2:m_DefineElement name="grid_subject_td" format="" nl2br="" first_chars="" td_style="" currency="">
	<inp2:m_if check="IsNewUserReply">
		<strong><inp2:Field field="$field" first_chars="$first_chars" currency="$currency" nl2br="$nl2br" grid="$grid" format="$format"/></strong>
	<inp2:m_else/>
		<inp2:Field field="$field" first_chars="$first_chars" currency="$currency" nl2br="$nl2br" grid="$grid" format="$format"/>
	</inp2:m_if>
</inp2:m_DefineElement>

<inp2:m_RenderElement name="grid" PrefixSpecial="submission-log" IdField="SubmissionLogId" grid="Default"/>
<script type="text/javascript">
Grids['submission-log'].SetDependantToolbarButtons( new Array('edit','delete', 'resend') );
</script>

<inp2:m_include t="incs/footer"/>
