var hmax=new Array();
var hmin=new Array();
var pas=20;
function hauteur(div1,div2,n){
//séquences :
//div2 étant display=none et invisible
// 1 : on mesure div1 -> hauteur min
// 2 : on met div2 display=block
// 3 : on remesure div1 -> hauteur max
// 4 : on fixe la hauteur de div1 à hauteur min
// 4 : on remet div2 visible
// 5 : on déroule ...
if(hmin[n]=="" || hmin[n]==null || hmin[n]==undefined){
    hmin[n]=document.getElementById(div1).offsetHeight;
    document.getElementById(div2).style.display='block';
    hmax[n]=document.getElementById(div1).offsetHeight;
    document.getElementById(div1).style.height=hmin[n]+"px";
    document.getElementById(div2).style.visibility='visible';
    //alert("min="+hmin[n]+" et max="+hmax[n]);
    deplipli(div1,n);
    }
if(hmin[n] && div2=="tarifs11"){
    var h=document.getElementById(div1).offsetHeight;
    document.getElementById(div1).style.height='auto';
    document.getElementById(div2).style.display='block';
    hmax[n]=document.getElementById(div1).offsetHeight;
    document.getElementById(div1).style.height=h+"px";
    document.getElementById(div2).style.visibility='visible';
    deplipli(div1,n);

    }
}
function deplipli(div,n){

var xob=document.getElementById(div).style;	
var w=parseInt(xob.height);
xob.height=(w+pas)+"px";
if(w>hmax[n]) {
	$('repli'+n).style.visibility='visible';
	xob.height=(hmax[n]+6)+"px";
	//xob.height='auto';
	//$(div2).style.height='auto';
	return;
	}
setTimeout(function(){deplipli(div,n)},10);
}

function replipli(div,div2,div3,n){
	$('repli'+n).style.visibility='hidden';
eval("var w=parseInt(document.getElementById(div).style.height)");
if(w<hmin[n]+100 && pas>2) pas-=3;
document.getElementById(div).style.height=(w-pas)+"px";
if(w<hmin[n]+pas) {
	document.getElementById(div2).style.display='none'; 
	document.getElementById(div2).style.visibility='hidden';
    if(div3!=""){
	    document.getElementById(div3).style.display='none'; 
	    document.getElementById(div3).style.visibility='hidden';
        } 
	document.getElementById(div).style.height='auto';
	hmin[n]="";
	hmax[n]="";
	pas=20;
	return;
	}
setTimeout(function(){replipli(div,div2,div3,n)},10);
}

/***************************/
var deplieEnCours=0;
var replieEnCours=0;
var timedepl, timerepl;
var menuOuvert=0;

function deplieMenuAssoce(){
clearTimeout(timerepl);
deplieass();
}

function deplieass(){
var div1=document.getElementById('menu');
var div2=document.getElementById('amenu');
var div3=document.getElementById('atelier');
var h1=div1.offsetHeight;
var h2=div2.offsetHeight+div3.offsetHeight;
if(h1>(h2+20)){
	clearTimeout(timedepl);
	return;
	}
div1.style.height=(h1+6)+"px";
timedepl=setTimeout("deplieass()",10);
}


function replieMenuAssoce(){
clearTimeout(timedepl);
replieass();
}

function replieass(){
var div1=document.getElementById('menu');
var h1=div1.offsetHeight;
if(h1<=22){
	clearTimeout(timerepl);
	return;
	}
div1.style.height=(h1-8)+"px";
timerepl=setTimeout("replieass()",10);
}
























