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

<inp2:m_include t="incs/header"/>
<inp2:m_RenderElement name="combined_header" prefix="ord" section="in-commerce:orders" title_preset="orders_edit_shipping" 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('ord','<inp2:ord_SaveEvent/>');
						}
					) );
				a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
							submit_event('ord','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('ord', '<inp2:ord_PrevId/>');
						}
				 ) );
				a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
							go_to_id('ord', '<inp2:ord_NextId/>');
						}
				 ) );
				<inp2:m_if check="ord_OrderEditable">
					a_toolbar.AddButton( new ToolBarSeparator('sep2') );


					a_toolbar.AddButton( new ToolBarButton('reset_to_user', '<inp2:m_phrase label="la_ToolTip_ResetToUser" escape="1"/>', function() {
								submit_event('ord','OnResetToUser');
							}
					 ) );

					a_toolbar.AddButton( new ToolBarButton('in-commerce:reset_to_billing', '<inp2:m_phrase label="la_ToolTip_ResetToBilling" escape="1"/>', function() {
								submit_event('ord','OnResetToBilling');
							}
					 ) );
				</inp2:m_if>

				a_toolbar.Render();

				<inp2:m_if check="ord_IsSingle" >
					a_toolbar.HideButton('prev');
					a_toolbar.HideButton('next');
					a_toolbar.HideButton('sep1');
					a_toolbar.HideButton('sep2');
				<inp2:m_else/>
					<inp2:m_if check="ord_IsLast" >
						a_toolbar.DisableButton('next');
					</inp2:m_if>
					<inp2:m_if check="ord_IsFirst" >
						a_toolbar.DisableButton('prev');
					</inp2:m_if>
				</inp2:m_if>
			</script>
		</td>
	</tr>
</tbody>
</table>

<inp2:m_RenderElement name="inp_edit_hidden" prefix="ord" field="Status" db="db"/>

<inp2:ord_SaveWarning name="grid_save_warning"/>

<inp2:m_RenderElement design="form_message" id="sqe_error" style="display: none;" pass_params="1">
	&nbsp;
</inp2:m_RenderElement>

<inp2:ord_ErrorWarning name="form_error_warning"/>

