
window.addEvent('domready', function() {
	var status = {
		'true': 'open',
		'false': 'close'
	};
	
	var suiviControl = 0;
	
	// SLIDE 1 :
	var myVerticalSlide = new Fx.Slide('txtMask1');
	myVerticalSlide.hide();
	
	$('txtBt1').addEvent('click', function(e){
		e.stop();
		control();
		myVerticalSlide.toggle();
	});
	
	myVerticalSlide.addEvent('complete', function() {
		if ( ( document.getElementById('txtBt1').className=='txtBt' ) && ( tabSuivi[0] == 0 ) ) 
		{
			document.getElementById('txtBt1').className = 'txtBtOn'; 
			tabSuivi[0] = 1;
		} else {
			document.getElementById('txtBt1').className = 'txtBt';  
			tabSuivi[0] = 0;
		};
		control2(0);
	});
	
	// SLIDE 2 :
	var myVerticalSlide2 = new Fx.Slide('txtMask2');
	myVerticalSlide2.hide();
	
	$('txtBt2').addEvent('click', function(e){
		e.stop();
		control();
		myVerticalSlide2.toggle();
	});
	
	myVerticalSlide2.addEvent('complete', function() {
		if ( ( document.getElementById('txtBt2').className=='txtBt' ) && ( tabSuivi[1] == 0 ) ) 
		{
			document.getElementById('txtBt2').className = 'txtBtOn';  
			tabSuivi[1] = 1;
		} else {
			document.getElementById('txtBt2').className = 'txtBt'; 
			tabSuivi[1] = 0;
		};
		control2(1);
	});
	
	// SLIDE 3 :
	var myVerticalSlide3 = new Fx.Slide('txtMask3');
	myVerticalSlide3.hide();
	
	$('txtBt3').addEvent('click', function(e){
		e.stop();
		control();
		myVerticalSlide3.toggle();
	});
	
	myVerticalSlide3.addEvent('complete', function() {
		if ( (document.getElementById('txtBt3').className=='txtBt' ) && ( tabSuivi[2] == 0 ) ) 
		{
			document.getElementById('txtBt3').className = 'txtBtOn';  
			tabSuivi[2] = 1;
		} else {
			document.getElementById('txtBt3').className = 'txtBt';  
			tabSuivi[2] = 0;
		};
		control2(2);
	});
	
	// SLIDE 4 :
	var myVerticalSlide4 = new Fx.Slide('txtMask4');
	myVerticalSlide4.hide();
	
	$('txtBt4').addEvent('click', function(e){
		e.stop();
		control();
		myVerticalSlide4.toggle();
	});
	
	myVerticalSlide4.addEvent('complete', function() {
		if ( ( document.getElementById('txtBt4').className=='txtBt' ) && ( tabSuivi[3] == 0 ) ) 
		{
			document.getElementById('txtBt4').className = 'txtBtOn';  
			tabSuivi[3] = 1;
		} else {
			document.getElementById('txtBt4').className = 'txtBt';  
			tabSuivi[3] = 0;
		};
		control2(3);
	});
	
	
		//  SUIVI
	var tabSuivi = [ 0, 0, 0, 0 ];
	var tabSlide = [ myVerticalSlide, myVerticalSlide2, myVerticalSlide3, myVerticalSlide4 ]; 
	var tabBt = [ 'txtBt1', 'txtBt2', 'txtBt3', 'txtBt4' ]; 
	
	function control() {
		//alert( tabSuivi );
		for ( i=0; i<=3; i++ ) {
			if ( tabSuivi[i] == 1 ) {
				tabSlide[i].slideOut();
				document.getElementById( tabBt[i] ).className = 'txtBt';  
			}
		}
		suiviControl = 1;
	}
	
	function control2(slideOn) {
		for ( i=0; i<=3; i++ ) {
			if ( ( tabSuivi[i] == 1 ) && ( slideOn != i ) && ( suiviControl == 1 ) ) {
				tabSlide[i].slideOut();
				document.getElementById( tabBt[i] ).className = 'txtBt';
				suiviControl = 0;
			}
		}
	}
	
});



