
/* Laurent Peter All rights reserved laurent at versateladsl dot be */ 

function setidtxt(idmsg,txt,timeout){
			      var el=$(idmsg);
			      el.innerHTML=txt;
			      var eduration=timeout +".0";
			      scolor = (typeof scolor == 'undefined') ? '#336699' : scolor;
			      ecolor = (typeof ecolor == 'undefined') ? '#ffff99' : ecolor;
			      //Effect.Pulsate(idmsg, { pulses: 10, duration: 5 })
			      el.show();
			      el.style.display="inline";
			      
			      new Effect.Highlight(idmsg, { 	startcolor: scolor,
									endcolor: ecolor,
									duration:eduration,
									keepBackgroundImage:true
											      });
										      
			      setTimeout(function(){ el.innerHTML="";el.hide();}, timeout * 1000);
    		      }
/* TABLES : alterne les couleurs de lignes */
/* usage: zebre("maclasse"), maclasse etant la classe de la table en question */
function zebra(myclass){				
	var tables=$$('table[class="' + myclass + '"]');
	for(var i=0;i<tables.length;i++){
		var rows=tables[i].select('tr');
		for(var j=1;j<rows.length;j++){
			if(j%2==0){
				rows[j].addClassName('even');
			}
			else{
				rows[j].addClassName('odd');
			}
		}
	}	
}
function zebre(mytable){
	Event.observe(window,'load', zebra.bind(this,mytable), false);
}	

/* TABS : classe pour activer les tabs (show content) : Usage : var testtab=new mytabs('ctabs'); ctabs=css class of tab container*/

var mytabs = Class.create({
				initialize: function(tabclass){
					this.tabcontainers=$$('[class=' + tabclass +']');
					this.nbobj=this.tabcontainers.length;
					this.tabobject=new Array();
					this.lis=new Array();
					this.nblis=new Array();
					this.activeli=new Array();
					this.tabcontents=new Array();
					for(var i=0;i<this.nbobj;i++){
						this.tabobject[i]=this.tabcontainers[i].select('ul');
						//alert(this.tabcontainers[i].select('ul'));
						//alert(this.tabobject[i][0].select('li'));
						this.lis[i]=this.tabobject[i][0].select('li');
						this.nblis[i]=this.lis[i].length-1;
						this.activeli[i]=this.lis[i][0];
						this.tabcontents[i] = this.tabcontainers[i].select('[class="tabcontent"]');
						
						this.lis[i].each(function(curli) {
							Event.observe(curli, 'click', this.showtab.bind(this,curli,i),false);
						}.bind(this));
						
					}
					
				},
				showtab: function(curli,curobj){
					if(this.activeli[curobj]==curli){
						return false;
					}
					
					this.activeli[curobj].firstDescendant().removeClassName('tab_selected');
					curli.firstDescendant().addClassName('tab_selected');
					for(var j=0;j<=this.nblis[curobj];j++){
						if (this.lis[curobj][j]==curli)
							this.tabcontents[curobj][j].show();
						else
							this.tabcontents[curobj][j].hide();	
					}
					this.activeli[curobj]=curli;
					
				}
				
			});
			
			


/* FORMS : classe pour poster un formulaire (AJAX). postme.php requis */ 

