    window.addEvent('domready',function() {
      	
		Shadowbox.init(); load(); 

		if (document.images)
		{
		  preload_image = new Image(1384,1114); 
		  preload_image.src="images/bg-slice-1.png";	   
		}
  		  
	  /* settings */
      var showDuration = 5000;
      var currentIndex = 0;
      var interval;
      var listeImages = Array();
      var listeURL = Array();
      var listeTextes = Array();

      var req = new Request({
        method : 'get',
		url: document.getElementById('lang').value,
        onSuccess: function(txt,xml){
          /* On récupère les données du xml */
          x=xml.documentElement.getElementsByTagName("diapositive");
          for (i=0;i<x.length;i++){
            xx=x[i].getElementsByTagName("image");
            {
              try{listeImages[i] = xx[0].firstChild.nodeValue;}
              catch (er){listeImages[i] = '';}
            }
          }

          /* Création des images */
          for(i=0;i<listeImages.length;i++){
				new Element("div",{id : "imageDiamorama"+i,"class" : "imagesDiaporama",style : "opacity:0;"})
					.adopt(new Element("img",{
						src : listeImages[i],
						alt : listeTextes[i]}))
				.inject($('imagesDiaporama'));
          }
          var images = $('imagesDiaporama').getElements('div.imagesDiaporama');

          /* Initialisation de la première diapositive */
          images[0].set('opacity','1');

          /* Création des boutons de navigation */
          images.each(function(img,i){

            new Element("a", {
              href: "#",
              id: 'navigation'+i,
              text: ' ',
              'class': (i == 0)?'actif':'',
              events: {
                click: function(e) {
                  e.stop();
                  images[currentIndex].fade('out');
                  images[currentIndex=i].fade('in');
                  boutonActif(i);
					  clearInterval(interval);
					  interval = show.periodical(showDuration);
                },
                mouseenter: function(e){
                  $('navigation'+i).morph('.actif');
                },
                mouseleave: function(e){
                  if(i != currentIndex){
                    $('navigation'+i).morph('.inactif');
                  }
                }
              }
            }).inject($("indiceDiaporama"));
          });

          /* Transition pour les bouton de navigation */
          var boutonActif = function(index){
				//console.log(index);
            for(var l=0;l<images.length;l++){
              if(l == index){
                $('navigation'+l).className='actif';
              }else{
                $('navigation'+l).className='';
              }
            }
          };

          /* Comportement à adopter lors de la transition */
          var show = function() {
            images[currentIndex].fade('out');
            images[currentIndex = currentIndex < images.length - 1 ? currentIndex+1 : 0].fade('in');
            boutonActif(currentIndex);
          };

          /*On lance le diaporama */
          interval = show.periodical(showDuration);
         
        },
        onFailure: function(txt){
          alert('Erreur dans le chargement des données');
        }

      });
      req.send();

    });

