var courante=1    //  numéro de l'image en cours, dans le diaporam (1 à n)
var cptBoucle     //  objet résultat du setTimeout
var cptZoomAuto   // objet résultat pour le zoomauto 
var indim=true   //  indicateur de redimensionnement d'image (true = taille fenêtre)
var camon=false   // indicateur de diaporama automatique (true = auto)
var camvar = 5000    // temps d'affichage d'une diapo en millisecondes
var dragstartx = 0
var dragstarty = 0
var dragstartelem
function fdragstart(el,x,y)
   {
   dragstartelem = el
   /* el.style.cursor='move' */
   dragstartx = x
   dragstarty = y
   dragbodyx = parent.parent.bas.bigpicture.document.body.scrollLeft
   dragbodyy = parent.parent.bas.bigpicture.document.body.scrollTop
   }
function fdragend(x,y)
{
// alert("x=" + dragstartx +',' + x + "  y=" + dragstarty +',' + y )
// dragstartelem.style.cursor='hand'
// parent.parent.bas.bigpicture.document.body.scrollLeft = dragbodyx + dragstartx - x
// parent.parent.bas.bigpicture.document.body.scrollTop = dragbodyy + dragstarty - y
}
function fdragmove(x,y)
{
parent.parent.bas.bigpicture.scrollTo (dragbodyx + dragstartx - x,dragbodyy + dragstarty - y)
}
function plus()
    {
    zoomer(1.2)
    }
function moins()
    {
    zoomer(1/1.2)
    }
function zoomer(num)
    {
    indim = false
    document.all.titreajuster.title = "Ajuster à la fenêtre"    
    parent.bas.bigpicture.document.all.photo.width = parent.bas.bigpicture.document.all.photo.width * num
    assister()
    }
function prem()
    {
    
    navigue(1)
    }
function der()
    {
    
    navigue (parent.bas.pellicule.max)
    } 
function suiv()
{  
if (courante < parent.bas.pellicule.max)
   {  navigue(courante + 1)  }
   else
   {if (document.nform.ntheme.selectedIndex < document.nform.ntheme.length - 1)
      {document.nform.ntheme.selectedIndex ++}
      else
      {document.nform.ntheme.selectedIndex = 0}
       ad = document.nform.ntheme.selectedIndex
       parent.bas.pellicule.document.location = document.nform.ntheme.options[ad].value
   }
}
function prec()
{
   
if (courante > 1)
   {navigue(courante - 1)}
   else
   {if (document.nform.ntheme.selectedIndex > 0)
       {document.nform.ntheme.selectedIndex --}
       else
       {document.nform.ntheme.selectedIndex = document.nform.ntheme.length - 1}
   ad = document.nform.ntheme.selectedIndex
   parent.bas.pellicule.document.location = document.nform.ntheme.options[ad].value 
   }  
}
function ajuster()
{

if (indim == true)
   {
   indim = false
   document.all.titreajuster.title = "Ajuster à la fenêtre"
   parent.bas.bigpicture.document.all.photo.outerHTML = "<IMG BORDER='2' id='photo' ondragstart='parent.parent.haut.fdragstart(window.event.srcElement,window.event.x,window.event.y)' ondragend='parent.parent.haut.fdragend(window.event.x,window.event.y)' ondragover='parent.parent.haut.fdragmove(window.event.x,window.event.y)' onclick='parent.parent.haut.ajuster()' style='cursor:hand' onload=rsz()  style='filter:revealTrans(duration=2,transition=23)'>"
   x = parent.bas.bigpicture.charge(lurl,llib,lobjet,lcom)
   x = parent.bas.bigpicture.rsz()
   }
   else
   { 
   indim = true
   document.all.titreajuster.title = "Taille réelle de la photo"
   x = parent.bas.bigpicture.rsz()
   }
   assister()
}
function navigue(num)
   {
   try
   {
   indim = true
   document.all.titreajuster.title = "Taille réelle de la photo"   
   courante = num
      lurl = "Photos/" + parent.bas.pellicule.tab[num] + ".jpg"
      llib = parent.bas.pellicule.ltab[num]
      lobjet = parent.bas.pellicule.otab[num]
      lcom = parent.bas.pellicule.ctab[num]
      x = parent.bas.bigpicture.charge(lurl,llib,lobjet,lcom)
       if ((camon == true) && (camvar > 4000))
         {
         parent.bas.bigpicture.document.all.photo.filters.revealTrans.Transition=23
         parent.bas.bigpicture.document.all.photo.filters.revealTrans.stop()
         parent.bas.bigpicture.document.all.photo.filters.revealTrans.apply()
         parent.bas.bigpicture.document.all.photo.filters.revealTrans.play()
         } 
         else
         {
          parent.bas.bigpicture.document.all.photo.filters.revealTrans.Transition=1
          parent.bas.bigpicture.document.all.photo.filters.revealTrans.stop()}
   parent.bas.pellicule.document.all.photo[num-1].focus()
   }
   catch(e) {} 
   }

function camera()
{
if (camon == false)
   {
   camon = true
   parent.bas.bigpicture.document.body.scroll = "no"
   document.all.titrediapo.title = "Cliquer ici pour arrêter l'enchaînement toutes les " + camvar/1000 + " secondes"
   x = parent.bas.bigpicture.rsz()
   cptBoucle = window.setInterval("suiv()",camvar)
   }
   else
   {
   camon = false
   parent.bas.bigpicture.document.body.scroll = "auto"
   window.clearInterval(cptBoucle)
   // window.clearTimeout(cptBoucle)
   document.all.titrediapo.title = "Cliquer ici pour un diaporama toutes les " + camvar/1000 + " secondes."
   }
}
function cameravar(x)
{
camvar = x
if (camon == false)
   {document.all.titrediapo.title = "Cliquez ici pour un diaporama toutes les " + camvar/1000 + " secondes."}
   else
   {document.all.titrediapo.title = "Cliquer ici pour arrêter l'enchaînement toutes les " + camvar/1000 + " secondes"
   window.clearInterval(cptBoucle)
   cptBoucle = window.setInterval("suiv()",camvar)   
    }
}
function assister()
{
if (indim == false)
   {if (parent.parent.bas.bigpicture.document.body.scrollHeight < parent.parent.bas.bigpicture.document.body.clientHeight)
        {parent.bas.bigpicture.document.all.photo.title = parent.bas.bigpicture.document.all.photo.titre + "\r\rCliquer pour ajuster l'image à la fenêtre."}
        else
        {parent.bas.bigpicture.document.all.photo.title = parent.bas.bigpicture.document.all.photo.titre + "\r\rVous pouvez faire glisser l'image avec la souris."}
    }
   else
   {parent.bas.bigpicture.document.all.photo.title = parent.bas.bigpicture.document.all.photo.titre + "\r\rCliquer pour ajuster l'image à sa taille réelle"}

}