var MailForm = Class.create({
	  initialize: function(required,theform,language) {
	  		this.language=(language == null) ? "fr" : language;
	    	this.required=required;
	    	this.form=$(theform);
	    	this.email="";
	    	this.error=new Array();
	    	Event.observe(this.form, 'submit', this.checkForm.bind(this));
	  },
	  checkForm: function(){
	  	var pass=0;
	  	this.error.length=0;
		for (var i=0;i<this.required.length; i++){
	        if ($F(this.required[i]).blank()){
	        	$(this.required[i]).previous().addClassName('required');
	        	pass=1;	
	        }
	        else{
	        	$(this.required[i]).previous().removeClassName('required');
	        }   
	    }
	    if (pass==1){
	    	switch (this.language) 
			{ 
			   case "nl" : 
			      this.error.push("U moet alle verplichte velden invullen, a.u.b."); 
			      break; 
			    case "uk" : 
			      this.error.push("Please, fill in all the reqired fields."); 
			      break; 
			   default:
			      this.error.push("Veuillez remplir tous les champs requis SVP");    
			}
	    	
	    }
	    
	    if (!$F(this.email).blank()){
	    	this.checkEmail();
	    }	
	    if (this.error.length==0){
	    	//alert("Le formulaire est pret pour etre envoye");
	    	new Ajax.Request('postme.php', {
			  method: 'post',
			  encoding:'ISO-8859-1',
			  parameters: this.form.serialize(true),
			  onSuccess: function(transport){
			  	this.form.up().innerHTML=transport.responseText;
			  }.bind(this)
			});
		}
		else{
			this.form.previous().innerHTML=this.error.join('<br />');
		}	
	   // return false;
	  },
	  addEmail: function(email){
	  		this.email=email;
	  		//alert($F('Email'));
	  },
	 checkEmail: function(){			  	
			  	var pattern=/((^[a-zA-Z0-9])|(^[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]))@[a-zA-Z0-9_-]+\.[a-zA-Z]{2,6}(\.[a-zA-Z][a-zA-Z])?[a-zA-Z]{0,1}$/;
			  	if (!$F(this.email).match(pattern)){
			  		switch (this.language) 
					{ 
					   case "nl" : 
					      this.error.push("De email formaat is verkeerd."); 
					      break; 
					    case "uk" : 
					      this.error.push("The email format is wrong."); 
					      break; 
					   default:
					      this.error.push("Le format email n'est pas bon");;  
					}
			  		$(this.email).previous().addClassName('required');
			  	}
			  	else{
			  		$(this.email).previous().removeClassName('required');
			  	}
			  	
			  }
			});	 	 

/* Marquee : texte defilant de droite ˆ gauche */
/* Attention, la div dans le marquee boord doit avoir la propriete : word-spacing:nowrap */

var marquee = Class.create({
							 initialize: function(board,speed) {
								 this.board=$(board);
								 var msgdivs=this.board.getElementsBySelector('div');
								 this.msg=msgdivs[0];
								 this.msg_width=this.msg.getWidth();
								 this.board_width=this.board.getWidth();
								 this.msg.style.left=this.board_width + "px";
								 this.duration=parseInt(this.msg_width/(speed*10));
							},
							scroll:function(){
								Effect.MoveBy(this.msg,0,-(this.msg_width + this.board_width), 
						  					{duration: this.duration,
						  					 transition: Effect.Transitions.linear, 
						  					afterFinish:this.reinitialize.bind(this)
						  					});
							},
							reinitialize: function(){
							 	 this.msg.style.left=this.board_width + "px";
							 	 this.scroll();
							 }
						});	
/* New scroll board */
var scrollboard = Class.create({
	 initialize: function(board,speed) {
		 this.board=$(board);
		 this.speed=speed;
		 var msgdivs=this.board.getElementsBySelector('div');
		 this.msg=msgdivs[0];
		 this.msg_height=parseInt(this.msg.getHeight());	 	 
		 this.board_height=this.board.getHeight();			
		 this.msg.style.top=this.board_height + "px";
		 this.duration=parseInt(this.msg_height/(speed*10));
		 Event.observe(this.board, 'mouseover', this.pause.bind(this),false);
		 Event.observe(this.board, 'mouseout', this.restart.bind(this),false);
	},
	scroll:function(){
  		if(parseInt(this.msg.getStyle('top')) > - this.msg_height){
	  		this.msg.style.top=(parseInt(this.msg.getStyle('top')) - this.speed) + "px";
	  		//alert(this.msg.style.top);
			setTimeout(this.scroll.bind(this),100);
		}
		else{
			this.reinitialize();
		}				
	},
	reinitialize: function(){
	 	 this.msg.style.top=this.board_height + "px";
	 	 this.scroll();
	},
	pause: function(){
		this.initspeed=this.speed;
		this.speed=0;
	},
	restart: function(){
		this.speed=this.initspeed;
	}
});
/* Menu Horizontal type "drop-down" */
/* usage : var exp=new inline_menu('topmenu'); topmenu etant la div contenant le menu */	  

