<inp2:m_include t="incs/header"/>
<inp2:m_RenderElement name="combined_header" prefix="rep" section="in-commerce:reports" title_preset="report_options"/>

<!-- 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_RunReport" escape="1"/>', function() {

//						set_hidden_field('progress_t', '../../plugins/reports/admin_templates/progress');
						set_hidden_field('progress_t', 'in-commerce/reports/progress');

//						set_hidden_field('reports_finish_t', '../../plugins/reports/admin_templates/results');
						set_hidden_field('reports_finish_t', 'in-commerce/reports/results');
						submit_event('rep','OnRunReport');

						}
					) );

				a_toolbar.Render();
			</script>
		</td>
	</tr>
</tbody>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
	<inp2:m_RenderElement name="subsection" title="!la_section_General!"/>

		<inp2:m_RenderElement name="inp_edit_radio" prefix="rep" field="ReportType" title="la_fld_ReportType" use_phrases="1"/>

		<inp2:m_RenderElement name="inp_edit_date" prefix="rep" field="FromDateTime" title="!la_fld_FromDateTime!"/>
		<inp2:m_RenderElement name="inp_edit_date" prefix="rep" field="ToDateTime" title="!la_fld_ToDateTime!"/>

		<script type="text/javascript">
			function updateTimeFrame(option) {
				from_date = '';
				to_date = '';
				if (option == 'last_week') {
					from_date = '<inp2:adm_TimeFrame type="last_week_start" format="_regional_InputDateFormat"/>';
					to_date = '<inp2:adm_TimeFrame type="last_week_end" format="_regional_InputDateFormat"/>';
				}

				if (option == 'last_month') {
					from_date = '<inp2:adm_TimeFrame type="last_month_start" format="_regional_InputDateFormat"/>';
					to_date = '<inp2:adm_TimeFrame type="last_month_end" format="_regional_InputDateFormat"/>';
				}

				if (option == 'last_quater') {
					from_date = '<inp2:adm_TimeFrame type="last_quater_start" format="_regional_InputDateFormat"/>';
					to_date = '<inp2:adm_TimeFrame type="last_quater_end" format="_regional_InputDateFormat"/>';
				}

				if (option == 'last_6months') {
					from_date = '<inp2:adm_TimeFrame type="last_6_months_start" format="_regional_InputDateFormat"/>';
					to_date = '<inp2:adm_TimeFrame type="last_month_end" format="_regional_InputDateFormat"/>';
				}

				if (option == 'last_year') {
					from_date = '<inp2:adm_TimeFrame type="last_year_start" format="_regional_InputDateFormat"/>';
					to_date = '<inp2:adm_TimeFrame type="last_year_end" format="_regional_InputDateFormat"/>';
				}


				document.getElementById('<inp2:rep_InputName field="FromDateTime_date"/>').value = from_date;
				document.getElementById('<inp2:rep_InputName field="ToDateTime_date"/>').value = to_date;
			}
		</script>

	<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_comm_Timeframe"/>:
		</td>
		<td class="control-mid">&nbsp;</td>
		<td class="control-cell">
			<select id="timeframe" onchange="updateTimeFrame(this.value)">
				<option value=""></option>
				<option value="last_week"><inp2:m_Phrase label="lu_comm_LastWeek"/></option>
				<option value="last_month"><inp2:m_Phrase label="lu_comm_LastMonth"/></option>
				<option value="last_quater"><inp2:m_Phrase label="lu_comm_LastQuater"/></option>
				<option value="last_6months"><inp2:m_Phrase label="lu_comm_Last6Months"/></option>
				<option value="last_year"><inp2:m_Phrase label="lu_comm_LastYear"/></option>
			</select>
		</td>
	</tr>

	<!--<inp2:m_RenderElement name="inp_edit_checkbox" prefix="rep" field="Recursive" title="la_fld_Recursive"/>
	<inp2:m_RenderElement name="inp_edit_checkbox" prefix="rep" field="SkipEmpty" title="la_fld_SkipEmpty"/>-->

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

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