var velocidade = 30; var abrindo = new Array(6); abrindo[0] = true; abrindo[1] = true; abrindo[2] = true; abrindo[3] = true; abrindo[4] = true; abrindo[5] = true; function abre(div, tamanho, array) { var li = document.getElementById("li"+div); contenttop = li.offsetHeight; if(abrindo[array]==true) { if(contenttop < tamanho) { if(contenttop == 40) { document.getElementById(div).style.display = "block"; li.style.height = contenttop+velocidade+'px'; moveupvar = setTimeout("abre('"+div+"', '"+tamanho+"', '"+array+"')", 50); } else { if(contenttop < tamanho) moveupvar = setTimeout("abre('"+div+"', '"+tamanho+"', '"+array+"')", 50); } li.style.height = contenttop+velocidade+'px'; } if(contenttop >= tamanho) { abrindo[array] = false; } } else { if(contenttop > 40) { li.style.height = contenttop-velocidade+'px'; moveupvar = setTimeout("abre('"+div+"', '"+tamanho+"', '"+array+"')", 50); } if(contenttop == 40) { abrindo[array] = true; document.getElementById(div).style.display = "none"; } } }