var inline_menu = Class.create({
			  initialize: function(topdiv) {
			    	this.topdiv = $(topdiv);			    
			    	this.active=-1;
			    	this.menu=this.topdiv.firstDescendant();
			    	this.timer=-1;
			    	this.dts= $$('#' + topdiv + ' dt');
			    	//alert(this.dts);
					this.dts.each(function(dt) {
						if (dt.next(0)){
							dt.next(0).hide();
							Event.observe(dt, 'mouseover', this.show_sub.bind(this,dt),false);
							Event.observe(dt, 'mouseout', this.fade_active.bind(this),false);
							
							Event.observe(dt.next(0), 'mouseover',this.keep_visible.bind(this),false);
							Event.observe(dt.next(0), 'mouseout',this.fade_active.bind(this),false);
						}
						else{
							Event.observe(dt, 'mouseover', this.dt_nosub.bind(this),false);
						}
					}.bind(this));
					
					
			  },
			  show_sub:function(dt){
				clearTimeout(this.timer);	
				if (this.active==dt){
					
				//return false;
				}
				else{						
					//dt.next(0).show();
					
					Effect.Appear(dt.next(0), { duration: 0.5});

					dt.addClassName('current');
					if (this.active!=-1){
						this.active.removeClassName('current');
						Effect.Fade(this.active.next(0), { duration: 0.5 });	
					}	
					this.active=dt;
					
				}
					
			  },
			  fade_active:function(){
			  /*	Effect.Fade(this.active.next(0), { duration: 1.0,
			  									   afterFinish: function() {this.active=-1;}
			  									 });	
			  	*/
			  	this.timer=setTimeout(this.fade_and_clean.bind(this),200);								 

			  },
			  fade_and_clean:function(){
			  		this.active.removeClassName('current');
			  		//this.active.next(0).hide();
			  		Effect.Fade(this.active.next(0), {duration: 0.5});
			  		this.active=-1;
			  },
			  keep_visible:function(){
			  	if(this.timer!=1)
			  		clearTimeout(this.timer);
			  },
			  dt_nosub:function(){
			  	if (this.active!=-1){
					this.active.removeClassName('current');
					Effect.Fade(this.active.next(0), { duration: 0.5 });
					this.active=-1;	
				}
			  }			
		});								

function Create_inline_menu(menu){
	Event.observe(window,'load',function(){
				var exp=new inline_menu(menu);	  
	});
}

