diff --git a/ecrire/articles_tous.php3 b/ecrire/articles_tous.php3
index 9233164365b459a951b84537f8cecb3bb51e131d..512c116ad7fbda98568778bc334b5a8974521748 100644
--- a/ecrire/articles_tous.php3
+++ b/ecrire/articles_tous.php3
@@ -140,12 +140,11 @@ function afficher_rubriques_filles($id_parent) {
 		if (!$numero_block["$nom_block"] > 0){
 			$compteur_block++;
 			$numero_block["$nom_block"] = $compteur_block;
-		}
 
+			if (!$first_couche) $first_couche = $compteur_block;
+			$last_couche = $compteur_block;
+		}
 
-		$javasc_ouvrir .= "ouvrir_couche('$compteur_block', '$spip_lang_rtl');";
-		$javasc_fermer .= "fermer_couche('$compteur_block', '$spip_lang_rtl');";
-		
 		if ($id_parent == '0') 	{
 			$rubrique[$id_rubrique] = "$titre";
 		}
@@ -185,9 +184,10 @@ function afficher_rubriques_filles($id_parent) {
 		
 		$article[$id_rubrique][] = "<div class='puce-article' style='background: url(img_pack/$puce) $spip_lang_left center no-repeat;'><div><a href='articles.php3?id_article=$id_article' class='verdana1'>$titre</a></div></div>";
 	}
-
-
 	
+	$javasc_ouvrir="manipuler_couches('ouvrir','$spip_lang_rtl',$first_couche,$last_couche)";
+	$javasc_fermer="manipuler_couches('fermer','$spip_lang_rtl',$first_couche,$last_couche)";
+
 	// Demarrer l'affichage
 	if ($les_rubriques AND test_layer()) {
 		$les_rubriques = join($les_rubriques,",");
diff --git a/ecrire/layer.js b/ecrire/layer.js
index c47010fce52428f1edca8f143d5816b97744df13..d7cbcbaac7a53a34a665522ad1698a38c692a5e3 100644
--- a/ecrire/layer.js
+++ b/ecrire/layer.js
@@ -35,4 +35,14 @@ function fermer_couche(couche, rtl) {
 	layer.style.display = 'none';
 	vis[couche] = 'hide';
 }
-
+function manipuler_couches(action,rtl,first,last) {
+	if (action=='ouvrir') {
+		for (j=first; j<=last; j+=1) {
+			ouvrir_couche(j,rtl);
+		}
+	} else {
+		for (j=first; j<=last; j+=1) {
+			fermer_couche(j,rtl);
+		}
+	}
+}