
// Création de la base de données
// Pour ouvrir une nouvelle page : FIND_InitBase("_blank");

var find_base=new FIND_InitBase("_self");
	find_base.Add("index.php","<B>Accueil</B>","accueil, meteo, calendrier, telechargement, telechargements, concours, amical, tar, samedi, 4, avril, equipe, fidele, resultat, resultats");
	find_base.Add("reportages.php","<B>Reportages</B>","reportages, photos");
	find_base.Add("formalites.php","<B>Formalités</B>","formalites");
	find_base.Add("installations.php","<B>Installations</B>","installations");
	
function FIND_InitBase(target)
	{this.nb_item=0;
	this.target=target;
	this.Add=AddItem;
	this.Search=SearchItem;}

function AddItem(page,desc,cle)
	{var nb = this.nb_item;
	var item = new Object;
		item.page=page;
		item.desc=desc;
		item.cle=cle;
	this[nb]=item;
	this.nb_item++;}

// txt contient le texte de la recherche

function SearchItem(txt)
	{txt = unescape(txt);
	txt = txt.replace(/\+/g," ");

var n=find_base.nb_item;

var indice=-1;

if (txt=="")
	{alert("Entrez un mot pour la recherche");}

else
	{document.forms["find_search"].elements["mot"].value=txt;

var Z="";

var nb=0;

for (var i=0; i<n; i++)
	{if (find_base[i].cle.toUpperCase().indexOf(txt.toUpperCase(),0)!="-1")
	{Z+="• <A TARGET='"+find_base.target+"' HREF='"+find_base[i].page+"'>"+find_base[i].desc+"</A><BR>&nbsp;&nbsp;("+find_base[i].page+")<BR><BR>"
	nb++;}}

if (nb>0)
	{if (nb==1)
	{Z=nb+" résultat trouvé pour la recherche sur <FONT COLOR=\"#000080\"><B> "+txt+"</B></FONT> : <BR><BR>"+Z;}

else
	{Z=nb+" résultats trouvés pour la recherche sur <FONT COLOR=\"#000080\"><B>"+txt+"</B></FONT> : <BR><BR>"+Z;}}

else
	{Z=nb+" résultat pour la recherche sur <FONT COLOR=\"#000080\"><B>"+txt+"</B></FONT>.<BR>Vérifiez l'orthographe ou essayez un autre mot clé.";}
	document.write(Z);}}

function FIND_Search(f)
	{if (f.mot.value!=""){f.submit();}}

function FIND_PrintResult()
	{var url=document.location.href;

if (url.indexOf("?mot=",0) > 0)
	{var mot=url.substring(url.indexOf("?mot=",0)+5);
	SearchItem(mot);}}
