var theme = them + ".htm"
var reche = ""
var rechex = ""
if (parent.parent.location.href == document.location.href)
   {
    if (typediapo == 'calagenda')
      {window.top.location = "../calendrier-agenda.php?prem=diapo&type=" + theme}
      else
      {window.top.location = "Index.htm?theme=" + theme}
   }
   else 
   if (parent.parent.haut.rech == "") 
      {rechex = "Chercher"}
      else
      {rechex = parent.parent.haut.rech}
reche = rechex.toUpperCase()
var num = 0
var charge
var max = 0
var lurl
var cres = 0
var numAffiche = 1
function changer()
{parent.parent.haut.rech = document.all.txtCherche.value}
function initcherche()
{
document.all.txtCherche.value = parent.parent.haut.rech 
if (document.all.txtCherche.value > "")
{
if (num == 0)
   {document.all.tdano.innerHTML = "Aucune photo trouvée pour cette sélection : " + document.all.txtCherche.value}
   else
   {if (num == 1)
       {document.all.tdano.innerHTML = "Une seule photo trouvée pour cette sélection : " + document.all.txtCherche.value} 
       else
       {document.all.tdano.innerHTML = num + " photos trouvées pour cette sélection : " + document.all.txtCherche.value} 
   }
}
setTimeout(PelAffiche,1)
}

function cherche()
{if (document.all.txtCherche.value.length < 3 )
   {alert ("Saisir un ou plusieurs mots (nom, prénom, lieu, ...)\n de plus de 2 lettres avant de cliquer sur 'Chercher'")}
   else
   {parent.parent.haut.rech = document.all.txtCherche.value
   parent.parent.bas.pellicule.location = "Chercher.htm" }
}
function ecr(fic,lib,pel,com,motcle)
{var cherchedans =  lib.toUpperCase() + " - " + fic.toUpperCase() + " - " + pel.toUpperCase() + "-" + com.toUpperCase() + "-" + motcle.toUpperCase()
var rdeb = 0
var rfin = 0
do
{
cres = 1
if (parent.parent.haut.rech == "") 
   {if (num == 0)
   {break}
   else
   {cres = 0
   break} 
   }
rfin = reche.indexOf(" ",rdeb)
if (rfin == -1)
   {cres = 0
   if (cherchedans.indexOf(reche.substring(rdeb,reche.length),0) > -1)
      {cres = 1}  
      break
   }
if (cherchedans.indexOf(reche.substring(rdeb,rfin)) == -1)
   {cres = 0
    break
   }
rdeb = rfin + 1
}
while (cres == 1)

if (cres == 1)
   {
   if (fic == "")
      {document.write (tagpospel + "<TD ALIGN='center'>" + lib + "</TD>" + tagfinpel)}
   else
   {
      if (fic.indexOf(".",0) > -1) 
         { if (parent.parent.haut.rech != "") 
              {document.write (tagpospel + "<TD ALIGN='center'><BR/><A HREF='" + fic + "' TARGET='_new'>" + lib + "</A><BR/></TD>"  + tagfinpel)} 
         }
      else
      {
      num = num + 1
      lurl = fic 
      var ltitle = "TITLE=" + '" ' + lib + "\r Fichier : Photos/" + fic + ".jpg\r Catégorie : " + pel + '"'  
      // document.write (tagpospel + "<TD ALIGN='center'> <A id='photopel' class='lienvignette' HREF='javascript:parent.parent.haut.navigue(" + num + ")' " + ltitle + " TARGET='bigpicture'><img class='vignette' src='Vignettes/" + fic +  ".jpg'></A></TD>"  + tagfinpel)
      document.write (tagpospel + "<TD ALIGN='center'> <A id='photopel' class='lienvignette' HREF='javascript:parent.parent.haut.navigue(" + num + ")' " + ltitle + " TARGET='bigpicture'>Photo " + num + "</A></TD>"  + tagfinpel)
      max = num
      tab[num] = lurl
      ltab[num] = lib
      ctab[num] = com 
      otab[num] = pel  
      if (num == 1)
         {parent.parent.bas.bigpicture.location = "Page.htm"}
      }
   }
return(1)
}
}
function PelAffiche()
{
if (numAffiche <= max)
   {
   var ophoto
   if (max == 1) {ophoto = document.all.photopel} else {ophoto = document.all.photopel[numAffiche -1]}  
   ophoto.innerHTML = "<img class='vignette' src=\"Vignettes/" + tab[numAffiche] +  ".jpg\" style='filter:invert(ENABLED=false)' onload='setTimeout(PelAffiche,1);' onmouseover='imgLumiere(this)' onmouseout='imgNormale(this)'>"
   window.status = "Chargement de la pellicule " + numAffiche + " / " + max + " en cours"
   numAffiche = numAffiche + 1
   }
   else
   {
    if (max > 1)
       {window.status = parent.parent.haut.rech + " : " + max + " Photos"}
       else
       {window.status = "Terminé"}  
   }
}


