<inp2:adm_SetPopupSize width="880" height="680"/>

<inp2:m_include t="incs/header"/>
<inp2:m_RenderElement name="combined_header" prefix="l" section="in-portal:browse" title_preset="links_edit" tab_preset="Default"/>

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

				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('l', '<inp2:l_PrevId/>');
						}
				 ) );
				a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
							go_to_id('l', '<inp2:l_NextId/>');
						}
				 ) );

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

				a_toolbar.Render();

				<inp2:m_if check="l_IsSingle" >
					a_toolbar.HideButton('prev');
					a_toolbar.HideButton('next');
					a_toolbar.HideButton('sep1');
					//a_toolbar.HideButton('sep2');
				<inp2:m_else/>
					<inp2:m_if check="l_IsLast" >
						a_toolbar.DisableButton('next');
					</inp2:m_if>
					<inp2:m_if check="l_IsFirst" >
						a_toolbar.DisableButton('prev');
					</inp2:m_if>
				</inp2:m_if>
			</script>
		</td>

		<inp2:m_RenderElement name="ml_selector" prefix="l"/>
	</tr>
</tbody>
</table>

<inp2:l_SaveWarning name="grid_save_warning"/>
<inp2:l_ErrorWarning name="form_error_warning"/>

<div id="scroll_container">
	<table class="edit-form">
		<inp2:m_RenderElement name="subsection" prefix="l" fields="LinkId,Name,Description,Url,ReciprocalLinkFound,CreatedById,AutomaticFilename,Filename,CustomTemplate,CategoryId" title="la_section_Link" original_title="la_section_OriginalValues" display_original="1"/>
			<inp2:m_RenderElement name="inp_id_label" prefix="l" field="LinkId" title="la_fld_Id" display_original="1"/>
			<inp2:m_RenderElement name="inp_edit_box_ml" prefix="l" field="Name" title="la_fld_Name" size="60" display_original="1"/>
			<inp2:m_RenderElement name="inp_edit_textarea_ml" prefix="l" field="Description" title="la_fld_Description" cols="60" rows="5" display_original="1"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="l" field="Url" title="la_fld_Url" size="60" display_original="1"/>
			<inp2:m_RenderElement name="inp_label" prefix="l" field="ReciprocalLinkFound" title="la_fld_ReciprocalLinkFound"/>
			<inp2:m_RenderElement name="inp_edit_user" prefix="l" field="CreatedById" title="la_fld_LinkOwner" size="30" display_original="1"/>
			<inp2:m_RenderElement name="inp_edit_checkbox" prefix="l" field="AutomaticFilename" title="la_fld_AutomaticFilename" onchange="reflect_filename()" display_original="1"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="l" field="Filename" title="la_fld_Filename" size="60" display_original="1"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="l" field="CustomTemplate" title="la_fld_CustomTemplate" size="60" display_original="1"/>
			<inp2:m_RenderElement name="inp_edit_options" prefix="l" field="CategoryId" title="la_fld_ParentSection" display_original="1"/>

		<inp2:m_RenderElement name="subsection" prefix="l" fields="Status,NewItem,HotItem,PopItem,EditorPick,PriorityCreatedOn,Expire,MetaKeywords,MetaDescription" title="la_section_Properties" original_title="la_section_OriginalValues" display_original="1"/>
			<inp2:m_if check="l_DisplayOriginal" display_original="1">
				<inp2:m_RenderElement design="form_row" prefix="l" field="Status" title="la_fld_Status">
					<td class="control-cell">
						<inp2:m_Phrase label="la_UseGridToApproveDecline" />
					</td>
				</inp2:m_RenderElement>
			<inp2:m_else/>
				<inp2:m_RenderElement name="inp_edit_radio" prefix="l" field="Status" title="la_fld_Status" display_original="1"/>
			</inp2:m_if>

			<inp2:m_RenderElement name="inp_edit_radio" prefix="l" field="NewItem" title="la_fld_New" display_original="1"/>
			<inp2:m_RenderElement name="inp_edit_radio" prefix="l" field="HotItem" title="la_fld_Hot" display_original="1"/>
			<inp2:m_RenderElement name="inp_edit_radio" prefix="l" field="PopItem" title="la_fld_Pop" display_original="1"/>
			<inp2:m_RenderElement name="inp_edit_checkbox" prefix="l" field="EditorsPick" title="la_fld_EditorsPick" display_original="1"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="l" field="Priority" title="la_fld_Priority" size="4" display_original="1"/>
			<inp2:m_RenderElement name="inp_edit_date_time" prefix="l" field="CreatedOn" title="la_fld_CreatedOn" display_original="1"/>
			<inp2:m_RenderElement name="inp_edit_date_time" prefix="l" field="Expire" title="la_fld_Expire" size="12" display_original="1"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="l" field="MetaKeywords" title="la_fld_MetaKeywords" size="60"/>
			<inp2:m_RenderElement name="inp_edit_textarea" prefix="l" field="MetaDescription" title="la_fld_MetaDescription" cols="60" rows="5"/>

		<inp2:m_RenderElement name="subsection" prefix="l" fields="CachedRating,CachedVotesQty,Hits" title="la_section_Counters" original_title="la_section_OriginalValues" display_original="1"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="l" field="CachedRating" title="la_fld_Rating" hint_label="la_prompt_RatingLimits" size="4" display_original="1"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="l" field="CachedVotesQty" title="la_fld_Votes" hint_label="la_prompt_VoteLimits" size="4" display_original="1"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="l" field="Hits" title="la_fld_Hits" hint_label="la_prompt_HitLimits" size="4" display_original="1"/>

		<!-- custom fields: begin -->
		<inp2:m_include t="incs/custom_blocks"/>
		<inp2:cf.general_PrintList render_as="cv_row_block" SourcePrefix="l" value_field="Value" per_page="-1" grid="Default" original_title="la_section_OriginalValues" display_original="1"/>
		<!-- custom fields: end -->

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

<input type="hidden" name="Hits_original" id="Hits_original" value="<inp2:l_Field name='Hits' db='db' />" />

<script type="text/javascript">
	$(document).ready(reflect_filename);
	disable_categories('<inp2:l_InputName name="CategoryId"/>', <inp2:l_AllowedCategoriesJSON/>);

	function reflect_filename() {
    	var $checked = document.getElementById('_cb_<inp2:l_InputName field="AutomaticFilename"/>').checked;
    	document.getElementById('<inp2:l_InputName field="Filename"/>').readOnly = $checked;
    }
</script>

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