/* Menu Vertical type "drop-down" */
/* usage : var exp=new inline_menu('topmenu'); topmenu etant la div cantenant le menu */	
var vertical_menu = Class.create({
			  initialize: function(topdiv) {
			    	this.topdiv = $(topdiv);			    
			    	this.active=new Array();
			    	this.menu=this.topdiv.firstDescendant();
			    	this.timer=-1;
			    	this.dts= $$('#' + topdiv + ' dt');
			    	//alert(this.dts);
					this.dts.each(function(dt) {
						if (dt.next(0)){
							dt.next(0).hide();
							Event.observe(dt, 'click', this.show_sub.bind(this,dt),false);
							//Event.observe(dt, 'mouseout', this.fade_active.bind(this),false);
							
							//Event.observe(dt.next(0), 'mouseover',this.keep_visible.bind(this),false);
							//Event.observe(dt.next(0), 'mouseout',this.fade_active.bind(this),false);
						}
					}.bind(this));
					
					
			  },
			  show_sub:function(dt){
				var found=0;
				if(this.active.length!=0){
					for(var i=0;i<this.active.length;i++){	
						if(this.active[i]==dt){
							found=1;
							break;
						}
					}
				}
				
				if (found==1){
					dt.removeClassName('unfold');
					Effect.SlideUp(dt.next(0), { duration: 0.5});
					var tempa=new Array();	
					for(var i=0;i<this.active.length;i++){	
						if(this.active[i]!=dt){
							tempa.push(this.active[i]);
						}
					}
					this.active=tempa;
				}
				else{						
					//dt.next(0).show();
					//alert(this.active);
					dt.addClassName('unfold');
					Effect.SlideDown(dt.next(0), { duration: 0.5});
					this.active.push(dt);
					
					/*
					dt.addClassName('current');
					if (this.active!=-1){
						this.active.removeClassName('current');
						Effect.Fade(this.active.next(0), { duration: 0.5 });	
					}	
					this.active=dt;
					*/
				}
					
			  },
			  fade_active:function(){
			  /*	Effect.Fade(this.active.next(0), { duration: 1.0,
			  									   afterFinish: function() {this.active=-1;}
			  									 });	
			  	*/
			  	this.timer=setTimeout(this.fade_and_clean.bind(this),1500);								 

			  },
			  fade_and_clean:function(){
			  		this.active.removeClassName('current');
			  		//this.active.next(0).hide();
			  		Effect.Fade(this.active.next(0), {duration: 0.5});
			  		this.active=-1;
			  },
			  keep_visible:function(){
			  	if(this.timer!=1)
			  		clearTimeout(this.timer);
			  }		
		});

function Create_vertical_menu(menu){
	Event.observe(window,'load',function(){
				var exp=new vertical_menu(menu);	  
	});
}


