/* gestion des onglets de la recherche

Code exemple : Il est nécessaire de mettre le script après le html, sinon ça provoque une erreur

<ul>
	<li id="1">111</li>
	<li id="2">222</li>
	<li id="3">333</li>
</ul>

<div id="bloc1">onglet 1 test</div>
<div id="bloc2">onglet 2 test</div>
<div id="bloc3">onglet 3 test</div>

<script>
var lo = new ListeOnglets();
lo.addOnglet('1', 'bloc1');
lo.addOnglet('2', 'bloc2');
lo.addOnglet('3', 'bloc3');

lo.choisirOnglet('1');
</script>

*/

function ListeOnglets()
{
	this.onglets = new Array();
	
	this.addOnglet = function(idOnglet, idBlocAssocie)
	{
		this.onglets.push(new Onglet(idOnglet, idBlocAssocie, this));
	}
	
	this.choisirOnglet = function(id_onglet)
	{
		for (i = 0; i < this.onglets.length; i++)
		{
			var onglet = this.onglets[i];
			if (id_onglet == onglet.id)
				onglet.show();
			else
				onglet.hide();
		}
	}
}

function Onglet(id, bloc, lo)
{
	this.id = id;	
	
	document.getElementById(id).onclick = function(e)
	{
		lo.choisirOnglet(id);
		return false;
	}
	
	this.show = function()
	{
		document.getElementById(id).className = 'selected';
		document.getElementById(bloc).style.display = 'block';
		document.getElementById(bloc).style.visibility = 'visible';
	}
	
	this.hide = function()
	{
		document.getElementById(id).className = '';
		document.getElementById(bloc).style.display = 'none';
		document.getElementById(bloc).style.visibility = 'hidden';
	}
}
