var loop = true ;
var timer;

function displayhide(){
	if ( $('#nbMens').html() == 60 ){
		$('#revisable').html(' Révisable');
	}else{
		$('#revisable').html(' Fixe');
	}
}

function goUp(item){
		scrollItem($(item), 'top', 1);
}

function goDown(item){
		scrollItem($(item), 'top', -1);
}

function scrollItem(item, cssProp, nb){
	var top    = item.css(cssProp);
	var height = item.css('height');
	var hp     = item.parent().css('height');

	top        = parseInt(top.substr(0,(top.length-2)));
	height     = parseInt(height.substr(0,(height.length-2)));
	hp         = parseInt(hp.substr(0,(hp.length-2)));
	
	if ( ( nb < 0 && top > -height + hp  )  || ( nb > 0 && top < 0 ) ){
		var newtop = top + nb +'px';
		item.css(cssProp, newtop );			
	}

}


$('.prev').mouseover(function(){
	if( loop ){ timer = setInterval	("goUp(\'.scrollable\')",1); }
	});

$('.next').mouseover(function(){
	if ( loop ){ timer = setInterval("goDown(\'.scrollable\')",1); }
	});

$('.prev2').mouseover(function(){
	if( loop ){ timer = setInterval	("goUp(\'.scrollable2\')",1); }
	});

$('.next2').mouseover(function(){
	if ( loop ){ timer = setInterval("goDown(\'.scrollable2\')",1); }
	});

//*
$('.scroll').mouseout(function(){
	clearTimeout(timer);
	});
// */
		

// btn_calc_selct
function btn_h_switch(item){
	$('.btn_calc_txt').each(
			function(i){	
				$(this).parent().removeClass('btn_calc_selct');				
			});	
	$('.btn_calc_txt2').each(
			function(i){	
				$(this).parent().removeClass('btn_calc_selct');
			});				
	$(item).parent().addClass('btn_calc_selct');				
	btn_b_switch($('.lastbutton'));	
	displayhide();
}

function btn_b_switch(item){
	init_btn_calc3();		
	$(item).removeClass('btn_calc_txt3');		
	$(item).addClass('btn_calc_txt3_slct');			
}
			        
function init_btn_calc3(){
	$('.btn_calc_txt3_slct').each(
			function(i){	
				$(this).addClass('btn_calc_txt3');
				$(this).removeClass('btn_calc_txt3_slct');				
			});		
}	

btn_h_switch($('.firstbtn'));		    

    