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

// COMPETENCES 1
var boxCOMPETENCES1 = $('competences_1');
var fxCOMPETENCES1 = boxCOMPETENCES1.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});

// COMPETENCES
var boxV1 = $('competences_p1');
var fxV1 = boxV1.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});
var boxV2 = $('competences_p2');
var fxV2 = boxV2.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});

// COMPETENCES BOUTONS
var boxBT1 = $('competences1');
var fxBT1 = boxBT1.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});
var boxBT2 = $('competences2');
var fxBT2 = boxBT2.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});

// CONTENU
var boxCONTENU6 = $('contenu_6');
var fxCONTENU6 = boxCONTENU6.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});
var boxC1 = $('contenu_logiciels');
var fxC1 = boxC1.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});
var boxC2 = $('contenu_languages');
var fxC2 = boxC2.effects({duration: 500, transition: Fx.Transitions.Quart.easeOut});


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

///// BOUTON FERME
$('competences1').addEvent('click', function(){
if(boxCOMPETENCES1.getStyle('height').toInt() == 0){
fxV1.start({'margin-top': 0});
boxBT1.setStyle('background-position', 'bottom');
boxBT2.setStyle('background-position', 'top');
} else {
}});
$('competences2').addEvent('click', function(){
if(boxCOMPETENCES1.getStyle('height').toInt() == 0){
fxV1.start({'margin-top': -200});
boxBT1.setStyle('background-position', 'top');
boxBT2.setStyle('background-position', 'bottom');
} else {
}});


///// BOUTON OUVERT
$('competences1').addEvent('click', function(){
if(boxCOMPETENCES1.getStyle('height').toInt() == 200 && boxCONTENU6.getStyle('opacity').toInt() == 1){
fxV1.start({'margin-top': 0});
fxC1.start({'margin-top': 0});
boxBT1.setStyle('background-position', 'bottom');
boxBT2.setStyle('background-position', 'top');
} else {
}});
$('competences2').addEvent('click', function(){
if(boxCOMPETENCES1.getStyle('height').toInt() == 200 && boxCONTENU6.getStyle('opacity').toInt() == 1){
fxV1.start({'margin-top': -200});
fxC1.start({'margin-top': -400});
boxBT1.setStyle('background-position', 'top');
boxBT2.setStyle('background-position', 'bottom');
} else {
}});


});

