<inp2:adm_SetPopupSize width="780" height="570"/>

<inp2:m_include t="incs/header" />
<inp2:m_RenderElement name="combined_header" section="in-portal:forms" prefix="form" title_preset="form_field_edit"/>

<!-- 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('formflds','<inp2:formflds_SaveEvent/>');
						}
					) );
				a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
							submit_event('formflds','OnCancel');
						}
				 ) );

				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('formflds', '<inp2:formflds_PrevId/>');
					}
				));

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

				a_toolbar.Render();

				<inp2:m_if check="formflds_IsSingle">
					a_toolbar.HideButton('prev');
					a_toolbar.HideButton('next');
					a_toolbar.HideButton('sep1');
				<inp2:m_else/>
					<inp2:m_if check="formflds_IsLast">
						a_toolbar.DisableButton('next');
					</inp2:m_if>
					<inp2:m_if check="formflds_IsFirst">
						a_toolbar.DisableButton('prev');
					</inp2:m_if>
				</inp2:m_if>
			</script>
		</td>
	</tr>
</tbody>
</table>

<inp2:m_RenderElement name="inp_edit_hidden" prefix="formflds" field="Type" db="db"/>
<inp2:m_RenderElement name="inp_edit_hidden" prefix="formflds" field="FormId"/>

<inp2:formflds_SaveWarning name="grid_save_warning"/>
<inp2:formflds_ErrorWarning name="form_error_warning"/>

<div id="scroll_container">
	<table class="edit-form">
		<inp2:m_RenderElement name="subsection" prefix="formflds" fields="FormFieldId,FieldName,FieldLabel"  title="la_section_General"/>
			<inp2:m_RenderElement name="inp_id_label" prefix="formflds" field="FormFieldId" title="la_prompt_FieldId"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="FieldName" title="la_prompt_FieldName" size="40"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="FieldLabel" title="la_prompt_FieldLabel" size="40"/>

		<inp2:m_RenderElement name="subsection" prefix="formflds" fields="Prompt,ElementType,Validation,UploadExtensions,UploadMaxSize,ValueList,DefaultValue,Priority,Required,DisplayInGrid,Visibility,EmailCommunicationRole" title="la_tab_AdminUI"/>
			<!--<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="Heading" title="la_prompt_heading" size="40"/>-->
			<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="Prompt" title="la_prompt_FieldPrompt" size="40"/>
			<inp2:m_RenderElement name="inp_edit_options" prefix="formflds" field="ElementType" title="la_prompt_InputType" has_empty="1"/>
			<inp2:m_RenderElement name="inp_edit_options" prefix="formflds" field="Validation" title="la_prompt_validation"/>

			<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="UploadExtensions" style="width: 200px;"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="UploadMaxSize" style="width: 200px;"/>

			<inp2:m_RenderElement name="inp_edit_textarea" prefix="formflds" field="ValueList" title="la_prompt_ValueList" cols="40" rows="5"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="DefaultValue" title="la_prompt_DefaultValue" size="40"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="formflds" field="Priority" title="la_field_Priority" size="10"/>
			<inp2:m_RenderElement name="inp_edit_checkbox" prefix="formflds" field="Required"/>
			<inp2:m_RenderElement name="inp_edit_checkbox" prefix="formflds" field="DisplayInGrid"/>
			<inp2:m_RenderElement name="inp_edit_radio" prefix="formflds" field="Visibility"/>

			<inp2:m_if check="form_Field" name="EnableEmailCommunication" db="db">
				<inp2:m_RenderElement name="inp_edit_options" prefix="formflds" field="EmailCommunicationRole" has_empty="1"/>
			</inp2:m_if>

			<inp2:m_if check="m_IsDebugMode">
				<inp2:m_RenderElement name="inp_edit_checkbox" prefix="formflds" field="IsSystem"/>
			</inp2:m_if>

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

<inp2:m_if check="formflds_FieldsVisible" fields="UploadExtensions,UploadMaxSize">
	<script type="text/javascript">
		var $field_mask = '<inp2:formflds_InputName field="#FIELD_NAME#" js_escape="1"/>';

		function syncUploadSettings() {
			if ( $( get_control($field_mask, 'ElementType') ).val() == 'upload' ) {
				$( get_control($field_mask, 'UploadExtensions', 'row') ).show();
				$( get_control($field_mask, 'UploadMaxSize', 'row') ).show();
			}
			else {
				$( get_control($field_mask, 'UploadExtensions', 'row') ).hide();
				$( get_control($field_mask, 'UploadMaxSize', 'row') ).hide();
			}
		}

		$(document).ready(
			function () {
				$( get_control($field_mask, 'ElementType') ).change(syncUploadSettings);
			}
		);

		syncUploadSettings();
	</script>
</inp2:m_if>

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