
function pickSecteur(obj)
{
	if (obj.options[obj.selectedIndex].value > 0)
	{
		window.location.href = './?sec=' + obj.options[obj.selectedIndex].value;
	}
}

function pickMois(obj)
{
	if (obj.options[obj.selectedIndex].value > 0)
	{
		window.location.href = './?mo=' + obj.options[obj.selectedIndex].value;
	}
}


function pickRecherche(obj)
{
	tmp_search = trimApos(trimQuote(trim(MM_findObj('rechInput').value)));
	
	while( tmp_search.substr(0, 1) == " " || tmp_search.substr(0, 1) == "'"  || tmp_search.substr(0, 1) == "\"" ) 
	{
			tmp_search = trimApos(trimQuote(trim(tmp_search)));
	}

	if (tmp_search.length > 2)
	{
		tmpStr = '../recherche/?recherche=' + format(tmp_search);
		window.location.href = tmpStr;
	}
	else
	{
		alert("La recherche doit être d'au moins 3 caractères alphabétiques");
		MM_findObj('rechInput').value = "";
	}
	return false;
}

function trim(val)
{
  var txt = val;
  while (txt.substr(0, 1) == " ") {txt = txt.substr(1, txt.length);}
  while (txt.substr(txt.length-1, 1) == " ") {txt = txt.substr(0, txt.length-1);}

  return txt;
}

function trimApos(val)
{
  var txt = val;
  while (txt.substr(0, 1) == "'") {txt = txt.substr(1, txt.length);}
  while (txt.substr(txt.length-1, 1) == "'") {txt = txt.substr(0, txt.length-1);}

  return txt;
}

function trimQuote(val)
{
  var txt = val;
  while (txt.substr(0, 1) == "\"") {txt = txt.substr(1, txt.length);}
  while (txt.substr(txt.length-1, 1) == "\"") {txt = txt.substr(0, txt.length-1);}

  return txt;
}