window.addEvent('domready', function(){

// IMAGES
var boxV = $('vignettes_2');
var fxV = boxV.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});
var boxG = $('fleche_gauche_2');
var fxG = boxG.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});
var boxD = $('fleche_droite_2');
var fxD = boxD.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});

//////////////////////////////
boxG.setStyle('opacity', 0.2);


///// BOUTON GAUCHE
$('fleche_droite_2').addEvent('click', function(){
if(boxV.getStyle('margin-left').toInt() == 0){
fxV.start({'margin-left' : -770});
fxG.start({'opacity' : 1});
} else {
}});
$('fleche_droite_2').addEvent('click', function(){
if(boxV.getStyle('margin-left').toInt() == -770){
fxV.start({'margin-left' : -1540});
} else {
}});
$('fleche_droite_2').addEvent('click', function(){
if(boxV.getStyle('margin-left').toInt() == -1540){
fxV.start({'margin-left' : -2310});
} else {
}});
$('fleche_droite_2').addEvent('click', function(){
if(boxV.getStyle('margin-left').toInt() == -2310){
fxV.start({'margin-left' : -3080});
} else {
}});
$('fleche_droite_2').addEvent('click', function(){
if(boxV.getStyle('margin-left').toInt() == -3080){
fxV.start({'margin-left' : -3850});
} else {
}});
$('fleche_droite_2').addEvent('click', function(){
if(boxV.getStyle('margin-left').toInt() == -3850){
fxV.start({'margin-left' : -4180});
fxD.start({'opacity' : 0.2});
} else {
}});

///// BOUTON DROITE
$('fleche_gauche_2').addEvent('click', function(){
if(boxV.getStyle('margin-left').toInt() == -4180){
fxV.start({'margin-left' : -3850});
fxD.start({'opacity' : 1});
} else {
}});
$('fleche_gauche_2').addEvent('click', function(){
if(boxV.getStyle('margin-left').toInt() == -3850){
fxV.start({'margin-left' : -3080});
} else {
}});
$('fleche_gauche_2').addEvent('click', function(){
if(boxV.getStyle('margin-left').toInt() == -3080){
fxV.start({'margin-left' : -2310});
} else {
}});
$('fleche_gauche_2').addEvent('click', function(){
if(boxV.getStyle('margin-left').toInt() == -2310){
fxV.start({'margin-left' : -1540});
} else {
}});
$('fleche_gauche_2').addEvent('click', function(){
if(boxV.getStyle('margin-left').toInt() == -1540){
fxV.start({'margin-left' : -770});
} else {
}});
$('fleche_gauche_2').addEvent('click', function(){
if(boxV.getStyle('margin-left').toInt() == -770){
fxV.start({'margin-left' : 0});
fxG.start({'opacity' : 0.2});
} else {
}});

});