/* Slide show with next pic sliding over current pic */
/* Attention !!!! Retirer dummy du chemin pour requete Ajax dans la fonction getPics */
/******************************** WARNING **********************************/
var slide_stack = Class.create({
			  initialize: function(images,sid,delay) {
			    	this.slideshow=$(sid);
			    	this.slideshow.addClassName('loading');
			    	this.images=Array();
			    	this.delay=delay;
			    	this.width=this.slideshow.getWidth();
			    	//this.images=images;
			    	//this.nbimages=this.images.length;
			    	this.getPics(images);
			    	
			    	//this.loadImages();
			    	 
			  },
			  getPics: function(picsdir){
			  
			  	new Ajax.Request('/dummy/getpics.php', {
				  method: 'get',
				  parameters: {dir: picsdir},
				  onSuccess: function(transport){			
					this.images=transport.responseText.split(",");
					this.nbimages=this.images.length;
					this.loadImages();
				  }.bind(this)
				});
				
			  },
			  loadImages: function(){
			  		var loadimg=Array();
			  		var loaded=Array();
			  		for (var i = 0; i < this.nbimages; i++) { 
						loadimg[i] = new Image()
						loadimg[i].src = this.images[i]
					}
					for (i = 0; i < this.nbimages; i++) { 
						loaded[i] = false
					}
					this.checkLoaded(loadimg,loaded,0);		
			  },
			  checkLoaded: function(loadimg,loaded,currCount){
			  		if (currCount == loadimg.length) { 
						this.slideshow.removeClassName('loading');
						this.secondstage();
					}
					else{
						//alert(currCount);
						for (var i = 0; i < loadimg.length; i++) {
	
							if (loaded[i] == false && loadimg[i].complete) {
								loaded[i] = true
								currCount++
							}
							
						}
					
						//alert(currCount);
						this.timerID = setTimeout(function() {this.checkLoaded(loadimg,loaded,currCount)}.bind(this),0);
						// Le seul moyen que j'aie trouvŽ d'avoir cet emmerdeur de settimeout qui la ferme 
					}	 
			  },
			 secondstage: function(){
			 		this.slideshow.appendChild(Builder.node('div',{id:'slide0'}));
			    	this.slideshow.appendChild(Builder.node('div',{id:'slide1'}));
					this.frames= this.slideshow.getElementsBySelector('div');
			    	this.frames[0].appendChild(Builder.node('img'));
			    	this.frames[1].appendChild(Builder.node('img'));
			    	this.frames[1].style.left=this.width + "px";
			    	this.frames[0].style.zIndex=0;
			    	this.frames[1].style.zIndex=1;
			    	this.currentframe = 0;
			    	this.nextframe = 1;
			    	this.focuspic = 0;
			    	this.currentpic=this.frames[0].childElements();

					this.currentpic[0].src=this.images[0]; /* img tag */
					nextpic=this.frames[1].childElements();
					nextpic[0].src=this.images[1];
			    	this.next_to_see=1; // num de la prochaine image ˆ afficher

			    	this.rotate.bind(this).delay(this.delay); 
			    	/* !!!! Bind avant delay sinon a ne marche pas !!! */
			  
			 },			  
			  rotate: function(){
				 Effect.MoveBy(this.frames[this.nextframe], 0, -(this.width) , 
	  					{duration: 1.0,
	  					 afterFinish:this.reinitialize.bind(this)
	  					});	
			  	//bind(this) pour rester dans le scope local
			  },
			  reinitialize: function(){
			  	this.next_to_see=++this.next_to_see % this.nbimages;
			  	this.frames[this.currentframe].style.left=this.width + "px";
			  	var nextslide=this.frames[this.currentframe].childElements();
			  	nextslide[0].src=this.images[this.next_to_see];
			  	this.currentframe=Math.abs(this.currentframe-1);
			  	this.nextframe=Math.abs(this.nextframe-1);
			  	this.frames[this.nextframe].style.zIndex=1;//Math.abs(this.frames[0].style.zindex -1);
			  	this.frames[this.currentframe].style.zIndex=0;//Math.abs(this.frames[1].style.zindex -1);
			  	
			  	this.rotate.bind(this).delay(this.delay);
			  }
			  });

/* Slide show with next pic fading into current pic */
/* Attention !!!! Retirer dummy du chemin pour requete Ajax dans la fonction getPics */
/******************************** WARNING **********************************/
			  
