
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);
	});
	
	// SLIDE 5 :
	var myVerticalSlide5 = new Fx.Slide('txtMask5');
	myVerticalSlide5.hide();
	
	$('txtBt5').addEvent('click', function(e){
		e.stop();
		control();
		myVerticalSlide5.toggle();
	});
	
	myVerticalSlide5.addEvent('complete', function() {
		if ( ( document.getElementById('txtBt5').className=='txtBt'  ) && ( tabSuivi[4] == 0 ) ) 
		{
			document.getElementById('txtBt5').className = 'txtBtOn'; 
			tabSuivi[4] = 1;
		} else {
			document.getElementById('txtBt5').className = 'txtBt';
			tabSuivi[4] = 0;
		};
		control2(4);
	});
	
	
		// SLIDE 6 :
	var myVerticalSlide6 = new Fx.Slide('txtMask6');
	myVerticalSlide6.hide();
	
	$('txtBt6').addEvent('click', function(e){
		e.stop();
		control();
		myVerticalSlide6.toggle();
	});
	
	myVerticalSlide6.addEvent('complete', function() {
		if ( ( document.getElementById('txtBt6').className=='txtBt'  ) && ( tabSuivi[5] == 0 ) ) 
		{
			document.getElementById('txtBt6').className = 'txtBtOn'; 
			tabSuivi[5] = 1;
		} else {
			document.getElementById('txtBt6').className = 'txtBt';
			tabSuivi[5] = 0;
		};
		control2(5);
	});
	
	
		// SLIDE 7 :
	var myVerticalSlide7 = new Fx.Slide('txtMask7');
	myVerticalSlide7.hide();
	
	$('txtBt7').addEvent('click', function(e){
		e.stop();
		control();
		myVerticalSlide7.toggle();
	});
	
	myVerticalSlide7.addEvent('complete', function() {
		if ( ( document.getElementById('txtBt7').className=='txtBt'  ) && ( tabSuivi[6] == 0 ) ) 
		{
			document.getElementById('txtBt7').className = 'txtBtOn'; 
			tabSuivi[6] = 1;
		} else {
			document.getElementById('txtBt7').className = 'txtBt';
			tabSuivi[6] = 0;
		};
		control2(6);
	});
	
	
		// SLIDE 8 :
	var myVerticalSlide8 = new Fx.Slide('txtMask8');
	myVerticalSlide8.hide();
	
	$('txtBt8').addEvent('click', function(e){
		e.stop();
		control();
		myVerticalSlide8.toggle();
	});
	
	myVerticalSlide8.addEvent('complete', function() {
		if ( ( document.getElementById('txtBt8').className=='txtBt'  ) && ( tabSuivi[7] == 0 ) ) 
		{
			document.getElementById('txtBt8').className = 'txtBtOn'; 
			tabSuivi[7] = 1;
		} else {
			document.getElementById('txtBt8').className = 'txtBt';
			tabSuivi[7] = 0;
		};
		control2(7);
	});
	
		//  SUIVI
	var tabSuivi = [ 0, 0, 0, 0, 0 ,0, 0, 0 ];
	var tabSlide = [ myVerticalSlide, myVerticalSlide2, myVerticalSlide3, myVerticalSlide4, myVerticalSlide5, myVerticalSlide6, myVerticalSlide7, myVerticalSlide8 ]; 
	var tabBt = [ 'txtBt1', 'txtBt2', 'txtBt3', 'txtBt4', 'txtBt5', 'txtBt6', 'txtBt7', 'txtBt8' ]; 
	
	function control() {
		//alert( tabSuivi );
		for ( i=0; i<=7; i++ ) {
			if ( tabSuivi[i] == 1 ) {
				tabSlide[i].slideOut();
				document.getElementById( tabBt[i] ).className = 'txtBt';  
			}
		}
		suiviControl = 1;
	}
	
	function control2(slideOn) {
		for ( i=0; i<=7; i++ ) {
			if ( ( tabSuivi[i] == 1 ) && ( slideOn != i ) && ( suiviControl == 1 ) ) {
				tabSlide[i].slideOut();
				document.getElementById( tabBt[i] ).className = 'txtBt';
				suiviControl = 0;
			}
		}
	}
	
});



