<?php

function snippet_ajaxSearchForm($snippetController)
{

	if (!$_REQUEST['form']) {
		return;
	}

	if ($_REQUEST['form']==='restateFilter') {
		// $_REQUEST['scheme']
		// @todo sanitize value
		$snippetController->isOutputPrevented(true);
		$w = carabi\restateListFilterForms\Form::create($_REQUEST['scheme']);

		if ($w instanceof carabi\restateListFilterForms\iAjaxForm)
				$w->displayAjax();
	} else {

		$searchForms = array('offices_top_form', 'office_search_full', 'office_bookmarks_full',
					'warehouse_top_form', 'warehouse_search_full', 'warehouse_bookmarks_full'
					/*, 'catalog_search'*/);
		//$path = '';

		$snippetController->isOutputPrevented(true);	
		if (!in_array($_REQUEST['form'], $searchForms)) {
			return;
		}

		$renderer = utls::get_renderer();
		$tmplt = $renderer->createTemplate('ajaxSearchForms/' . $_REQUEST['form'] . '.tpl');
		$tmplt->display();
	}
}

?>