var slide_fade = Class.create({
			  initialize: function(images,sid,delay) {
			    	this.slideshow=$(sid);
			    	this.slideshow.addClassName('loading');
			    	this.images=Array();
			    	this.delay=delay;
			    	this.width=this.slideshow.getWidth();
			    	//this.images=images;
			    	//this.nbimages=this.images.length;
			    	
					this.getPics(images);
			    	
			    	//this.loadImages();
			    	 
			  },
			  getPics: function(picsdir){
				
			  	new Ajax.Request('/getpics.php', {
				  method: 'get',
				  parameters: {dir: picsdir},
				  onSuccess: function(transport){			
					this.images=transport.responseText.split(",");
					//alert(transport.responseText);
					this.nbimages=this.images.length;
					this.loadImages();
				  }.bind(this)
				});
				
			  },
			  loadImages: function(){
			  		var loadimg=Array();
			  		var loaded=Array();
			  		for (var i = 0; i < this.nbimages; i++) { 
						loadimg[i] = new Image()
						loadimg[i].src = this.images[i]
					}
					for (i = 0; i < this.nbimages; i++) { 
						loaded[i] = false
					}
					this.checkLoaded(loadimg,loaded,0);		
			  },
			  checkLoaded: function(loadimg,loaded,currCount){
			  		if (currCount == loadimg.length) { 
						this.slideshow.removeClassName('loading');
						this.secondstage();
					}
					else{
						//alert(currCount);
						for (var i = 0; i < loadimg.length; i++) {
	
							if (loaded[i] == false && loadimg[i].complete) {
								loaded[i] = true
								currCount++
							}
							
						}
					
						//alert(currCount);
						this.timerID = setTimeout(function() {this.checkLoaded(loadimg,loaded,currCount)}.bind(this),0);
						// Le seul moyen que j'aie trouvŽ d'avoir cet emmerdeur de settimeout qui la ferme 
					}	 
			  },
			 secondstage: function(){
			 		this.slideshow.appendChild(Builder.node('div',{id:'slide0'}));
			    	this.slideshow.appendChild(Builder.node('div',{id:'slide1'}));
					this.frames= this.slideshow.getElementsBySelector('div');
			    	this.frames[0].appendChild(Builder.node('img'));
			    	this.frames[1].appendChild(Builder.node('img'));
			    	this.frames[1].hide();
			    	this.currentframe = 0;
			    	this.nextframe = 1;
			    	this.focuspic = 0;
			    	this.currentpic=this.frames[0].childElements();

					this.currentpic[0].src=this.images[0]; /* img tag */
					nextpic=this.frames[1].childElements();
					nextpic[0].src=this.images[1];
			    	this.next_to_see=1; // num de la prochaine image ˆ afficher

			    	this.rotate.bind(this).delay(this.delay); 
			    	/* !!!! Bind avant delay sinon a ne marche pas !!! */
			  
			 },
			  rotate: function(){
			  	this.focuspic=++this.focuspic % this.nbimages;	
				this.nextframe=Math.abs(this.currentframe-1);
				var newpic=this.frames[this.nextframe].childElements();
				newpic[0].src=this.images[this.focuspic];
				Effect.Fade(this.frames[this.currentframe], { duration: 1.0 });
				Effect.Appear(this.frames[this.nextframe], { 
												duration: 1.0, 
												afterFinish: this.reinitialize.bind(this)
												});
			  },
			  reinitialize:function(){
			  	this.currentframe=this.nextframe;
				this.rotate.bind(this).delay(this.delay); 
			  }
			  });			  
			

