<?php

function mp_filter_drop_down($key, &$filter) {

	//	// version div stick
	//	// version div switch
	//	// version div visibility
	//

	$content = '
		<div class="filter_menu filter_menu_drop" style="display:none;" tabindex=0>
			<div class="filter_menu_title filter_menu_drop_title" tabindex=0>
				<p>'.$key.'</p>
			</div>
			<div class="filter_menu_drop_items" tabindex=0>
	';
	foreach ($filter as $value) {
				/*
				<p id="'.$value->_name.    '" onblur="filter_show_only_selection('.json_encode($value->indexes).')">'.$value->_name.'</p>
				<p id="'.$value->_name.   '" onfocus="filter_show_only_selection('.json_encode($value->indexes).')">'.$value->_name.'</p>
				<p id="'.$value->_name. '" onfocusin="filter_show_only_selection('.json_encode($value->indexes).')">'.$value->_name.'</p>
				<p id="'.$value->_name.'" onfocusout="filter_show_only_selection('.json_encode($value->indexes).')">'.$value->_name.'</p>
				*/
		$content .= '
				<p id="'.$value->_name.   '" onclick="filter_show_only_selection('.json_encode($value->indexes).')">'.$value->_name.'</p>
		';
	}
	$content .= '
			</div>
		</div>
	';

	return $content;
};

function mp_filter_buttons($key, &$filter) {

	//	<p onclick="filter_show_all()">TOUT DESELECTIONNER</p>

	$content = '
		<div class="filter_menu filter_menu_buttons" style="display:none;">
	';
	foreach ($filter as $value) {
		$content .= '
			<div class="filter_menu_title filter_menu_buttons_title" tabindex=0>
				<p id="'.$value->_name.'" onclick="filter_show_only_selection('.json_encode($value->indexes).')">'.$value->_name.'</p>
			</div>
		';
	}
	$content .= '
		</div>
	';

	return $content;
};

function mp_create_div(&$filters) {
	$mp_map_div  = '
		<div id="ljdp_map_wrapper">
			<div id="ljdp_map_filters">
	';

	foreach ($filters as $key => $filter) {

		if ($key == "mode")
			$mp_map_div .= mp_filter_buttons($key, $filter);
		else
			$mp_map_div .= mp_filter_drop_down($key, $filter);
	};

	$mp_map_div .= '
				<div class="filter_menu filter_menu_reset">
					<div class="filter_menu_title filter_menu_reset_title">
						<p onclick="filter_show_all()">sans filtre</p>
					</div>
				</div>
	';

	$mp_map_div .= '
			</div>
			<div id="ljdp_map"></div>
		</div>
	';

	return $mp_map_div;
};


	//	// version div title
	//	
	//	$content .= '
	//		<div class="filter_menu" style="display:none;">
	//			<div class="filter_menu_drop">
	//				<p class="filter_menu_drop_title" tabindex=0>'.$key.'</p>
	//				<p onclick="filter_show_all()">TOUT DESELECTIONNER</p>
	//	';
	//	foreach ($filter as $value) {
	//		$content .= '
	//				<p onclick="filter_show_only_selection('.json_encode($value->indexes).', false)">'.$value->_name.'</p>
	//		';
	//	}
	//	$content .= '
	//			</div>
	//		</div>
	//	';


	//	// version input checkbox
	//	
	//	$content .= '
	//		<div class="filter_menu">
	//			<input  id="filter_menu_title_${key}" class="filter_menu_title" type="checkbox" />
	//			<label for="filter_menu_title_${key}" class="filter_menu_title">
	//				<p>'.$key.'</p>
	//			</label>
	//			<div class="filter_menu_drop">
	//	';
	//	foreach ($filter as $value) {
	//		$content .= '
	//				<p>'.$value._name.'</p>
	//		';
	//	}
	//	$content .= '
	//			</div>
	//		</div>
	//	';


	//	// version select
	//	
	//	$content .= '
	//		<div class="filter_menu">
	//			<select id="filter_menu_drop_'.$key.'" class="filter_menu_drop" name="'.$key.'">
	//	';
	//	foreach ($filter as $value) {
	//		$content .= '
	//				<option value="'.$value._name.'"><p>'.$value._name.'</p></option>
	//		';
	//	}
	//	$content .= '
	//			</select>
	//		</div>
	//	';

?>
