<inp2:adm_SetPopupSize width="515" height="194"/>
<inp2:m_include t="incs/header"/>

<inp2:m_Get var="PrefixSpecial" result_to_var="exportprefix" />
<inp2:{$exportprefix}_PermSection section="main" result_to_var="permsection" />
<inp2:m_RenderElement name="combined_header" section="$permsection" prefix="adm" title_preset="csv_export"/>

	<inp2:m_RenderElement name="ajax_progress_bar" cancel_action="cancel_action();"/>
	<script type="text/javascript">
		function cancel_action() {
			redirect('<inp2:m_Link template="export/export_complete"/>');
		}

		function rand(n)
		{
			return (Math.floor(Math.random() * n + 1));
		}

		var PrefixSpecial = '<inp2:m_Get var="PrefixSpecial" js_escape="1" />';
		var grid = '<inp2:m_Get var="grid" js_escape="1" />';
		var export_rand = '';
		for(var i=0; i<10; i++) {
			export_rand += (rand(10) - 1);
		}
		var action_url = '<inp2:m_t template="index" adm_event="OnExportCSV" type="return_progress" finish_template="export/export_complete" PrefixSpecial="#PrefixSpecial#" grid="#grid#" export_rand="#export_rand#" pass="m,adm" no_amp="1"/>';
		action_url = action_url.replace('#PrefixSpecial#', PrefixSpecial);
		action_url = action_url.replace('#grid#', grid);
		action_url = action_url.replace('#export_rand#', export_rand);

	//	window.open(action_url);

		$QueueProcessor = new AjaxProgressBar(action_url);
	</script>

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