diff --git a/.gitattributes b/.gitattributes
index 663be3b6fc8f1babc2757484be56f55da9f60947..ce2f624263b3b535dfd47a6b7830933ea41fa03e 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -271,6 +271,7 @@ ecrire/inc_controle_forum.php -text
 ecrire/inc_cookie.php -text
 ecrire/inc_forum_admin.php -text
 ecrire/inc_headers.php -text
+ecrire/inc_js_menu_rubriques.php -text
 ecrire/inc_lang_liste.php -text
 ecrire/inc_magicquotes.php -text
 ecrire/inc_message.php -text
diff --git a/ecrire/inc_js_menu_rubriques.php b/ecrire/inc_js_menu_rubriques.php
new file mode 100644
index 0000000000000000000000000000000000000000..bf095465c2c1ca74623d6cb363728f172e2b9712
--- /dev/null
+++ b/ecrire/inc_js_menu_rubriques.php
@@ -0,0 +1,163 @@
+<?php
+
+/***************************************************************************\
+ *  SPIP, Systeme de publication pour l'internet                           *
+ *                                                                         *
+ *  Copyright (c) 2001-2005                                                *
+ *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
+ *                                                                         *
+ *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
+ *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
+\***************************************************************************/
+
+
+function extraire_article($id_p) {
+	if (array_key_exists($id_p, $GLOBALS['db_art_cache'])) {
+		return $GLOBALS['db_art_cache'][$id_p];
+	} else {
+		return array();
+	}
+}
+
+function gen_liste_rubriques() {
+	// se restreindre aux rubriques utilisees recemment +secteurs
+	$liste="0";
+	$s = spip_query("SELECT id_rubrique FROM spip_rubriques
+		ORDER BY id_parent=0 DESC, date DESC LIMIT 500");
+	while ($t = spip_fetch_array($s))
+		$liste .=",".$t['id_rubrique']; 
+	 
+	$q = "SELECT id_rubrique, id_parent, titre 
+		FROM spip_rubriques 
+		WHERE id_rubrique IN ($liste)
+		ORDER BY id_parent,0+titre,titre";
+
+	$res = spip_query($q);
+
+	$GLOBALS['db_art_cache'] = array();
+	if (spip_num_rows($res) > 0) { 
+		while ($row = spip_fetch_array($res)) {
+			$parent = $row['id_parent'];
+			$id = $row['id_rubrique'];
+			$GLOBALS['db_art_cache'][$parent][$id] = sinon($row['titre'], _T('ecrire:info_sans_titre'));
+		}
+	}
+}
+
+
+function bandeau_menu() {
+	global $spip_ecran;
+
+	gen_liste_rubriques(); 
+	$arr_low = extraire_article(0);
+
+	$i = sizeof($arr_low);
+
+	$total_lignes = $i;
+	if ($spip_ecran == "large") $max_lignes = 20;
+	else $max_lignes = 15;
+
+	$nb_col = ceil($total_lignes / $max_lignes);
+	if ($nb_col < 1) $nb_col = 1;
+	$max_lignes = ceil($total_lignes / $nb_col);
+
+	$count_lignes = 0;
+
+	if ($i > 0) {
+		$ret = "<div>&nbsp;</div>";
+		$ret .= "<div class='bandeau_rubriques' style='z-index: 1;'>";
+		foreach( $arr_low as $id_rubrique => $titre_rubrique) {
+
+			if ($count_lignes == $max_lignes) {
+				$count_lignes = 0;
+				$ret .= "</div></td><td valign='top' width='200'><div>&nbsp;</div><div class='bandeau_rubriques' style='z-index: 1;'>";
+			}
+			$count_lignes ++;
+
+			$titre_rubrique = supprimer_numero(typo($titre_rubrique));
+			$ret .= bandeau_rubrique($id_rubrique, $titre_rubrique, $i);
+			$i = $i - 1;
+		}
+		$ret .= "</div>";
+	}
+	unset($GLOBALS['db_art_cache']); // On libère la mémoire
+	return $ret;
+}
+
+
+function bandeau_rubrique($id_rubrique, $titre_rubrique, $z = 1) {
+	global $zdecal;
+	global $spip_ecran, $spip_display;
+	global $spip_lang, $spip_lang_rtl, $spip_lang_left, $spip_lang_right;
+
+	$titre_rubrique = preg_replace(',[\x00-\x1f]+,', ' ', $titre_rubrique);
+
+	// Calcul du nombre max de sous-menus
+	$zdecal = $zdecal + 1;
+	if ($spip_ecran == "large") $zmax = 8;
+	else $zmax= 6;
+	
+	// Limiter volontairement le nombre de sous-menus 
+	$zmax = 6;
+	if ($spip_ecran == "large") $max_lignes = 20;
+	else $max_lignes = 15;
+	
+	
+
+	if ($zindex < 1) $zindex = 1;
+	if ($zdecal == 1) $image = "secteur-12.gif";
+	//else $image = "rubrique-12.gif";
+	else $image = '';
+	
+	if (strlen($image) > 1) $image = " style='background-image:url(" . _DIR_IMG_PACK . $image .");'";
+
+
+	$arr_rub = extraire_article($id_rubrique);
+
+	$i = sizeof($arr_rub);
+	if ($i > 0 AND $zdecal < $zmax) {
+		$ret .= '<div class=\"pos_r\" style=\"z-index: '.$z.';\" onMouseOver=\"montrer(\'b_'.$id_rubrique.'\');\" onMouseOut=\"cacher(\'b_'.$id_rubrique.'\');\">';
+		$ret .= '<div class=\"brt\"><a href=\"naviguer.php3?id_rubrique='.$id_rubrique.'\" class=\"bandeau_rub\"'.$image.'>'.addslashes(supprimer_tags($titre_rubrique)).'</a></div>';
+		$ret .= '<div class=\"bandeau_rub\" style=\"z-index: '.($z+1).';\" id=\"b_'.$id_rubrique.'\">';
+		
+		$ret .= '<table cellspacing=\"0\" cellpadding=\"0\"><tr><td valign=\"top\">';		
+		$ret .= "<div  style='width: 170px;'>";
+		foreach( $arr_rub as $id_rub => $titre_rub) {
+			$count_ligne ++;
+			
+			if ($count_ligne == $max_lignes) {
+				$count_ligne = 0;
+				$ret .= "</div>";
+				$ret .= '</td><td>&nbsp;</td><td valign=\"top\">';
+				$ret .= "<div  style='width: 170px;'>";
+
+			}
+		
+			$titre_rub = supprimer_numero(typo($titre_rub));
+			$ret .= bandeau_rubrique($id_rub, $titre_rub, ($z+$i));
+			$i = $i - 1;
+		}
+		
+		$ret .= '</div></td></tr></table>';
+		
+		$ret .= "</div></div>";
+	} else {
+		$ret .= '<div><a href=\"naviguer.php3?id_rubrique='.$id_rubrique.'\" class=\"bandeau_rub\"'.$image.'>'.addslashes(supprimer_tags($titre_rubrique)).'</a></div>';
+	}
+	$zdecal = $zdecal - 1;
+	return $ret;
+}
+
+function js_menu_rubriques_dist()
+{
+	if (http_last_modified(@filemtime("js_menu_rubriques.php"), time() + 24 * 3600)) 
+		exit;
+	header('Content-type: text/javascript; charset='.lire_meta('charset'));
+	include_ecrire("inc_texte.php3");
+	echo "document.write(\"";
+	echo "<table><tr><td valign='top' width='200'>";
+	echo bandeau_menu();
+	echo "</td></tr></table>";
+	echo "\");\n";
+}
+?>
diff --git a/ecrire/js_menu_rubriques.php b/ecrire/js_menu_rubriques.php
index 37091050ad9f65cd78ff0f8ca10e5600f4652f71..b3728e08ec250bc7592ff038b59e4e335413328a 100644
--- a/ecrire/js_menu_rubriques.php
+++ b/ecrire/js_menu_rubriques.php
@@ -10,159 +10,25 @@
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
 \***************************************************************************/
 
+  // L'arborescence des rubriques n'a rien de secret, 
+  // pas la peine d'authentifier
 
+include ("inc_version.php3");
 
-include ("inc.php3");
-include_ecrire("inc_presentation.php3");
-include_ecrire("inc_texte.php3");
-include_ecrire("inc_urls.php3");
-include_ecrire("inc_rubriques.php3");
+// prendre $var_* comme variables pour eviter les conflits avec les http_vars
 
-if (http_last_modified(@filemtime("js_menu_rubriques.php"), time() + 24 * 3600)) 
-	exit;
-@header('Content-type: text/javascript; charset='.lire_meta('charset'));
+$var_nom = "js_menu_rubriques";
+$var_f = find_in_path('inc_' . $var_nom . '.php');
 
-function extraire_article($id_p) {
-	if (array_key_exists($id_p, $GLOBALS['db_art_cache'])) {
-		return $GLOBALS['db_art_cache'][$id_p];
-	} else {
-		return array();
-	}
-}
+if ($var_f) 
+  include($var_f);
+elseif (is_readable($var_f = (_DIR_INCLUDE . 'inc_' . $var_nom . '.php')))
+  include($var_f);
 
-function gen_liste_rubriques() {
-	// se restreindre aux rubriques utilisees recemment +secteurs
-	$liste="0";
-	$s = spip_query("SELECT id_rubrique FROM spip_rubriques
-		ORDER BY id_parent=0 DESC, date DESC LIMIT 500");
-	while ($t = spip_fetch_array($s))
-		$liste .=",".$t['id_rubrique']; 
-	 
-	$q = "SELECT id_rubrique, id_parent, titre 
-		FROM spip_rubriques 
-		WHERE id_rubrique IN ($liste)
-		ORDER BY id_parent,0+titre,titre";
-
-	$res = spip_query($q);
-
-	$GLOBALS['db_art_cache'] = array();
-	if (spip_num_rows($res) > 0) { 
-		while ($row = spip_fetch_array($res)) {
-			$parent = $row['id_parent'];
-			$id = $row['id_rubrique'];
-			$GLOBALS['db_art_cache'][$parent][$id] = sinon($row['titre'], _T('ecrire:info_sans_titre'));
-		}
-	}
-}
-
-
-function bandeau_menu() {
-	global $spip_ecran;
-
-	gen_liste_rubriques(); 
-	$arr_low = extraire_article(0);
-
-	$i = sizeof($arr_low);
-
-	$total_lignes = $i;
-	if ($spip_ecran == "large") $max_lignes = 20;
-	else $max_lignes = 15;
-
-	$nb_col = ceil($total_lignes / $max_lignes);
-	if ($nb_col < 1) $nb_col = 1;
-	$max_lignes = ceil($total_lignes / $nb_col);
-
-	$count_lignes = 0;
-
-	if ($i > 0) {
-		$ret = "<div>&nbsp;</div>";
-		$ret .= "<div class='bandeau_rubriques' style='z-index: 1;'>";
-		foreach( $arr_low as $id_rubrique => $titre_rubrique) {
-
-			if ($count_lignes == $max_lignes) {
-				$count_lignes = 0;
-				$ret .= "</div></td><td valign='top' width='200'><div>&nbsp;</div><div class='bandeau_rubriques' style='z-index: 1;'>";
-			}
-			$count_lignes ++;
-
-			$titre_rubrique = supprimer_numero(typo($titre_rubrique));
-			$ret .= bandeau_rubrique($id_rubrique, $titre_rubrique, $i);
-			$i = $i - 1;
-		}
-		$ret .= "</div>";
-	}
-	unset($GLOBALS['db_art_cache']); // On libère la mémoire
-	return $ret;
-}
-
-
-function bandeau_rubrique($id_rubrique, $titre_rubrique, $z = 1) {
-	global $zdecal;
-	global $spip_ecran, $spip_display;
-	global $spip_lang, $spip_lang_rtl, $spip_lang_left, $spip_lang_right;
-
-	$titre_rubrique = preg_replace(',[\x00-\x1f]+,', ' ', $titre_rubrique);
-
-	// Calcul du nombre max de sous-menus
-	$zdecal = $zdecal + 1;
-	if ($spip_ecran == "large") $zmax = 8;
-	else $zmax= 6;
-	
-	// Limiter volontairement le nombre de sous-menus 
-	$zmax = 6;
-	if ($spip_ecran == "large") $max_lignes = 20;
-	else $max_lignes = 15;
-	
-	
-
-	if ($zindex < 1) $zindex = 1;
-	if ($zdecal == 1) $image = "secteur-12.gif";
-	//else $image = "rubrique-12.gif";
-	else $image = '';
-	
-	if (strlen($image) > 1) $image = " style='background-image:url(" . _DIR_IMG_PACK . $image .");'";
-
-
-	$arr_rub = extraire_article($id_rubrique);
-
-	$i = sizeof($arr_rub);
-	if ($i > 0 AND $zdecal < $zmax) {
-		$ret .= '<div class=\"pos_r\" style=\"z-index: '.$z.';\" onMouseOver=\"montrer(\'b_'.$id_rubrique.'\');\" onMouseOut=\"cacher(\'b_'.$id_rubrique.'\');\">';
-		$ret .= '<div class=\"brt\"><a href=\"naviguer.php3?id_rubrique='.$id_rubrique.'\" class=\"bandeau_rub\"'.$image.'>'.addslashes(supprimer_tags($titre_rubrique)).'</a></div>';
-		$ret .= '<div class=\"bandeau_rub\" style=\"z-index: '.($z+1).';\" id=\"b_'.$id_rubrique.'\">';
-		
-		$ret .= '<table cellspacing=\"0\" cellpadding=\"0\"><tr><td valign=\"top\">';		
-		$ret .= "<div  style='width: 170px;'>";
-		foreach( $arr_rub as $id_rub => $titre_rub) {
-			$count_ligne ++;
-			
-			if ($count_ligne == $max_lignes) {
-				$count_ligne = 0;
-				$ret .= "</div>";
-				$ret .= '</td><td>&nbsp;</td><td valign=\"top\">';
-				$ret .= "<div  style='width: 170px;'>";
-
-			}
-		
-			$titre_rub = supprimer_numero(typo($titre_rub));
-			$ret .= bandeau_rubrique($id_rub, $titre_rub, ($z+$i));
-			$i = $i - 1;
-		}
-		
-		$ret .= '</div></td></tr></table>';
-		
-		$ret .= "</div></div>";
-	} else {
-		$ret .= '<div><a href=\"naviguer.php3?id_rubrique='.$id_rubrique.'\" class=\"bandeau_rub\"'.$image.'>'.addslashes(supprimer_tags($titre_rubrique)).'</a></div>';
-	}
-	$zdecal = $zdecal - 1;
-	return $ret;
-}
-
-echo "document.write(\"";
-echo "<table><tr><td valign='top' width='200'>";
-echo bandeau_menu();
-echo "</td></tr></table>";
-echo "\");\n";
+if (function_exists($var_nom))
+	$var_nom();
+elseif (function_exists($var_f = $var_nom . "_dist"))
+	$var_f();
+else spip_log("fonction $var_nom indisponible");
 
 ?>