<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_if check="form_Field" name="EnableEmailCommunication" db="db">
	<inp2:m_RenderElement name="combined_header" prefix="formsubs" section="in-portal:submissions:$form_id" title_preset="formsubs_view" tab_preset="Default"/>
<inp2:m_else/>
	<inp2:m_RenderElement name="combined_header" prefix="formsubs" section="in-portal:submissions:$form_id" title_preset="formsubs_view"/>
</inp2:m_if>

<!-- ToolBar -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
	<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') );

				a_toolbar.Render();

				<inp2:m_if check="formsubs_IsSingle" >
					a_toolbar.HideButton('prev');
					a_toolbar.HideButton('next');
					a_toolbar.HideButton('sep1');
					//a_toolbar.HideButton('sep2');
				<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>
</tbody>
</table>

<!--##<inp2:m_DefineElement name="form_field_text">
	<inp2:m_if check="FieldEquals" field="Validation" value="1">
		<a href="mailto:<inp2:SubmissionTag tag='Field'/>"><inp2:SubmissionTag tag="Field"/></a>
	<inp2:m_else/>
		<inp2:SubmissionTag tag="Field"/>
	</inp2:m_if>
</inp2:m_DefineElement>##-->

<inp2:m_DefineElement name="form_field_text">
	<input type="text" name="<inp2:CustomInputName/>" id="<inp2:CustomInputName/>" value="<inp2:SubmissionTag tag="Field"/>" <inp2:m_param name="field_params" />/>
</inp2:m_DefineElement>

<inp2:m_DefineElement name="form_field_password">
	<input type="password" primarytype="password" name="<inp2:CustomInputName/>" id="<inp2:CustomInputName/>" value="" />
	<input type="password" name="<inp2:CustomInputName verify='1'/>" id="verify_<inp2:CustomInputName verify='1'/>" value="" />
</inp2:m_DefineElement>

<inp2:m_DefineElement name="form_field_option">
		<option value="<inp2:m_param name='key'/>"<inp2:m_param name="selected"/>><inp2:m_param name="option"/></option>
</inp2:m_DefineElement>

<inp2:m_DefineElement name="form_field_select">
	<select name="<inp2:CustomInputName/>" id="<inp2:CustomInputName/>">
		<inp2:SubmissionTag tag="PredefinedOptions" field="$field" block="form_field_option" selected="selected"/>
	</select>
</inp2:m_DefineElement>

<inp2:m_DefineElement name="form_field_checkbox">
	<input type="hidden" id="<inp2:CustomInputName/>" name="<inp2:CustomInputName/>" value="<inp2:SubmissionTag tag='Field' field='$field' db='db'/>">
	<input type="checkbox" id="_cb_<inp2:m_param name='field'/>" <inp2:SubmissionTag tag="Field" checked="checked" db="db"/> onchange="update_checkbox(this, document.getElementById('<inp2:CustomInputName/>'));">
</inp2:m_DefineElement>

<inp2:m_DefineElement name="form_field_textarea">
	<textarea name="<inp2:CustomInputName/>" id="<inp2:CustomInputName/>" style="width: 100%;" <inp2:m_param name="field_params" />><inp2:SubmissionTag tag="Field" field="$field" /></textarea>

	<script type="text/javascript">
		Form.addControl('<inp2:CustomInputName/>', false);
	</script>
</inp2:m_DefineElement>

<inp2:m_DefineElement name="form_radio_item">
	<input type="radio" <inp2:m_param name="checked"/> name="<inp2:m_param name="field_name"/>" id="<inp2:m_param name="field_name"/>_<inp2:m_param name="key"/>" value="<inp2:m_param name="key"/>"><label for="<inp2:m_param name="field_name"/>_<inp2:m_param name="key"/>"><inp2:m_param name="option"/></label>&nbsp;
</inp2:m_DefineElement>

<inp2:m_DefineElement name="form_field_radio">
	<inp2:SubmissionTag tag="PredefinedOptions" field="$field" block="form_radio_item" selected="checked"/>
