<inp2:adm_SetPopupSize width="750" height="400"/>

<inp2:m_include t="incs/header"/>
<inp2:m_RenderElement name="combined_header" prefix="ls" section="in-link:paid_listings" title_preset="listing_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('ls','<inp2:ls_SaveEvent/>');
						}
					) );
				a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
						submit_event('ls','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('ls', '<inp2:ls_PrevId/>');
						}
				 ) );
				a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
							go_to_id('ls', '<inp2:ls_NextId/>');
						}
				 ) );

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

				a_toolbar.Render();

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

<inp2:ls_SaveWarning name="grid_save_warning"/>
<inp2:ls_ErrorWarning name="form_error_warning"/>

<div id="scroll_container">
	<table class="edit-form">
		<inp2:m_RenderElement name="subsection" title="la_Text_PaidListing"/>
			<inp2:m_RenderElement name="inp_label" prefix="ls" field="ListingId" title="la_fld_ListingId"/>

			<inp2:m_RenderElement name="inp_edit_options" prefix="ls" field="ListingTypeId" title="la_fld_ListingType" onchange="set_exp_date()" />

			<inp2:m_RenderElement design="form_row" prefix="ls" field="LinkName" title="la_fld_LinkName">
				<td class="control-cell">
					<inp2:ls_Field name="LinkName" />
					<a href="javascript:select_link();"><img src="<inp2:m_TemplatesBase module='in-link'/>/img/link_arrow.gif" border="0"></a>
				</td>
			</inp2:m_RenderElement>

			<inp2:m_RenderElement name="inp_edit_radio" prefix="ls" field="Status" title="la_fld_Status"/>
			<inp2:m_RenderElement name="inp_edit_checkbox" prefix="ls" field="PendingRenewal" title="la_fld_PendingRenewal"/>
			<inp2:m_RenderElement name="inp_edit_date_time" prefix="ls" field="PurchasedOn" title="la_fld_PurchasedOn"/>
			<inp2:m_RenderElement name="inp_edit_date_time" prefix="ls" field="ExpiresOn" title="la_fld_ExpiresOn"/>
		<inp2:m_RenderElement name="inp_edit_filler"/>
	</table>
</div>

<script type="text/javascript">
	function select_link()
	{
		openSelector('ls', '<inp2:adm_SelectorLink prefix="ls" selection_mode="single" tab_prefixes="l"/>', 'ItemResourceId', null, 'OnPreSaveListing');
	}

	function set_exp_date()
	{
		exp_date = exp_dates[document.getElementById('<inp2:ls_InputName field="ListingTypeId" />').value];
		exp_time = exp_times[document.getElementById('<inp2:ls_InputName field="ListingTypeId" />').value];
		if (typeof(exp_date) != 'undefined') {
		document.getElementById('<inp2:ls_InputName field="ExpiresOn_date" />').value = exp_date;
		document.getElementById('<inp2:ls_InputName field="ExpiresOn_time" />').value = exp_time;
		}
	}

	var exp_dates = new Array();
	var exp_times = new Array();
	<inp2:m_DefineElement name="exp_date_elem" >
		exp_dates[<inp2:Field name="ListingTypeId" />] = "<inp2:ls_ExpirationDate />";
		exp_times[<inp2:Field name="ListingTypeId" />] = "<inp2:ls_ExpirationTime />";
	</inp2:m_DefineElement>
	<inp2:lst_PrintList block="exp_date_elem" />

	<inp2:m_if check="m_getequals" param="ls_event" value="OnPreCreate">
		set_exp_date();
	</inp2:m_if>
</script>

<input type="hidden" name="main_prefix" id="main_prefix" value="ls">
<inp2:m_include t="incs/footer"/>