/* Slide Lateral triggered to slide left or right */
var slide_lateral = Class.create({
			  initialize: function(sid,cdir,speed) {
			    	this.currentframe = 0;
			    	this.dir="dyncontent/" + cdir;
			    	this.imgdir="images/" +cdir;
					this.slideshow=$(sid);
			    	this.slideshow.addClassName('loading');
			    	this.images=Array();					
					//this.frames= $(sid).getElementsBySelector('div');
					this.frames= Array();
					this.width=this.slideshow.getWidth();
			    	
			    	this.speed=speed;
			    	this.next_to_see=1;
			    	//currentcontent=this.frames[0].childElements();	
			    	this.getPics();				
					
			  },
			  getPics: function(){
			  	new Ajax.Request('/getpics.php', {
				  method: 'get',
				  parameters: {dir: this.imgdir},
				  onSuccess: function(transport){			
					//this.images=transport.responseText.split(",");
					//alert(transport.responseText);
					this.images=transport.responseText.evalJSON();
					//alert(this.images);
					this.nbimages=this.images.length;
					this.loadImages();
				  }.bind(this)
				});
				
			  },
			  
			  
			  loadImages: function(){
			  		var loadimg=Array();
			  		var loaded=Array();
			  		for (var i = 0; i < this.nbimages; i++) { 
						loadimg[i] = new Image()
						loadimg[i].src = this.imgdir + "/" + this.images[i]
					}
					for (i = 0; i < this.nbimages; i++) { 
						loaded[i] = false
					}
					this.checkLoaded(loadimg,loaded,0);		
			  },
			  checkLoaded: function(loadimg,loaded,currCount){
			  		if (currCount == loadimg.length) { 
						this.slideshow.removeClassName('loading');
						this.secondstage();
					}
					else{
						//alert(currCount);
						for (var i = 0; i < loadimg.length; i++) {
	
							if (loaded[i] == false && loadimg[i].complete) {
								loaded[i] = true
								currCount++
							}
							
						}
					
						//alert(currCount);
						this.timerID = setTimeout(function() {this.checkLoaded(loadimg,loaded,currCount)}.bind(this),0);
						// Le seul moyen que j'aie trouvŽ d'avoir cet emmerdeur de settimeout qui la ferme 
					}	 
			  },
			  
			  secondstage: function(){
			  /*	this.slideshow.appendChild(Builder.node('div',{class:'slide'}));
			    	this.slideshow.appendChild(Builder.node('div',{class:'slide'})); */
			  	this.slideshow.appendChild(Builder.node('div'));
			    	this.slideshow.appendChild(Builder.node('div'));
			    	//this.frames= this.slideshow.select('div[class="slide"]');
			    	this.frames= this.slideshow.select('div');
				this.frames[0].addClassName('slide');
				this.frames[1].addClassName('slide');
			  		this.frames[1].style.left=this.width + "px";
					new Ajax.Request('getsites.php', {
					  method: 'get',
					  parameters: {dir: this.dir},
					  onSuccess: function(transport){
					  this.contents=transport.responseText.split(",");
					  this.nbcontents=this.contents.length;
					//	alert(this.contents);
					  this.fetch_content(0,0);
					  this.fetch_content(1,1);
					  }.bind(this)
					});
			  
			 },	
			  
			  	
			  	fetch_content: function(frame,content){
			  	
			  		var currenturl = this.dir + "/" + this.contents[content];
			  		//alert("inside " + currenturl);
			  		new Ajax.Request(currenturl, {
					  method: 'get',
					  onSuccess: function(transport){
					
					  this.frames[frame].update(transport.responseText);
					  //alert(this.frames[frame].innerHTML);
					  //alert(transport.responseText);
					  }.bind(this)
					});
			  
			  }, 			  
			    move: function(){
			  		Effect.MoveBy(this.frames[this.currentframe], 0, -(this.width) , 
			  					{duration: 1.0
			  					});
	  				Effect.MoveBy(this.frames[Math.abs(this.currentframe-1)], 0, -(this.width) , 
	  					{duration: 1.0,
	  					 afterFinish:this.reinitialize.bind(this)
	  					});	
			  	//bind(this) pour rester dans le scope local
			  },
			  reinitialize: function(){
			  	this.next_to_see=++this.next_to_see % this.nbcontents;
			  	this.frames[this.currentframe].style.left=this.width + "px";
			  	this.fetch_content(this.currentframe,this.next_to_see);
			  	this.currentframe=Math.abs(this.currentframe-1);
			  },
			  reverse: function(){
			  
			  	this.next_to_see= (--this.next_to_see<0?(this.nbcontents-1):this.next_to_see);
			  	this.next_to_see= (--this.next_to_see<0?(this.nbcontents-1):this.next_to_see); /* Revenir 2 pics en arriere */
			  	this.frames[Math.abs(this.currentframe-1)].style.left=-(this.width) + "px";
			  	this.fetch_content(Math.abs(this.currentframe-1),this.next_to_see);
			  	//var nextslide=this.frames[Math.abs(this.currentframe-1)].childElements();
			  	//nextslide[0].src=this.images[this.next_to_see];
			  		Effect.MoveBy(this.frames[this.currentframe], 0, this.width , 
			  					{duration: 1.0
			  					});
	  				Effect.MoveBy(this.frames[Math.abs(this.currentframe-1)], 0, this.width, 
			  					{duration: 1.0
			  					});	
			  	this.currentframe=Math.abs(this.currentframe-1);
			  	this.next_to_see=++this.next_to_see % this.nbcontents;
			  	
			  }
			});

function Create_slide_lateral(slideshow,dyndir,speed){
	Event.observe(window,'load',function(){
				slide=new slide_lateral(slideshow,dyndir,speed);	  
	});
}