</inp2:m_DefineElement>

<inp2:m_DefineElement name="form_field_upload">
	<input type="file" name="<inp2:CustomInputName/>" id="<inp2:CustomInputName/>" <inp2:m_param name="field_params" />/>
	<inp2:m_ifnot check="SubmissionTag" tag='Field' equals_to="" db="db">
		(<a href="<inp2:SubmissionTag tag='Field' format='full_url'/>" target="_blank"><inp2:SubmissionTag tag="Field"/></a>)
	</inp2:m_ifnot>

	<input type="hidden" name="<inp2:CustomInputName/>[upload]" id="<inp2:CustomInputName/>[upload]" value="<inp2:SubmissionTag tag='Field'/>"/>
</inp2:m_DefineElement>

<inp2:formsubs_SaveWarning name="grid_save_warning"/>
<inp2:formsubs_ErrorWarning name="form_error_warning"/>

<div id="scroll_container">
	<table class="edit-form">
		<inp2:m_RenderElement name="subsection" prefix="formsubs" fields="FormSubmissionId,SubmissionTime,IPAddress,ReferrerURL,LogStatus,LastUpdatedOn" title="la_section_General"/>
			<inp2:m_RenderElement name="inp_id_label" prefix="formsubs" field="FormSubmissionId" title="la_fld_Id"/>
			<inp2:m_RenderElement name="inp_label" prefix="formsubs" field="SubmissionTime" title="la_fld_SubmissionTime" />
			<inp2:m_RenderElement name="inp_label" prefix="formsubs" field="IPAddress" title="la_fld_IPAddress" />
			<inp2:m_RenderElement name="inp_label" prefix="formsubs" field="ReferrerURL" title="la_fld_ReferrerURL" />

			<inp2:m_if check="form_Field" name="EnableEmailCommunication" db="db">
				<inp2:m_RenderElement name="inp_label" prefix="formsubs" field="LogStatus" title="la_fld_Status" />
			<inp2:m_else/>
				<inp2:m_RenderElement name="inp_edit_options" prefix="formsubs" field="LogStatus" title="la_fld_Status" has_empty="1"/>
			</inp2:m_if>

			<inp2:m_if check="formsubs_Field" name="LastUpdatedOn" db="db">
				<inp2:m_RenderElement name="inp_label" prefix="formsubs" field="LastUpdatedOn" title="la_fld_LastUpdatedOn" />
			</inp2:m_if>

			<inp2:m_if check="form_Field" name="EnableEmailCommunication" db="db">
				<inp2:m_ifnot check="submission-log_TotalRecords">
					<inp2:m_RenderElement design="form_row" prefix="formsubs" field="MergeToSubmission" title="la_fld_MergeToSubmission">
						<td class="control-cell">
							<input type="hidden" id="<inp2:{$prefix}_InputName field='Is{$field}'/>" name="<inp2:{$prefix}_InputName field='Is{$field}'/>" value="<inp2:{$prefix}_Field field='Is{$field}' db='db'/>">
							<input tabindex="<inp2:m_get param='tab_index'/>" type="checkbox" id="_cb_<inp2:{$prefix}_InputName field='Is{$field}'/>" name="_cb_<inp2:{$prefix}_InputName field='Is{$field}'/>" <inp2:{$prefix}_Field field="Is{$field}" checked="checked" db="db"/> class="<inp2:m_param name='field_class'/>" onchange="update_checkbox(this, document.getElementById('<inp2:{$prefix}_InputName field='Is{$field}'/>'));<inp2:m_param name='onchange'/>" onclick="<inp2:m_param name='onclick'/>">

							<select tabindex="<inp2:m_get param='tab_index'/>" name="<inp2:{$prefix}_InputName field='$field'/>" id="<inp2:{$prefix}_InputName field='$field'/>" onchange="<inp2:m_Param name='onchange'/>" style="width: 400px;">
								<inp2:{$prefix}_PredefinedOptions field="$field" block="inp_option_item" selected="selected" has_empty="1"/>
							</select>
						</td>
					</inp2:m_RenderElement>
				</inp2:m_ifnot>
			</inp2:m_if>
		<inp2:m_RenderElement name="subsection" title="la_section_Data"/>

			<inp2:m_DefineElement name="form_field" prefix="formsubs">
				<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
					<inp2:m_inc param="tab_index" by="1"/>
					<td class="label-cell" onmouseover="show_form_error('<inp2:m_Param name='prefix' js_escape='1'/>', 'fld_<inp2:Field name='FormFieldId'/>')" onmouseout="hide_form_error('<inp2:m_Param name='prefix' js_escape='1'/>')">
						<inp2:Field field="Prompt" result_to_var="title"/>
						<inp2:Field field="Prompt" plus_or_as_label="1" no_special="no_special"/><inp2:m_if check="Field" name="Required" db="db"><span class="field-required">&nbsp;*</span></inp2:m_if>:<inp2:m_if check="FieldHintLabel" title_label="$title"><span>&nbsp;<img src="<inp2:m_TemplatesBase/>/img/hint_icon.png" width="12" height="13" title="<inp2:FieldHintLabel title_label='$title' html_escape='1'/>" alt="<inp2:FieldHintLabel title_label='$title' html_escape='1'/>"/></inp2:m_if>
					</td>
					<td class="control-mid">&nbsp;</td>
					<script type="text/javascript">
						if (typeof(fields['<inp2:m_Param name="prefix" js_escape="1"/>']) == 'undefined') {
							fields['<inp2:m_Param name="prefix" js_escape="1"/>'] = new Object();
						}
						fields['<inp2:m_Param name="prefix" js_escape="1"/>']['fld_<inp2:Field name="FormFieldId"/>'] = '<inp2:Field field="Prompt" plus_or_as_label="1" no_special="no_special" js_escape="1"/>'
					</script>
					<td class="control-cell">
						<inp2:ConfigFormElement field="Value" blocks_prefix="form_field_" element_type_field="ElementType" value_list_field="ValueList" /><br/>
					</td>
				</tr>
				<script type="text/javascript">
					add_form_error('<inp2:m_Param name="prefix" js_escape="1"/>', 'fld_<inp2:Field name="FormFieldId"/>', '<inp2:CustomInputName/>', '<inp2:SubmissionTag tag="Error" js_escape="1"/>')
				</script>
			</inp2:m_DefineElement>

		<inp2:formflds_PrintList render_as="form_field" SourcePrefix="formsubs" per_page="-1"/>

		<inp2:m_RenderElement name="subsection" prefix="formsubs" fields="Notes" title="la_section_SubmissionNotes"/>
			<inp2:m_RenderElement name="inp_edit_textarea" prefix="formsubs" field="Notes" title="la_fld_Notes" />

		<inp2:m_RenderElement name="inp_edit_filler"/>
	</table>
</div>

<inp2:m_if check="form_Field" name="EnableEmailCommunication" db="db">
	<inp2:m_ifnot check="submission-log_TotalRecords">
		<script language="javascript" type="text/javascript">
			var $field_mask = '<inp2:formsubs_InputName name="#FIELD_NAME#" js_escape="1"/>';

			$(document).ready(
				function () {
					processMergeToSubmission();
					$( get_control($field_mask, 'IsMergeToSubmission', undefined, '_cb') ).click(processMergeToSubmission);
				}
			);

			function processMergeToSubmission() {
				var $do_merge = get_control($field_mask, 'IsMergeToSubmission', undefined, '_cb').checked;
				var $merge_to_submission = get_control($field_mask, 'MergeToSubmission');

				if (!$do_merge) {
					$merge_to_submission.selectedIndex = 0;
				}

				$merge_to_submission.disabled = !$do_merge;

				if ($do_merge) {
					$('#merge_submission').removeClass('button-disabled').addClass('button').attr('disabled', '');
				}
				else {
					$('#merge_submission').removeClass('button').addClass('button-disabled').attr('disabled', 'disabled');
				}
			}
		</script>
	</inp2:m_ifnot>
</inp2:m_if>

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