<div id="scroll_container">
	<table class="edit-form">
		<inp2:m_RenderElement name="subsection" title="la_section_OrderShipping"/>

			<inp2:m_if check="ord_OrderEditable">

				<inp2:m_RenderElement name="inp_edit_box" prefix="ord" field="ShippingTo" title="la_fld_ShippingTo" size="40"/>
				<inp2:m_RenderElement name="inp_edit_box" prefix="ord" field="ShippingCompany" title="la_fld_ShippingCompany" size="40"/>
				<inp2:m_RenderElement name="inp_edit_box" prefix="ord" field="ShippingPhone" title="la_fld_ShippingPhone" size="20"/>
				<inp2:m_RenderElement name="inp_edit_box" prefix="ord" field="ShippingFax" title="la_fld_ShippingFax" size="20"/>
				<inp2:m_RenderElement name="inp_edit_box" prefix="ord" field="ShippingEmail" title="la_fld_ShippingEmail" size="20"/>
				<inp2:m_RenderElement name="inp_edit_box" prefix="ord" field="ShippingAddress1" title="la_fld_ShippingAddress1" size="40"/>
				<inp2:m_RenderElement name="inp_edit_box" prefix="ord" field="ShippingAddress2" title="la_fld_ShippingAddress2" size="40"/>
				<inp2:m_RenderElement name="inp_edit_box" prefix="ord" field="ShippingCity" title="la_fld_ShippingCity" size="20"/>

				<script type="text/javascript">
					function update_address()
					{
						submit_event('ord','OnQuietPreSave');
					}
				</script>

				<inp2:m_RenderElement name="inp_edit_box" prefix="ord" field="ShippingState" title="la_fld_ShippingState" size="20" />
				<inp2:m_RenderElement name="inp_edit_box" prefix="ord" field="ShippingZip" title="la_fld_ShippingZip" size="10"/>
				<inp2:m_RenderElement name="inp_edit_options" prefix="ord" field="ShippingCountry" title="la_fld_ShippingCountry" size="20" />

				<inp2:m_DefineElement name="order_option">
					<input onclick="submit_event('ord','OnQuietPreSave');"  class="simple" type="radio" <inp2:m_param name="checked"/> name="<inp2:InputName field="$field"/>" id="<inp2:InputName field="$field"/>_<inp2:m_param name="key"/>" value="<inp2:m_param name="key"/>"><label for="<inp2:InputName field="$field"/>_<inp2:m_param name="key"/>"><inp2:m_phrase label="$option"/></label>&nbsp;<br>
				</inp2:m_DefineElement>

				<!-- <inp2:m_RenderElement name="inp_edit_radio" prefix="ord" field="ShippingOption" title="la_fld_ShippingOption" size="20" /> -->

				<inp2:m_DefineElement name="order_shipping_type">
					<option <inp2:m_param name="selected"/> value="<inp2:m_param name="ShippingId"/>"><inp2:m_param name="ShippingName"/> (<inp2:m_param name="TotalCost"/>)
				</inp2:m_DefineElement>

				<inp2:m_DefineElement name="order_shipment">
					<tr class="<inp2:m_odd_even var="shipping_odd_even" odd="table-color1" even="table-color2"/>">
						<td style="border-right: 1px solid black"><inp2:m_param name="shipment"/></td>
						<td>
							<select style="width:230px;" name="<inp2:m_param name="field_name"/>" id="<inp2:m_param name="field_name"/>">
								<inp2:ord_PrintShippingTypes block="order_shipping_type" currency="selected"/>
							</select>
						</td>
					</tr>
				</inp2:m_DefineElement>

				<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">
						<inp2:m_Phrase label="la_fld_ShippingOptions"/>:
					</td>
					<td class="control-mid">&nbsp;</td>
					<td class="control-cell">
						<inp2:ord_PredefinedOptions field="ShippingOption" block="order_option" selected="checked" />
					</td>
				</tr>

				<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">
						<inp2:m_Phrase label="la_fld_ShippingType"/>:
					</td>
					<td class="control-mid">&nbsp;</td>
					<td class="control-cell">
						<table border="0" cellspacing="1" cellpadding="3" width="100%" style="border: 1px solid black; border-collapse: collapse">
							<tr class="subsectiontitle" style="border-bottom: 1px solid black">
								<td width="25%" style="border-right: 1px solid black"><b><inp2:m_Phrase label="lu_ship_Shipment" /></b></td>
								<td width="45%" style="border-right: 1px solid black"><b><inp2:m_Phrase label="lu_ship_ShippingType" /></b></td>
							</tr>

							<inp2:ord_PrintShippings block="order_shipment" currency="selected"/>
						</table>
					</td>
				</tr>

				<inp2:m_RenderElement name="inp_edit_box" prefix="ord" field="ShippingCost" title="la_fld_ShippingCost" size="10"/>
				<inp2:m_RenderElement name="inp_label" prefix="ord" field="InsuranceFee" title="la_fld_InsuranceFee" size="10" currency="selected"/>
				<inp2:m_RenderElement name="inp_edit_box" prefix="ord" field="ShippingCustomerAccount" title="la_fld_ShippingCustomerAccount" size="30"/>
				<inp2:m_RenderElement name="inp_edit_box" prefix="ord" field="ShippingTracking" title="la_fld_ShippingTracking" size="30"/>
				<inp2:m_RenderElement name="inp_edit_date_time" prefix="ord" field="ShippingDate" title="la_fld_ShippingDate" size="16"/>

			<inp2:m_else/>

				<inp2:m_RenderElement name="inp_label" prefix="ord" field="ShippingTo" title="la_fld_ShippingTo" size="40"/>
				<inp2:m_RenderElement name="inp_label" prefix="ord" field="ShippingCompany" title="la_fld_ShippingCompany" size="40"/>
				<inp2:m_RenderElement name="inp_label" prefix="ord" field="ShippingPhone" title="la_fld_ShippingPhone" size="20"/>
				<inp2:m_RenderElement name="inp_label" prefix="ord" field="ShippingFax" title="la_fld_ShippingFax" size="20"/>
				<inp2:m_RenderElement name="inp_label" prefix="ord" field="ShippingEmail" title="la_fld_ShippingEmail" size="20"/>
				<inp2:m_RenderElement name="inp_label" prefix="ord" field="ShippingAddress1" title="la_fld_ShippingAddress1" size="40"/>
				<inp2:m_RenderElement name="inp_label" prefix="ord" field="ShippingAddress2" title="la_fld_ShippingAddress2" size="40"/>
				<inp2:m_RenderElement name="inp_label" prefix="ord" field="ShippingCity" title="la_fld_ShippingCity" size="20"/>

				<script type="text/javascript">
					function update_address()
					{
						submit_event('ord','OnQuietPreSave');
					}
				</script>

				<inp2:m_RenderElement name="inp_label" prefix="ord" field="ShippingCountry" title="la_fld_ShippingCountry" size="20"/>
				<inp2:m_RenderElement name="inp_label" prefix="ord" field="ShippingState" title="la_fld_ShippingState" size="20"/>

				<inp2:m_RenderElement name="inp_label" prefix="ord" field="ShippingZip" title="la_fld_ShippingZip" size="10"/>

				<inp2:m_DefineElement name="order_option_label">
					<inp2:m_param name="key"/> <inp2:m_phrase label="$option"/>
				</inp2:m_DefineElement>

				<!--inp2:m_ParseBlock name="inp_edit_radio" prefix="ord" field="ShippingOption" title="la_fld_ShippingOption" size="20"/-->

				<inp2:m_DefineElement name="order_shipping_type">
					<option <inp2:m_param name="selected"/> value="<inp2:m_param name="ShippingId"/>"><inp2:m_param name="ShippingName"/> (<inp2:m_param name="TotalCost"/>)
				</inp2:m_DefineElement>

				<inp2:m_DefineElement name="order_shipment_label">
					<inp2:m_param name="shipment"/> - <inp2:ord_PrintShippingTypes block="order_shipping_type" currency="selected" selected_only="1"/>
				</inp2:m_DefineElement>

				<inp2:m_RenderElement name="inp_label" prefix="ord" field="ShippingOption" title="la_fld_ShippingOptions" size="10"/>

				<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">
						<inp2:m_Phrase label="la_fld_ShippingType"/>:
					</td>
					<td class="control-mid">&nbsp;</td>
					<td class="control-cell">
						<inp2:ord_PrintShippings block="order_shipment_label" currency="selected"/>
					</td>
				</tr>

				<inp2:m_RenderElement name="inp_label" prefix="ord" field="ShippingCost" title="la_fld_ShippingCost" size="10" format="$ %.2f"/>

				<inp2:m_RenderElement name="inp_label" prefix="ord" field="InsuranceFee" title="la_fld_InsuranceFee" size="10" format="$ %.2f"/>
				<inp2:m_RenderElement name="inp_label" prefix="ord" field="ShippingCustomerAccount" title="la_fld_ShippingCustomerAccount" size="30"/>

				<inp2:m_DefineElement name="inp_shipping_label" is_last="" as_label="" currency="" is_last="">
					<inp2:m_RenderElement design="form_row" pass_params="1">
						<td valign="top" class="control-cell">
							<inp2:{$prefix}_Field field="$field" as_label="$as_label" currency="$currency"/>

							<inp2:m_if check="{$prefix}_USPSLabelFound" field="$field">
								&nbsp; &nbsp;<a href="#" onClick="javascript:submit_event('<inp2:m_Param name="prefix"/>', 'OnDownloadLabel'); return false;"><inp2:m_Phrase label="la_ViewLabel"/></a>
							</inp2:m_if>
						</td>
					</inp2:m_RenderElement>
				</inp2:m_DefineElement>

				<inp2:m_RenderElement name="inp_shipping_label" prefix="ord" field="ShippingTracking" title="la_fld_ShippingTracking" size="30"/>


				<inp2:m_RenderElement name="inp_label" prefix="ord" field="ShippingDate" title="la_fld_ShippingDate" size="16"/>

			</inp2:m_if>

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

<input type="hidden" name="to_tab" value="Shipping">
<input type="hidden" name="check_shipping_address" value="true" />

<inp2:m_if check="m_Recall" name="sqe_error">
	<script type="text/javascript">
		var $error_table = $('#sqe_error');
		$('td:first', $error_table).html('<inp2:m_Recall name="sqe_error" js_escape="1"/>');
		$error_table.show();
		<inp2:m_RemoveVar name="sqe_error"/>
	</script>
</inp2:m_if>

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