url_images="";

lesSources=new Array();
lesLegendes=new Array();

//initialisation
i=0;

//on initialise l'arrêt à false pour la pause
arret=false;

function montre(id) {
  var d = document.getElementById(id);
  for (var i = 1; i<=10; i++) {
    if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
  }
  if (d) {d.style.display='block';}
}

function noclic(clic){
  
  var mess="Le clic droit a été désactivé..."; //Vous pouvez changer ce message
  if (navigator.appName == 'Netscape' && clic.which==3) {
    alert(mess);
  }
  
  else
  if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
    alert(mess);
  } }
  
  if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);
  }
  
  document.onmousedown = noclic;
  
  function diaporama(){//alert(lesSources.length);
    timer=setTimeout("diaporama()", 3500);
    MonIm=document.getElementById("im");
    source=lesSources[i].replace(/(icone)/, "web");
    MonIm.src=source;
    MaDiv=document.getElementById("reservoir");
    MaDiv.style.visibility="visible";
    if(i==(lesSources.length-1)){
      i=0;
    }
    else{
      i++;
      im=new Image;
      im.src=source;
    }
  }
  
  function lancerdiapo(codepho, legendes){
    lesSources=new Array();
    lesLegendes=new Array();
    var code=codepho.split(',');
    for(j=0;j<code.length;j++){
      lesSources.push(code[j]);
    }
    var legende=legendes.split(',');
    for(k=0;k<legende.length;k++){
      lesLegendes.push(legende[k]);
    }
    
    diapo();
  }
  
  function diapo(){
    timer=setTimeout("diapo()", 3500);
    MonIm=document.getElementById("im");
    MonH3=document.getElementById("monH3");
    //source="http://127.0.0.1/rencarts/photos/photo"+lesSources[i]+"_web.jpg";
    source="http://rencarts.fr/photos/photo"+lesSources[i]+"_web.jpg";
    legende=lesLegendes[i];
    MonIm.src=source;
    var premierEnfant=MonH3.firstChild;
    MonH3.removeChild(premierEnfant);
    texte=document.createTextNode(legende);
    MonH3.appendChild(texte);
    MaDiv=document.getElementById("reservoir");
    MaDiv.style.visibility="visible";
    if(i==(lesSources.length-1)){
      i=0;
    }
    else{
      i++;
      im=new Image;
      im.src=source;
    }
  }
  
  function afficheFormulaire(){;
    form=document.getElementById("formulaireDiapo");
    form.style.display="block";
    
    chpSaisie=document.createElement("div");
    chpSaisie.setAttribute("class","chpSaisie");
    form.appendChild(chpSaisie);
    //Le tableau de photos
    
    for(i=0;i<(lesSources.length);i++){
      var re=/[A-Z0-9]{4}/;
      code=re.exec(lesSources[i]);
      cache=document.createElement("input");
      cache.setAttribute("type","hidden");
      cache.setAttribute("name","diapos[]");
      cache.setAttribute("value",code);
      chpSaisie.appendChild(cache);
    }
    
  }
  
  
  function stop(){
    clearTimeout (timer);
    //on rajoute le if -- else pour faire la pause
    if(!arret){
      arret=true;
      div=document.getElementById("pause");
      }else{
      diapo();
      arret=false;
    }
    //on enlève ce qui suit pour faire la pause
    /*    maDiv=document.getElementById("reservoir");
    maDiv.style.visibility="hidden";*/
  }
  
  function my_DropFunc () {
    if ((dd.obj.x < 510) && (dd.obj.x > 350)){
      lesSources.push(dd.obj.src);
      }else{
      dd.obj.moveTo(dd.obj.defx,dd.obj.defy);
      for(j=0;j<lesSources.length;j++) {
        if (lesSources[j]==dd.obj.src) {
          lesSources.splice(j,1);
        }
      }
    }
  }
  
  
  function arreter(){
    clearTimeout(timer);
    MaDiv=document.getElementById("reservoir");
    MaDiv.style.visibility="hidden";
  }
  
  function go(source, x, y){
    fenetre=window.open(source, 'mairie', 'resizable=yes, screenX=0, screenY=0, width=150px ,height=180px, top=50px, left=400px, scrollbars=yes');
    fenetre.resizeTo(x, y);
    fenetre.focus();
  }
  
  function ouvreFenetre(source){
    fenetre=window.open(source, 'mairie', 'resizable=yes, screenX=0, screenY=0, width=600px ,height=640px, top=50px, left=400px, scrollbars=yes');
    fenetre.focus();
  }
  
  function zoom(source){
    fenetre=window.open(source, 'zoom', 'resizable=yes, screenX=0, screenY=0, width=580px ,height=540px, top=100px, left=420px, scrollbars=yes');
    fenetre.focus();
  }
  
  var imagesDanielLeSaux=new Array("belloJacketEtSonMatelot", "jeannotLesLongsBras","betchetteEtCarralette","exVotoDeLaMarieToto","exVotoDeLaMarieToto2","jambeDeLune","martinsPecheurs","petiteHistoireAvecLaMer","petiteHistoireAvecLaMer2","petiteHistoireAvecLaMer3","PorteursDeGodaille");
  var legendesDanielLeSaux=new Array("Bello jacket et son matelot", "Jeannot les longs bras","Betchette et carralette","Ex voto de la Marie Toto","Ex voto de la Marie Toto","Jambe de lune","Martins pêcheurs","Petite histoire avec la mer","Petite histoire avec la mer","Petite histoire avec la mer","Porteurs de godaille");
  var p=0;
  function afficheImagePrecedente(){
    if(p-1>=0){
      p--;
      image=document.getElementById("imageDanielLeSaux");
      image.setAttribute("src","../images/"+imagesDanielLeSaux[p]+".gif");
      
      divLegende=document.getElementById("legendeDanielLeSaux");
      texteLegende=document.createTextNode(legendesDanielLeSaux[p]);
      
      var premierEnfant=divLegende.firstChild;
      divLegende.removeChild(premierEnfant);
      
      divLegende.appendChild(texteLegende);
    }
  }
  
  function afficheImageSuivante(){
    if(p+1<imagesDanielLeSaux.length){
      p++;
      image=document.getElementById("imageDanielLeSaux");
      image.setAttribute("src","../images/"+imagesDanielLeSaux[p]+".gif");
      
      divLegende=document.getElementById("legendeDanielLeSaux");
      texteLegende=document.createTextNode(legendesDanielLeSaux[p]);
      
      var premierEnfant=divLegende.firstChild;
      divLegende.removeChild(premierEnfant);
      
      divLegende.appendChild(texteLegende);
    }
  }

