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

<inp2:m_include t="incs/header"/>
<inp2:m_RenderElement name="combined_header" prefix="p" section="in-portal:browse" title_preset="products_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('p','<inp2:p_SaveEvent/>');
						}
					) );
				a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
							submit_event('p','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('p', '<inp2:p_PrevId/>');
						}
				 ) );
				a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
							go_to_id('p', '<inp2:p_NextId/>');
						}
				 ) );

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

				a_toolbar.Render();

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

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

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

<inp2:p_SaveWarning name="grid_save_warning"/>
<inp2:p_ErrorWarning name="form_error_warning"/>

<div id="scroll_container">
	<table class="edit-form">
		<inp2:m_RenderElement name="subsection" title="la_section_Product"/>
			<inp2:m_RenderElement name="inp_label" prefix="p" field="ProductId" title="la_fld_Id"/>

			<inp2:m_if check="m_IsDebugMode" >
				<inp2:m_RenderElement name="inp_label" prefix="p" field="Type" title="la_fld_ProductType"/>
			</inp2:m_if>

			<inp2:m_RenderElement name="inp_edit_box_ml" prefix="p" field="Name" title="la_fld_Title" size="70"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="p" field="SKU" title="la_fld_SKU" size="70"/>

			<inp2:m_RenderElement name="inp_edit_textarea_ml" prefix="p" field="Description" title="la_fld_Description" cols="70" rows="5"/>
			<inp2:m_RenderElement name="inp_edit_textarea_ml" prefix="p" field="DescriptionExcerpt" title="la_fld_DescriptionExcerpt" cols="70" rows="3"/>

			<inp2:m_RenderElement name="inp_edit_checkbox" prefix="p" field="AutomaticFilename" title="la_fld_AutomaticFilename" onchange="reflect_filename()"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="p" field="Filename" title="la_fld_Filename" size="70"/>
			<inp2:m_RenderElement name="inp_edit_options" prefix="p" field="CategoryId" title="la_fld_ParentSection" display_original="1"/>

		<inp2:m_RenderElement name="subsection" title="la_section_Properties"/>

			<inp2:m_if check="p_FieldEquals" field="Type" value="1" >
				<inp2:m_RenderElement name="inp_edit_box" prefix="p" field="MinQtyFreePromoShipping" title="la_fld_ProductFreeShipping" size="5"/>
			</inp2:m_if>

			<inp2:m_if check="p_FieldEquals" field="Type" value="1">
				<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
					<td class="label-cell">
						<inp2:m_phrase label="la_fld_ManageShipping"/>:
					</td>
					<td class="control-mid">&nbsp;</td>
					<td class="control-cell">
						<a href="javascript:openShipping()">Open</a>
					</td>
				</tr>
			</inp2:m_if>

			<tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
				<td class="label-cell">
					<inp2:m_phrase label="la_fld_AssignedCoupon"/>:
				</td>
				<td class="control-mid">&nbsp;</td>
				<td class="control-cell">
					<inp2:p_Field name="AssignedCoupon" />&nbsp;<a href="javascript:openCouponSelector()">Open</a>
				</td>
			</tr>

			<inp2:m_RenderElement name="inp_edit_options" prefix="p" field="ManufacturerId" title="la_fld_Manufacturer" size="4" has_empty="1"/>

			<inp2:m_if check="p_FieldEquals" field="Type" value="3">
				<inp2:m_RenderElement name="inp_edit_box" prefix="p" field="Price" title="la_fld_Price" size="5"/>
			</inp2:m_if>

			<inp2:m_if check="p_FieldEquals" field="Type" value="6">
				<inp2:m_RenderElement name="inp_edit_box" prefix="p" field="Price" title="la_fld_Price" size="5"/>
			</inp2:m_if>

			<inp2:m_if check="p_FieldEquals" field="Type" value="1" >
				<inp2:m_RenderElement name="inp_edit_weight" prefix="p" field="Weight" title="la_fld_Weight" size="5"/>
			</inp2:m_if>

			<inp2:m_RenderElement name="inp_edit_box" prefix="p" field="MSRP" title="la_fld_MSRP" size="5"/>
			<inp2:m_RenderElement name="inp_edit_radio" prefix="p" field="Status" title="la_fld_Status"/>

			<inp2:m_RenderElement name="inp_edit_radio" prefix="p" field="NewItem" title="la_fld_New"/>
			<inp2:m_RenderElement name="inp_edit_radio" prefix="p" field="HotItem" title="la_fld_TopSeller"/>
			<inp2:m_RenderElement name="inp_edit_radio" prefix="p" field="PopItem" title="la_fld_Pop"/>
			<inp2:m_RenderElement name="inp_edit_checkbox" prefix="p" field="EditorsPick" title="la_fld_EditorsPick"/>
			<inp2:m_RenderElement name="inp_edit_checkbox" prefix="p" field="Featured" title="la_fld_Featured"/>
			<inp2:m_RenderElement name="inp_edit_checkbox" prefix="p" field="OnSale" title="la_fld_OnSale"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="p" field="Priority" title="la_fld_Priority" size="4"/>

			<inp2:m_RenderElement name="inp_edit_date_time" prefix="p" field="CreatedOn" title="la_fld_CreatedOn" size="12"/>
			<inp2:m_RenderElement name="inp_edit_date_time" prefix="p" field="Expire" title="la_fld_Expire" size="12"/>

			<inp2:m_RenderElement name="inp_edit_box" prefix="p" field="MetaKeywords" title="la_fld_MetaKeywords" size="70"/>
			<inp2:m_RenderElement name="inp_edit_textarea" prefix="p" field="MetaDescription" title="la_fld_MetaDescription" cols="70" rows="5"/>

			<inp2:m_if check="p_FieldEquals" field="Type" value="1" >
				<inp2:m_RenderElement name="subsection" title="la_section_Backordering"/>
					<inp2:m_RenderElement name="inp_edit_radio" prefix="p" field="BackOrder" title="la_fld_BackOrder"/>
					<inp2:m_RenderElement name="inp_edit_date_time" format="mm/dd/y" prefix="p" field="BackOrderDate" title="la_fld_BackOrderDate" size="12"/>
					<inp2:m_RenderElement name="inp_edit_box" prefix="p" field="QtyInStockMin" title="la_fld_QtyInStockMin" size="4"/>
			</inp2:m_if>

		<inp2:m_RenderElement name="subsection" title="la_section_Counters"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="p" field="CachedRating" title="la_fld_Rating" size="4"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="p" field="CachedVotesQty" title="la_fld_Votes" size="4"/>
			<inp2:m_RenderElement name="inp_edit_box" prefix="p" field="Hits" title="la_fld_QtySold" size="4"/>
			<input type="hidden" name="Hits_original" id="Hits_original" value="<inp2:p_Field name="Hits" db="db" />" />

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

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

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

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

	function openShipping() {
		openSelector('p','<inp2:m_link t="in-commerce/products/shipping_options" pass="all" no_amp="1" js_escape="1"/>', 'ShippingOption', '800x600', 'OnPreSaveAndOpenPopup');
	}

	function openCouponSelector() {
		openSelector('p','<inp2:m_link t="in-commerce/discounts/coupon_selector" pass="all" no_amp="1" js_escape="1"/>', 'AssignedCoupon', '800x400', 'OnPreSaveAndOpenPopup');
	}
</script>

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