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

// CREATIONS 1
var boxCREATIONS1 = $('creations_1');
var fxCREATIONS1 = boxCREATIONS1.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});

// CREATIONS
var boxV1 = $('creations_p1');
var fxV1 = boxV1.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});
var boxV2 = $('creations_p2');
var fxV2 = boxV2.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});
var boxV3 = $('creations_p3');
var fxV3 = boxV3.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});

// CREATIONS BOUTONS
var boxBT1 = $('creations1');
var fxBT1 = boxBT1.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});
var boxBT2 = $('creations2');
var fxBT2 = boxBT2.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});
var boxBT3 = $('creations3');
var fxBT3 = boxBT3.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});

// CONTENU
var boxCONTENU4 = $('contenu_4');
var fxCONTENU4 = boxCONTENU4.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});
var boxC1 = $('contenu_clubmedgym');
var fxC1 = boxC1.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});
var boxC2 = $('contenu_kpmg');
var fxC2 = boxC2.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});
var boxC3 = $('contenu_freelance');
var fxC3 = boxC3.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});


//////////////////////////////

///// BOUTON FERME
$('creations1').addEvent('click', function(){
if(boxCREATIONS1.getStyle('height').toInt() == 0){
fxV1.start({'margin-top': 0});
boxBT1.setStyle('background-position', 'bottom');
boxBT2.setStyle('background-position', 'top');
boxBT3.setStyle('background-position', 'top');
} else {
}});
$('creations2').addEvent('click', function(){
if(boxCREATIONS1.getStyle('height').toInt() == 0){
fxV1.start({'margin-top': -200});
boxBT1.setStyle('background-position', 'top');
boxBT2.setStyle('background-position', 'bottom');
boxBT3.setStyle('background-position', 'top');
} else {
}});
$('creations3').addEvent('click', function(){
if(boxCREATIONS1.getStyle('height').toInt() == 0){
fxV1.start({'margin-top': -400});
boxBT1.setStyle('background-position', 'top');
boxBT2.setStyle('background-position', 'top');
boxBT3.setStyle('background-position', 'bottom');
} else {
}});

///// BOUTON OUVERT
$('creations1').addEvent('click', function(){
if(boxCREATIONS1.getStyle('height').toInt() == 200 && boxCONTENU4.getStyle('opacity').toInt() == 1){
fxV1.start({'margin-top': 0});
fxC1.start({'margin-top': 0});
boxBT1.setStyle('background-position', 'bottom');
boxBT2.setStyle('background-position', 'top');
boxBT3.setStyle('background-position', 'top');
} else {
}});
$('creations2').addEvent('click', function(){
if(boxCREATIONS1.getStyle('height').toInt() == 200 && boxCONTENU4.getStyle('opacity').toInt() == 1){
fxV1.start({'margin-top': -200});
fxC1.start({'margin-top': -400});
boxBT1.setStyle('background-position', 'top');
boxBT2.setStyle('background-position', 'bottom');
boxBT3.setStyle('background-position', 'top');
} else {
}});
$('creations3').addEvent('click', function(){
if(boxCREATIONS1.getStyle('height').toInt() == 200 && boxCONTENU4.getStyle('opacity').toInt() == 1){
fxV1.start({'margin-top': -400});
fxC1.start({'margin-top': -800});
boxBT1.setStyle('background-position', 'top');
boxBT2.setStyle('background-position', 'top');
boxBT3.setStyle('background-position', 'bottom');
} else {
}});

});

