diff --git a/.gitattributes b/.gitattributes
index f4a2263f60f6642b73d3c91cc5610537d227fcd4..378d7f5d4cf55d51bc1c59b4dcc1982c67b8072b 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -427,6 +427,7 @@ ecrire/inc/distant.php -text
 ecrire/inc/documenter.php -text
 ecrire/inc/drapeau_edition.php -text
 ecrire/inc/editer_auteurs.php -text
+ecrire/inc/editer_mot.php -text
 ecrire/inc/filtres_images.php -text
 ecrire/inc/forum_insert.php -text
 ecrire/inc/gadgets.php -text
diff --git a/ecrire/exec/articles.php b/ecrire/exec/articles.php
index 8c4b3dfa60988f206d5b62b2080668ae81e2b487..2e47236165df4e3df5eb025a2394541dfc73a8bf 100644
--- a/ecrire/exec/articles.php
+++ b/ecrire/exec/articles.php
@@ -133,11 +133,20 @@ changer_typo('','article'.$id_article);
 
 debut_cadre_relief();
 
+// Est-ce que quelqu'un a deja ouvert l'article en edition ?
+ $modif = array();
+ if ($GLOBALS['meta']['articles_modif'] != 'non') {
+	include_spip('inc/drapeau_edition');
+	$modif = qui_edite($id_article, 'article');
+	if ($modif['id_auteur_modif'] == $connect_id_auteur)
+		$modif = array();
+ }
+
 //
 // Titre, surtitre, sous-titre
 //
 
-$modif = titres_articles($titre, $statut_article,$surtitre, $soustitre, $descriptif, $url_site, $nom_site, $flag_editable, $id_article, $id_rubrique);
+ echo titres_articles($titre, $statut_article,$surtitre, $soustitre, $descriptif, $url_site, $nom_site, $flag_editable, $id_article, $id_rubrique, $modif);
 
  echo "<div class='serif' align='$spip_lang_left'>";
 
@@ -149,7 +158,8 @@ $modif = titres_articles($titre, $statut_article,$surtitre, $soustitre, $descrip
 
 
 if ($options == 'avancees' AND $GLOBALS['meta']["articles_mots"] != 'non') {
-  echo formulaire_mots('article', $id_article, $cherche_mot, $select_groupe, $flag_editable);
+  $f = charger_fonction('editer_mot', 'inc');
+  echo $f('article', $id_article, $cherche_mot, $select_groupe, $flag_editable);
 }
 
 // Les langues
@@ -174,7 +184,7 @@ if ($options == 'avancees' AND $GLOBALS['meta']["articles_mots"] != 'non') {
 
  if ($flag_editable) {
 	echo "\n<div align='$spip_lang_right'><br />";
-	bouton_modifier_articles($id_article, $id_rubrique, $modif,_T('texte_travail_article', $modif), "warning-24.gif", "");
+	echo bouton_modifier_articles($id_article, $id_rubrique, $modif,_T('texte_travail_article', $modif), "warning-24.gif", "");
 	echo "</div>";
 }
 
@@ -364,83 +374,63 @@ function meme_rubrique_articles($id_rubrique, $id_article, $options, $order='dat
 function bouton_modifier_articles($id_article, $id_rubrique, $flag_modif, $mode, $ip, $im)
 {
 	if ($flag_modif) {
-	  icone(_T('icone_modifier_article'), generer_url_ecrire("articles_edit","id_article=$id_article"), $ip, $im);
-		echo "<font face='arial,helvetica,sans-serif' size='2'>$mode</font>";
-		echo aide("artmodif");
-	}
-	else {
-		icone(_T('icone_modifier_article'), generer_url_ecrire("articles_edit","id_article=$id_article"), "article-24.gif", "edit.gif");
+		return icone(_T('icone_modifier_article'), generer_url_ecrire("articles_edit","id_article=$id_article"), $ip, $im, true)
+		. "<font face='arial,helvetica,sans-serif' size='2'>$mode</font>"
+		. aide("artmodif");
 	}
-
+	else return icone(_T('icone_modifier_article'), generer_url_ecrire("articles_edit","id_article=$id_article"), "article-24.gif", "edit.gif", true);
 }
 
 // http://doc.spip.org/@titres_articles
-function titres_articles($titre, $statut_article,$surtitre, $soustitre, $descriptif, $url_site, $nom_site, $flag_editable, $id_article, $id_rubrique)
+function titres_articles($titre, $statut_article,$surtitre, $soustitre, $descriptif, $url_site, $nom_site, $flag_editable, $id_article, $id_rubrique, $modif)
 {
-	global  $dir_lang, $spip_lang_left, $connect_id_auteur;
-
-	$tout = '';
+	global  $dir_lang, $spip_lang_left;
 
-	$logo_statut = "puce-".puce_statut($statut_article).".gif";
-	
-	echo "\n<table cellpadding=0 cellspacing=0 border=0 width='100%'>";
-	echo "<tr width='100%'><td width='100%' valign='top'>";
+	$res .= "\n<table cellpadding=0 cellspacing=0 border=0 width='100%'>"
+	. "<tr width='100%'><td width='100%' valign='top'>";
 	
 	if ($surtitre) {
-		echo "<span $dir_lang><font face='arial,helvetica' size=3><b>";
-		echo typo($surtitre);
-		echo "</b></font></span>\n";
+		$res .= "<span $dir_lang><font face='arial,helvetica' size='3'><b>";
+		$res .= typo($surtitre);
+		$res .= "</b></font></span>\n";
 	}
 	 
-	gros_titre($titre, $logo_statut);
+	$res .= gros_titre($titre, "puce-".puce_statut($statut_article).".gif", true);
 	
 	if ($soustitre) {
-		echo "<span $dir_lang><font face='arial,helvetica' size=3><b>";
-		echo typo($soustitre);
-		echo "</b></font></span>\n";
+		$res .= "<span $dir_lang><font face='arial,helvetica' size='3'><b>";
+		$res .= typo($soustitre);
+		$res .= "</b></font></span>\n";
 	}
 	
-	
 	if ($descriptif OR $url_site OR $nom_site) {
-		echo "<p><div align='$spip_lang_left' style='padding: 5px; border: 1px dashed #aaaaaa; background-color: #e4e4e4;' $dir_lang>";
-		echo "<font size=2 face='Verdana,Arial,Sans,sans-serif'>";
+		$res .= "<p><div align='$spip_lang_left' style='padding: 5px; border: 1px dashed #aaaaaa; background-color: #e4e4e4;' $dir_lang>"
+		.  "<font size=2 face='Verdana,Arial,Sans,sans-serif'>";
+
 		$texte_case = ($descriptif) ? "{{"._T('info_descriptif')."}} $descriptif\n\n" : '';
-		$texte_case .= ($nom_site.$url_site) ? "{{"._T('info_urlref')."}} [".$nom_site."->".$url_site."]" : '';
-		echo propre($texte_case);
-		echo "</font>";
-		echo "</div>";
+
+		$texte_case .=  ($nom_site.$url_site) ? "{{"._T('info_urlref')."}} [".$nom_site."->".$url_site."]" : '';
+
+		$res .= propre($texte_case)
+		. "</font>"
+		. "</div>";
 	}
 	
-	
 	if ($statut_article == 'prop') {
-		echo "<P><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=2 COLOR='red'><B>"._T('text_article_propose_publication')."</B></FONT></P>";
+		$res .= "<P><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=2 COLOR='red'><B>"._T('text_article_propose_publication')."</B></FONT></P>";
 	}
 	
-	echo "</td>";
+	$res .= "</td>";
 	
-	$flag_modif = false;
-	$modif = array();
-
 	if ($flag_editable) {
-		echo "<td>". http_img_pack('rien.gif', " ", "width='5'") . "</td>\n";
-		echo "<td align='center'>";
-	
-
-		// Est-ce que quelqu'un a deja ouvert l'article en edition ?
-		unset($modif);
-		if ($GLOBALS['meta']['articles_modif'] != 'non') {
-			include_spip('inc/drapeau_edition');
-			$modif = qui_edite($id_article, 'article');
-			if ($modif['id_auteur_modif'] == $connect_id_auteur)
-				unset($modif);
-		}
-
-		bouton_modifier_articles($id_article, $id_rubrique, $modif, _T('avis_article_modifie', $modif), "article-24.gif", "edit.gif");
-		echo "</td>";
+		$res .= "<td>". http_img_pack('rien.gif', " ", "width='5'") . "</td>\n";
+		$res .= "<td align='center'>";
+		$res .= bouton_modifier_articles($id_article, $id_rubrique, $modif, _T('avis_article_modifie', $modif), "article-24.gif", "edit.gif");
+		$res .= "</td>";
 	}
-	echo "</tr></table>\n";
-	echo "<div>&nbsp;</div>";
-	return $modif;
+	$res .= "</tr></table>\n";
+	$res .= "<div>&nbsp;</div>";
+	return $res;
 }
 
 
diff --git a/ecrire/exec/breves_voir.php b/ecrire/exec/breves_voir.php
index 42374f1a3af611acd1715d2f60fddafe193db3e7..7b49db5f36ee413fffca9aa3f915f5dd4c4d16e8 100644
--- a/ecrire/exec/breves_voir.php
+++ b/ecrire/exec/breves_voir.php
@@ -127,10 +127,9 @@ if ($flag_editable AND ($options == 'avancees' OR $statut == 'publie')) {
 	}
 }
 
-
-
 if ($GLOBALS['meta']["articles_mots"]!='non' AND $flag_editable AND $options == 'avancees') {
-  echo formulaire_mots('breve', $id_breve, $cherche_mot, $select_groupe, $flag_editable);
+  $f = charger_fonction('editer_mot', 'inc');
+  echo $f('breve', $id_breve, $cherche_mot, $select_groupe, $flag_editable);
 }
 
 
diff --git a/ecrire/exec/naviguer.php b/ecrire/exec/naviguer.php
index eee2c4927117ba4aabd9641e84ae41ba9936ddee..e277170db571ac31b9562e17f6046795e1e67dbd 100644
--- a/ecrire/exec/naviguer.php
+++ b/ecrire/exec/naviguer.php
@@ -133,8 +133,9 @@ function exec_naviguer_dist()
 
 /// Mots-cles
 	    if ($GLOBALS['meta']["articles_mots"] != 'non' AND $id_rubrique > 0) {
+	      $f = charger_fonction('editer_mot', 'inc');
 	      echo "\n<p>",
-		formulaire_mots('rubrique', $id_rubrique,  $cherche_mot,  $select_groupe, $flag_editable);
+		$f('rubrique', $id_rubrique,  $cherche_mot,  $select_groupe, $flag_editable);
 	    }
 
 
diff --git a/ecrire/exec/sites.php b/ecrire/exec/sites.php
index c8ef99d149a96dc370a0fe42df012972417263fa..5134164fc27ddc924784a750e34b201939591e86 100644
--- a/ecrire/exec/sites.php
+++ b/ecrire/exec/sites.php
@@ -332,7 +332,8 @@ if ($flag_editable AND ($options == 'avancees' OR $statut == 'publie')) {
  echo "\n";
 
 if ($flag_editable AND $options == 'avancees') {
-  echo formulaire_mots('syndic', $id_syndic,  $cherche_mot,  $select_groupe, $flag_editable);
+  $f = charger_fonction('editer_mot', 'inc');
+  echo $f('syndic', $id_syndic,  $cherche_mot,  $select_groupe, $flag_editable);
 }
 echo pipeline('affiche_milieu',array('args'=>array('exec'=>'sites','id_syndic'=>$id_syndic),'data'=>''));
 
diff --git a/ecrire/fragments/editer_mot.php b/ecrire/fragments/editer_mot.php
index 9b19ad6358bfb3f3442f4bb87b4c7890ef783f72..1fa4ecb8315dca2a983f2a167048f147943d30b1 100644
--- a/ecrire/fragments/editer_mot.php
+++ b/ecrire/fragments/editer_mot.php
@@ -41,10 +41,9 @@ function fragments_editer_mot_dist()
 		minipres(_T('info_acces_interdit'));
 	}
 
-	return formulaire_mots($objet, $id_objet, _request('cherche_mot'),
-			      _request('select_groupe'),
-			      'ajax'
-			      ); 
+	$ch = _request('cherche_mot');
+	$id_groupe = _request('select_groupe');
+	$f = charger_fonction('editer_mot', 'inc');
+	return $f($objet, $id_objet, $ch, $id_groupe, 'ajax'); 
 }
-
 ?>
diff --git a/ecrire/fragments/memoriser.php b/ecrire/fragments/memoriser.php
index 1842f7c38259b841ac729fdf5bc438dea22881b0..d8a603fedf3636602909dfb483a7a35165a67f1e 100644
--- a/ecrire/fragments/memoriser.php
+++ b/ecrire/fragments/memoriser.php
@@ -15,36 +15,18 @@ if (!defined("_ECRIRE_INC_VERSION")) return;
 // http://doc.spip.org/@fragments_memoriser_dist
 function fragments_memoriser_dist()
 {
-	global $flag_ob;
+	global $flag_ob,$connect_id_auteur, $id_ajax_fonc;
 
 	if ($flag_ob) ob_start();
-	
-	ajax_page_sql();
 
-	if ($flag_ob) {
-			$a = ob_get_contents();
-			ob_end_clean();
-			return $a;
-	}
-}
-
-# Une fonction stockee en base de donnees 
-
-// http://doc.spip.org/@ajax_page_sql
-function ajax_page_sql()
-{
-	global $connect_id_auteur, $id_ajax_fonc;
+	$res = spip_fetch_array(spip_query("SELECT variables FROM spip_ajax_fonc	WHERE id_ajax_fonc =" . spip_abstract_quote($id_ajax_fonc) . " AND id_auteur=$connect_id_auteur"));
 
-	$res = spip_query("SELECT variables FROM spip_ajax_fonc	WHERE id_ajax_fonc =" . spip_abstract_quote($id_ajax_fonc) . " AND id_auteur=$connect_id_auteur");
-	if ($row = spip_fetch_array($res)) {
+	if ($res = unserialize($res["variables"])) {
 		
-		$variables = unserialize($row["variables"]);
-		while (list($i, $k) = each($variables)) {
-			$$i = $k;
-			
-		}
+		foreach($res as $i => $k) $$i = $k;
+
 		include_spip('inc/presentation');		
-		// Appliquer la fonction
+
 		if ($fonction == "afficher_articles") {
 			afficher_articles ($titre_table, $requete,
 				$afficher_visites, $afficher_auteurs);
@@ -55,5 +37,11 @@ function ajax_page_sql()
 				$afficher_visites, $afficher_auteurs);
 		}
 	}
+
+	if ($flag_ob) {
+			$res = ob_get_contents();
+			ob_end_clean();
+			return $res;
+	}
 }
 ?>
diff --git a/ecrire/inc/editer_mot.php b/ecrire/inc/editer_mot.php
new file mode 100644
index 0000000000000000000000000000000000000000..cfd0d4a5396ed1839dd6ffae14711dc235dfedce
--- /dev/null
+++ b/ecrire/inc/editer_mot.php
@@ -0,0 +1,404 @@
+<?php
+
+/***************************************************************************\
+ *  SPIP, Systeme de publication pour l'internet                           *
+ *                                                                         *
+ *  Copyright (c) 2001-2006                                                *
+ *  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.   *
+\***************************************************************************/
+
+if (!defined("_ECRIRE_INC_VERSION")) return;
+include_spip('inc/actions');
+
+
+// http://doc.spip.org/@formulaire_mots
+function inc_editer_mot_dist($objet, $id_objet, $cherche_mot, $select_groupe, $flag_editable) {
+	global $connect_statut, $spip_lang_rtl, $spip_lang_right, $spip_lang;
+
+	$visible = ($cherche_mot OR ($flag_editable === 'ajax'));
+
+	if ($objet == 'article') {
+		$table_id = 'id_article';
+		$table = 'articles';
+		$url_base = "articles";
+	}
+	else if ($objet == 'breve') {
+		$table_id = 'id_breve';
+		$table = 'breves';
+		$url_base = "breves_voir";
+	}
+	else if ($objet == 'rubrique') {
+		$table_id = 'id_rubrique';
+		$table = 'rubriques';
+		$url_base = "naviguer";
+	}
+
+	else if ($objet == 'syndic') {
+		$table_id = 'id_syndic';
+		$table = 'syndic';
+		$url_base = "sites";
+	}
+	else {
+		spip_log("erreur dans formulaire_mots($objet, $id_objet, $cherche_mot, $select_groupe, $flag_editable)");
+		return '';
+	}
+
+	$cpt = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_mots AS mots, spip_mots_$table AS lien WHERE lien.$table_id=$id_objet AND mots.id_mot=lien.id_mot"));
+
+	if (!($nombre_mots = $cpt['n'])) {
+		if (!$flag_editable) return;
+		$cpt = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_groupes_mots WHERE $table = 'oui'	AND ".substr($connect_statut,1)." = 'oui'"));
+
+		if (!$cpt['n']) return;
+	}
+
+	//
+	// Preparer l'affichage
+	//
+
+	// La reponse
+	$reponse = '';
+	if ($flag_editable AND $cherche_mot) {
+		$reindexer = false;
+		list($reponse, $nouveaux_mots) = recherche_mot_cle($cherche_mot, $select_groupe, $objet, $id_objet, $table, $table_id, $url_base);
+		foreach($nouveaux_mots as $nouv_mot) {
+			if ($nouv_mot!='x') {
+				$reindexer |= inserer_mot("spip_mots_$table", $table_id, $id_objet, $nouv_mot);
+			}
+		}
+		if ($reindexer AND ($GLOBALS['meta']['activer_moteur'] == 'oui')) {
+			include_spip("inc/indexation");
+			marquer_indexer("spip_$table", $id_objet);
+		}
+	}
+
+	$form = afficher_mots_cles($flag_editable, $objet, $id_objet, $table, $table_id, $url_base, $visible);
+
+	// Envoyer titre + div-id + formulaire + fin
+	if ($flag_editable){
+		if ($visible)
+			$bouton = bouton_block_visible("lesmots");
+		else
+			$bouton =  bouton_block_invisible("lesmots");
+	} else $bouton = '';
+
+	$bouton .= _T('titre_mots_cles').aide ("artmots");
+
+	$res =  '<div>&nbsp;</div>' // place pour l'animation pendant Ajax
+	. debut_cadre_enfonce("mot-cle-24.gif", true, "", $bouton)
+	  . $reponse
+	  . $form
+	  . fin_cadre_enfonce(true);
+
+	return ($flag_editable === 'ajax') 
+	  ? $res
+	  : "\n<div id='editer_mot-$id_objet'>$res</div>";
+}
+
+// http://doc.spip.org/@inserer_mot
+function inserer_mot($table, $table_id, $id_objet, $id_mot)
+{
+	$result = spip_num_rows(spip_query("SELECT id_mot FROM $table WHERE id_mot=$id_mot AND $table_id=$id_objet"));
+
+	if (!$result) {
+		spip_query("INSERT INTO $table (id_mot,$table_id) VALUES ($id_mot, $id_objet)");
+	}
+	return $result;
+}
+
+
+// http://doc.spip.org/@recherche_mot_cle
+function recherche_mot_cle($cherche_mots, $id_groupe, $objet, $id_objet, $table, $table_id, $url_base)
+{
+	if ($table == 'articles') $ou = _T('info_l_article');
+	else if ($table == 'breves') $ou = _T('info_la_breve');
+	else if ($table == 'rubriques') $ou = _T('info_la_rubrique');
+
+	$result = spip_query("SELECT id_mot, titre FROM spip_mots WHERE id_groupe=$id_groupe");
+
+	$table_mots = array();
+	$table_ids = array();
+	while ($row = spip_fetch_array($result)) {
+			$table_ids[] = $row['id_mot'];
+			$table_mots[] = $row['titre'];
+	}
+
+	$nouveaux_mots = array();
+	$res = '';
+
+	foreach (split(" *[,;] *", $cherche_mots) as $cherche_mot) {
+	  if  ($cherche_mot) {
+		$resultat = mots_ressemblants($cherche_mot, $table_mots, $table_ids);
+		$res .= "<P>" . debut_boite_info(true);
+		if (!$resultat) {
+			$res .= "<B>"._T('info_non_resultat', array('cherche_mot' => $cherche_mot))."</B><BR>";
+		}
+		else if (count($resultat) == 1) {
+			$nouveaux_mots[] = $resultat[0];
+			$row = spip_fetch_array(spip_query("SELECT titre FROM spip_mots WHERE id_mot=$resultat[0]"));
+			$res .= "<B>"._T('info_mot_cle_ajoute')." $ou : </B><BR><UL>";
+			$res .= "<LI><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE='2'><B><FONT SIZE='3'>".typo($row['titre'])."</FONT></B></FONT></LI>\n";
+			$res .= "</UL>";
+		}
+		else $res .= affiche_mots_ressemblant($cherche_mot, $objet, $id_objet, $resultat, $table, $table_id, $url_base);
+
+/*		if (acces_mots()) {
+			$titre = rawurlencode($cherche_mot);
+			$res .= "<div style='width: 200px;'>";
+			$res .= icone_horizontale(_T('icone_creer_mot_cle'), generer_url_ecrire("mots_edit","new=oui&id_groupe=$id_groupe&ajouter_id_article=$id_objet&table=$table&table_id=$table_id&titre=$titre&redirect=" . generer_url_retour($url_base, "$table_id=$id_objet")), "mot-cle-24.gif", "creer.gif", false);
+			$res .= "</div> ";
+		}
+*/
+
+		$res .= fin_boite_info(true) . "<p>";
+	  }
+	}
+	return array($res, $nouveaux_mots);
+}
+
+// http://doc.spip.org/@afficher_mots_cles
+function afficher_mots_cles($flag_editable, $objet, $id_objet, $table, $table_id, $url_base, $visible)
+{
+	global $spip_lang_rtl, $spip_lang, $spip_lang_right, $connect_statut, $connect_toutes_rubriques, $options;
+
+	$les_mots = array();
+	$id_groupes_vus = array();
+	$groupes_vus = array();
+	$result = spip_query("SELECT mots.id_mot, mots.titre, mots.descriptif, mots.id_groupe FROM spip_mots AS mots, spip_mots_$table AS lien WHERE lien.$table_id=$id_objet AND mots.id_mot=lien.id_mot ORDER BY mots.type, mots.titre");
+	if (spip_num_rows($result) > 0) {
+	
+		$tableau= array();
+		$cle = http_img_pack('petite-cle.gif', "", "width='23' height='12'");
+		$ret = generer_url_retour($url_base, "$table_id=$id_objet#mots");
+		while ($row = spip_fetch_array($result)) {
+
+			$id_mot = $row['id_mot'];
+			$titre_mot = $row['titre'];
+			$descriptif_mot = $row['descriptif'];
+			$id_groupe = $row['id_groupe'];
+
+			$id_groupes_vus[] = $id_groupe;
+			$url = generer_url_ecrire('mots_edit', "id_mot=$id_mot&redirect=$ret");
+			$vals= array("<A href='$url'>$cle</A>");
+			
+
+			$row_groupe = spip_fetch_array(spip_query("SELECT titre, unseul, obligatoire, minirezo, comite FROM spip_groupes_mots WHERE id_groupe = $id_groupe"));
+	// On recupere le typo_mot ici, et non dans le mot-cle lui-meme; sinon bug avec arabe
+
+			$type_mot = typo($row_groupe['titre']);
+			$flag_groupe = ($flag_editable AND
+					((($connect_statut === '1comite') AND $row_groupe['comite'] === 'oui') OR (($connect_statut === '0minirezo') AND $row_groupe['minirezo'] === 'oui')));
+
+			// Changer
+			if (($row_groupe['unseul'] == "oui") AND $flag_groupe) {
+				$vals[]= formulaire_mot_remplace($id_groupe, $id_mot, $url_base, $table, $table_id, $objet, $id_objet);
+			} else {
+				$vals[]= "<A href='$url'>".typo($titre_mot)."</A>";
+			}
+
+			if ($connect_toutes_rubriques)
+				$vals[]= "<a href='" . generer_url_ecrire("mots_type","id_groupe=$id_groupe") . "'>$type_mot</a>";
+
+			else	$vals[] = $type_mot;
+	
+			if ($flag_editable){
+				if ($flag_groupe) {
+					$s =  _T('info_retirer_mot')
+					. "&nbsp;"
+					. http_img_pack('croix-rouge.gif', "X", "width='7' height='7' align='middle'");
+					$s = ajax_action_auteur('editer_mot', "$id_objet,$id_mot,$table,$table_id,$objet", $url_base, "$table_id=$id_objet", array($s,''),"&id_objet=$id_objet&objet=$objet");
+				} else $s = "&nbsp;";
+				$vals[] = $s;
+			} else $vals[]= "";
+
+			$tableau[] = $vals;
+	
+			$les_mots[] = $id_mot;
+		}
+	
+		$largeurs = array('25', '', '', '');
+		$styles = array('arial11', 'arial2', 'arial2', 'arial1');
+
+		$res = "\n<div class='liste'>"
+		. "\n<table width='100%' cellpadding='3' cellspacing='0' border='0' background=''>"
+		. afficher_liste($largeurs, $tableau, $styles)
+		. "</table></div>";
+	} else $res ='';
+
+	if ($flag_editable)
+	  $res .= formulaire_mots_cles($id_groupes_vus, $id_objet, $les_mots, $table, $table_id, $url_base, $visible, $objet);
+
+	return $res;
+}
+
+// http://doc.spip.org/@formulaire_mot_remplace
+function formulaire_mot_remplace($id_groupe, $id_mot, $url_base, $table, $table_id, $objet, $id_objet)
+{
+	$result = spip_query("SELECT id_mot, titre FROM spip_mots WHERE id_groupe = $id_groupe ORDER by titre");
+
+	$s = '';
+
+	while ($row_autres = spip_fetch_array($result)) {
+		$id = $row_autres['id_mot'];
+		$le_titre_mot = supprimer_tags(typo($row_autres['titre']));
+		$selected = ($id == $id_mot) ? " selected='selected'" : "";
+		$s .= "<option value='$id'$selected> $le_titre_mot</option>";
+	}
+
+	$ancre = "valider_groupe_$id_groupe"; 
+	// forcer le recalcul du noeud car on est en Ajax
+	$jscript1 = "findObj_forcer('$ancre').style.visibility='visible';";
+
+	return ajax_action_auteur('editer_mot', "$id_objet,$id_mot,$table,$table_id,$objet", $url_base, "$table_id=$id_objet", (
+	"<select name='nouv_mot' onchange=\"$jscript1\""
+	. " class='fondl' style='font-size:10px; width:90px;'>"
+	. $s
+	. "</select>"
+	. "<span class='visible_au_chargement' id='$ancre'>"
+	. "\n&nbsp; <input type='submit' value='"
+	. _T('bouton_changer')
+	. "' CLASS='fondo' style='font-size: 10px';>"
+	. "</span>"),"&id_objet=$id_objet&objet=$objet");
+}
+
+
+// http://doc.spip.org/@formulaire_mots_cles
+function formulaire_mots_cles($id_groupes_vus, $id_objet, $les_mots, $table, $table_id, $url_base, $visible, $objet) {
+	global $connect_statut, $spip_lang, $spip_lang_right, $spip_lang_rtl;
+
+	if ($les_mots) {
+		$nombre_mots_associes = count($les_mots);
+		$les_mots = join($les_mots, ",");
+	} else {
+		$les_mots = "0";
+		$nombre_mots_associes = 0;
+	}
+	$cond_id_groupes_vus = "0";
+	if ($id_groupes_vus) $cond_id_groupes_vus = join(",",$id_groupes_vus);
+	
+	$nb_groupes = spip_num_rows(spip_query("SELECT * FROM spip_groupes_mots WHERE $table = 'oui' AND ".substr($connect_statut,1)." = 'oui' AND obligatoire = 'oui' AND id_groupe NOT IN ($cond_id_groupes_vus)"));
+
+	if ($visible)
+		$res = debut_block_visible("lesmots");
+	else if ($nb_groupes > 0) {
+		$res = debut_block_visible("lesmots");
+			// vilain hack pour redresser un triangle
+		$couche_a_redresser = $GLOBALS['numero_block']['lesmots'];
+		if ($GLOBALS['browser_layer'])
+			$res .= http_script("
+				triangle = findObj('triangle' + $couche_a_redresser);
+				if (triangle) triangle.src = '" . _DIR_IMG_PACK . "deplierbas$spip_lang_rtl.gif';");
+	} else $res = debut_block_invisible("lesmots");
+
+	if ($nombre_mots_associes > 3) {
+		$res .= "<div align='right' class='arial1'>"
+		  . ajax_action_auteur('editer_mot', "$id_objet,-1,$table,$table_id,$objet", $url_base, "$table_id=$id_objet", array(_T('info_retirer_mots'),''),"&id_objet=$id_objet&objet=$objet")
+		. "</div><br />\n";
+	}
+
+	$result_groupes = spip_query("SELECT id_groupe,unseul,obligatoire,titre, ".creer_objet_multi ("titre", $spip_lang)." FROM spip_groupes_mots WHERE $table = 'oui' AND ".substr($connect_statut,1)." = 'oui' AND (unseul != 'oui'  OR (unseul = 'oui' AND id_groupe NOT IN ($cond_id_groupes_vus))) ORDER BY multi");
+
+	// Afficher un menu par groupe de mots
+	$ajouter ='';
+	while ($row = spip_fetch_array($result_groupes)) {
+		if ($menu = menu_mots($row, $id_groupes_vus, $les_mots)) {
+			$menu = ajax_action_auteur('editer_mot',
+				"$id_objet,,$table,$table_id,$objet",
+				$url_base,
+				"$table_id=$id_objet",
+				$menu,
+				"&id_objet=$id_objet&objet=$objet&select_groupe="
+					.$row['id_groupe']
+			);
+			$ajouter .= "<div>$menu</div>\n";
+		}
+	}
+	if ($ajouter) {
+		$message = "<span class='verdana1'><b>"._T('titre_ajouter_mot_cle')."</b></span>\n";
+		$res .= "<div style='float:$spip_lang_right; width:280px;position:relative;display:inline;'>"
+			. $ajouter
+			."</div>\n" ;
+	}
+
+	if (acces_mots()) {
+		$titre = _request('cherche_mot')
+			? "&titre=".rawurlencode(_request('cherche_mot')) : '';
+		$bouton_ajouter = icone_horizontale(_T('icone_creer_mot_cle'), generer_url_ecrire("mots_edit","new=oui&ajouter_id_article=$id_objet&table=$table&table_id=$table_id$titre&redirect=" . generer_url_retour($url_base, "$table_id=$id_objet")), "mot-cle-24.gif", "creer.gif", false)
+		. "\n";
+	}
+
+	if ($message OR $bouton_ajouter) {
+		$res .= "<div style='width:170px;'>$message
+			<br />$bouton_ajouter</div>\n";
+	}
+
+	return $res . fin_block();
+}
+
+
+// http://doc.spip.org/@menu_mots
+function menu_mots($row, $id_groupes_vus, $les_mots)
+{
+	$id_groupe = $row['id_groupe'];
+
+	$result = spip_query("SELECT id_mot, type, titre FROM spip_mots WHERE id_groupe =$id_groupe " . ($les_mots ? "AND id_mot NOT IN ($les_mots) " : '') .  "ORDER BY type, titre");
+
+	$n = spip_num_rows($result);
+	if (!$n) return '';
+
+	$titre = textebrut(typo($row['titre']));
+	$titre_groupe = entites_html($titre);
+	$unseul = $row['unseul'] == 'oui';
+	$obligatoire = $row['obligatoire']=='oui' AND !in_array($id_groupe, $id_groupes_vus);
+
+	$res = '';
+	$ancre = "valider_groupe_$id_groupe"; 
+
+	// forcer le recalcul du noeud car on est en Ajax
+	$jscript1 = "findObj_forcer('$ancre').style.visibility='visible';";
+	$jscript2 = "if(!antifocus_mots[$id_groupe]){this.value='';antifocus_mots[$id_groupe]=true;}";
+
+	if ($n > 50) {
+		$jscript = "onfocus=\"$jscript1 $jscript2\"";
+
+		if ($obligatoire)
+			$res .= "<input type='text' name='cherche_mot' class='fondl' style='width: 180px; background-color:#E86519;' value=\"$titre_groupe\" size='20' $jscript>";
+		else if ($unseul)
+			$res .= "<input type='text' name='cherche_mot' class='fondl' style='width: 180px; background-color:#cccccc;' value=\"$titre_groupe\" size='20' $jscript>";
+		else
+			$res .= "<input type='text' name='cherche_mot'  class='fondl' style='width: 180px; ' value=\"$titre_groupe\" size='20' $jscript>";
+
+		$res .= "<input type='hidden' name='select_groupe'  value='$id_groupe' />";
+		$res .= "<span class='visible_au_chargement' id='$ancre'>";
+		$res .= " <input type='submit' value='"._T('bouton_chercher')."' class='fondo' style='font-size:10px'>";
+		$res .= "</span>"; 
+	} else {
+
+		$jscript = "onchange=\"$jscript1\"";
+	  
+		if ($obligatoire)
+			$res .= "<SELECT NAME='nouv_mot' SIZE='1' STYLE='width: 180px; background-color:#E86519;' CLASS='fondl' $jscript>";
+		else if ($unseul)
+			$res .= "<SELECT NAME='nouv_mot' SIZE='1' STYLE='width: 180px; background-color:#cccccc;' CLASS='fondl' $jscript>";
+		else
+			$res .= "<SELECT NAME='nouv_mot' SIZE='1' STYLE='width: 180px; ' CLASS='fondl' $jscript>";
+
+		$res .= "\n<option value='x' style='font-variant: small-caps;'>$titre</option>";
+		while($row = spip_fetch_array($result)) {
+			$res .= "\n<option value='" .$row['id_mot'] .
+				"'>&nbsp;&nbsp;&nbsp;" .
+				textebrut(typo($row['titre'])) .
+				"</option>";
+		}
+		$res .= "</SELECT>";
+		$res .= "<span class='visible_au_chargement' id='$ancre'>";
+		$res .= "\n&nbsp;<input type='submit' value='"._T('bouton_choisir')."' CLASS='fondo' />";
+		$res .= "</span>";
+	}
+
+	return $res;
+}
+?>
diff --git a/ecrire/inc/mots.php b/ecrire/inc/mots.php
index 4e59d3c946e101128356be147319f9629dffc5a1..697956c820c3f5c264b2755ab856d0e5986057e3 100644
--- a/ecrire/inc/mots.php
+++ b/ecrire/inc/mots.php
@@ -106,102 +106,6 @@ function mots_ressemblants($mot, $table_mots, $table_ids='') {
  * plus le formulaire d'ajout de mot-cle
  */
 
-// http://doc.spip.org/@formulaire_mots
-function formulaire_mots($objet, $id_objet, $cherche_mot, $select_groupe, $flag_editable) {
-	global $connect_statut, $spip_lang_rtl, $spip_lang_right, $spip_lang;
-
-	$visible = ($cherche_mot OR ($flag_editable === 'ajax'));
-
-	if ($objet == 'article') {
-		$table_id = 'id_article';
-		$table = 'articles';
-		$url_base = "articles";
-	}
-	else if ($objet == 'breve') {
-		$table_id = 'id_breve';
-		$table = 'breves';
-		$url_base = "breves_voir";
-	}
-	else if ($objet == 'rubrique') {
-		$table_id = 'id_rubrique';
-		$table = 'rubriques';
-		$url_base = "naviguer";
-	}
-
-	else if ($objet == 'syndic') {
-		$table_id = 'id_syndic';
-		$table = 'syndic';
-		$url_base = "sites";
-	}
-	else {
-		spip_log("erreur dans formulaire_mots($objet, $id_objet, $cherche_mot, $select_groupe, $flag_editable)");
-		return '';
-	}
-
-	$cpt = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_mots AS mots, spip_mots_$table AS lien WHERE lien.$table_id=$id_objet AND mots.id_mot=lien.id_mot"));
-
-	if (!($nombre_mots = $cpt['n'])) {
-		if (!$flag_editable) return;
-		$cpt = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_groupes_mots WHERE $table = 'oui'	AND ".substr($connect_statut,1)." = 'oui'"));
-
-		if (!$cpt['n']) return;
-	}
-
-	//
-	// Preparer l'affichage
-	//
-
-	// La reponse
-	$reponse = '';
-	if ($flag_editable AND $cherche_mot) {
-		$reindexer = false;
-		list($reponse, $nouveaux_mots) = recherche_mot_cle($cherche_mot, $select_groupe, $objet, $id_objet, $table, $table_id, $url_base);
-		foreach($nouveaux_mots as $nouv_mot) {
-			if ($nouv_mot!='x') {
-				$reindexer |= inserer_mot("spip_mots_$table", $table_id, $id_objet, $nouv_mot);
-			}
-		}
-		if ($reindexer AND ($GLOBALS['meta']['activer_moteur'] == 'oui')) {
-			include_spip("inc/indexation");
-			marquer_indexer("spip_$table", $id_objet);
-		}
-	}
-
-	$form = afficher_mots_cles($flag_editable, $objet, $id_objet, $table, $table_id, $url_base, $visible);
-
-	// Envoyer titre + div-id + formulaire + fin
-	if ($flag_editable){
-		if ($visible)
-			$bouton = bouton_block_visible("lesmots");
-		else
-			$bouton =  bouton_block_invisible("lesmots");
-	} else $bouton = '';
-
-	$bouton .= _T('titre_mots_cles').aide ("artmots");
-
-	$res =  '<div>&nbsp;</div>' // place pour l'animation pendant Ajax
-	. debut_cadre_enfonce("mot-cle-24.gif", true, "", $bouton)
-	  . $reponse
-	  . $form
-	  . fin_cadre_enfonce(true);
-
-	return ($flag_editable === 'ajax') 
-	  ? $res
-	  : "\n<div id='editer_mot-$id_objet'>$res</div>";
-}
-
-// http://doc.spip.org/@inserer_mot
-function inserer_mot($table, $table_id, $id_objet, $id_mot)
-{
-	$result = spip_num_rows(spip_query("SELECT id_mot FROM $table WHERE id_mot=$id_mot AND $table_id=$id_objet"));
-
-	if (!$result) {
-		spip_query("INSERT INTO $table (id_mot,$table_id) VALUES ($id_mot, $id_objet)");
-	}
-	return $result;
-}
-
-
 // http://doc.spip.org/@affiche_mots_ressemblant
 function affiche_mots_ressemblant($cherche_mot, $objet, $id_objet, $resultat, $table, $table_id, $url_base)
 {
@@ -232,295 +136,4 @@ function affiche_mots_ressemblant($cherche_mot, $objet, $id_objet, $resultat, $t
 	return $res2 . $res;
 }
 
-// http://doc.spip.org/@recherche_mot_cle
-function recherche_mot_cle($cherche_mots, $id_groupe, $objet, $id_objet, $table, $table_id, $url_base)
-{
-	if ($table == 'articles') $ou = _T('info_l_article');
-	else if ($table == 'breves') $ou = _T('info_la_breve');
-	else if ($table == 'rubriques') $ou = _T('info_la_rubrique');
-
-	$result = spip_query("SELECT id_mot, titre FROM spip_mots WHERE id_groupe=$id_groupe");
-
-	$table_mots = array();
-	$table_ids = array();
-	while ($row = spip_fetch_array($result)) {
-			$table_ids[] = $row['id_mot'];
-			$table_mots[] = $row['titre'];
-	}
-
-	$nouveaux_mots = array();
-	$res = '';
-
-	foreach (split(" *[,;] *", $cherche_mots) as $cherche_mot) {
-	  if  ($cherche_mot) {
-		$resultat = mots_ressemblants($cherche_mot, $table_mots, $table_ids);
-		$res .= "<P>" . debut_boite_info(true);
-		if (!$resultat) {
-			$res .= "<B>"._T('info_non_resultat', array('cherche_mot' => $cherche_mot))."</B><BR>";
-		}
-		else if (count($resultat) == 1) {
-			$nouveaux_mots[] = $resultat[0];
-			$row = spip_fetch_array(spip_query("SELECT titre FROM spip_mots WHERE id_mot=$resultat[0]"));
-			$res .= "<B>"._T('info_mot_cle_ajoute')." $ou : </B><BR><UL>";
-			$res .= "<LI><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE='2'><B><FONT SIZE='3'>".typo($row['titre'])."</FONT></B></FONT></LI>\n";
-			$res .= "</UL>";
-		}
-		else $res .= affiche_mots_ressemblant($cherche_mot, $objet, $id_objet, $resultat, $table, $table_id, $url_base);
-
-/*		if (acces_mots()) {
-			$titre = rawurlencode($cherche_mot);
-			$res .= "<div style='width: 200px;'>";
-			$res .= icone_horizontale(_T('icone_creer_mot_cle'), generer_url_ecrire("mots_edit","new=oui&id_groupe=$id_groupe&ajouter_id_article=$id_objet&table=$table&table_id=$table_id&titre=$titre&redirect=" . generer_url_retour($url_base, "$table_id=$id_objet")), "mot-cle-24.gif", "creer.gif", false);
-			$res .= "</div> ";
-		}
-*/
-
-		$res .= fin_boite_info(true) . "<p>";
-	  }
-	}
-	return array($res, $nouveaux_mots);
-}
-
-// http://doc.spip.org/@afficher_mots_cles
-function afficher_mots_cles($flag_editable, $objet, $id_objet, $table, $table_id, $url_base, $visible)
-{
-	global $spip_lang_rtl, $spip_lang, $spip_lang_right, $connect_statut, $connect_toutes_rubriques, $options;
-
-	$les_mots = array();
-	$id_groupes_vus = array();
-	$groupes_vus = array();
-	$result = spip_query("SELECT mots.id_mot, mots.titre, mots.descriptif, mots.id_groupe FROM spip_mots AS mots, spip_mots_$table AS lien WHERE lien.$table_id=$id_objet AND mots.id_mot=lien.id_mot ORDER BY mots.type, mots.titre");
-	if (spip_num_rows($result) > 0) {
-	
-		$tableau= array();
-		$cle = http_img_pack('petite-cle.gif', "", "width='23' height='12'");
-		$ret = generer_url_retour($url_base, "$table_id=$id_objet#mots");
-		while ($row = spip_fetch_array($result)) {
-
-			$id_mot = $row['id_mot'];
-			$titre_mot = $row['titre'];
-			$descriptif_mot = $row['descriptif'];
-			$id_groupe = $row['id_groupe'];
-
-			$id_groupes_vus[] = $id_groupe;
-			$url = generer_url_ecrire('mots_edit', "id_mot=$id_mot&redirect=$ret");
-			$vals= array("<A href='$url'>$cle</A>");
-			
-
-			$row_groupe = spip_fetch_array(spip_query("SELECT titre, unseul, obligatoire, minirezo, comite FROM spip_groupes_mots WHERE id_groupe = $id_groupe"));
-	// On recupere le typo_mot ici, et non dans le mot-cle lui-meme; sinon bug avec arabe
-
-			$type_mot = typo($row_groupe['titre']);
-			$flag_groupe = ($flag_editable AND
-					((($connect_statut === '1comite') AND $row_groupe['comite'] === 'oui') OR (($connect_statut === '0minirezo') AND $row_groupe['minirezo'] === 'oui')));
-
-			// Changer
-			if (($row_groupe['unseul'] == "oui") AND $flag_groupe) {
-				$vals[]= formulaire_mot_remplace($id_groupe, $id_mot, $url_base, $table, $table_id, $objet, $id_objet);
-			} else {
-				$vals[]= "<A href='$url'>".typo($titre_mot)."</A>";
-			}
-
-			if ($connect_toutes_rubriques)
-				$vals[]= "<a href='" . generer_url_ecrire("mots_type","id_groupe=$id_groupe") . "'>$type_mot</a>";
-
-			else	$vals[] = $type_mot;
-	
-			if ($flag_editable){
-				if ($flag_groupe) {
-					$s =  _T('info_retirer_mot')
-					. "&nbsp;"
-					. http_img_pack('croix-rouge.gif', "X", "width='7' height='7' align='middle'");
-					$s = ajax_action_auteur('editer_mot', "$id_objet,$id_mot,$table,$table_id,$objet", $url_base, "$table_id=$id_objet", array($s,''),"&id_objet=$id_objet&objet=$objet");
-				} else $s = "&nbsp;";
-				$vals[] = $s;
-			} else $vals[]= "";
-
-			$tableau[] = $vals;
-	
-			$les_mots[] = $id_mot;
-		}
-	
-		$largeurs = array('25', '', '', '');
-		$styles = array('arial11', 'arial2', 'arial2', 'arial1');
-
-		$res = "\n<div class='liste'>"
-		. "\n<table width='100%' cellpadding='3' cellspacing='0' border='0' background=''>"
-		. afficher_liste($largeurs, $tableau, $styles)
-		. "</table></div>";
-	} else $res ='';
-
-	if ($flag_editable)
-	  $res .= formulaire_mots_cles($id_groupes_vus, $id_objet, $les_mots, $table, $table_id, $url_base, $visible, $objet);
-
-	return $res;
-}
-
-// http://doc.spip.org/@formulaire_mot_remplace
-function formulaire_mot_remplace($id_groupe, $id_mot, $url_base, $table, $table_id, $objet, $id_objet)
-{
-	$result = spip_query("SELECT id_mot, titre FROM spip_mots WHERE id_groupe = $id_groupe ORDER by titre");
-
-	$s = '';
-
-	while ($row_autres = spip_fetch_array($result)) {
-		$id = $row_autres['id_mot'];
-		$le_titre_mot = supprimer_tags(typo($row_autres['titre']));
-		$selected = ($id == $id_mot) ? " selected='selected'" : "";
-		$s .= "<option value='$id'$selected> $le_titre_mot</option>";
-	}
-
-	$ancre = "valider_groupe_$id_groupe"; 
-	// forcer le recalcul du noeud car on est en Ajax
-	$jscript1 = "findObj_forcer('$ancre').style.visibility='visible';";
-
-	return ajax_action_auteur('editer_mot', "$id_objet,$id_mot,$table,$table_id,$objet", $url_base, "$table_id=$id_objet", (
-	"<select name='nouv_mot' onchange=\"$jscript1\""
-	. " class='fondl' style='font-size:10px; width:90px;'>"
-	. $s
-	. "</select>"
-	. "<span class='visible_au_chargement' id='$ancre'>"
-	. "\n&nbsp; <input type='submit' value='"
-	. _T('bouton_changer')
-	. "' CLASS='fondo' style='font-size: 10px';>"
-	. "</span>"),"&id_objet=$id_objet&objet=$objet");
-}
-
-
-// http://doc.spip.org/@formulaire_mots_cles
-function formulaire_mots_cles($id_groupes_vus, $id_objet, $les_mots, $table, $table_id, $url_base, $visible, $objet) {
-	global $connect_statut, $spip_lang, $spip_lang_right, $spip_lang_rtl;
-
-	if ($les_mots) {
-		$nombre_mots_associes = count($les_mots);
-		$les_mots = join($les_mots, ",");
-	} else {
-		$les_mots = "0";
-		$nombre_mots_associes = 0;
-	}
-	$cond_id_groupes_vus = "0";
-	if ($id_groupes_vus) $cond_id_groupes_vus = join(",",$id_groupes_vus);
-	
-	$nb_groupes = spip_num_rows(spip_query("SELECT * FROM spip_groupes_mots WHERE $table = 'oui' AND ".substr($connect_statut,1)." = 'oui' AND obligatoire = 'oui' AND id_groupe NOT IN ($cond_id_groupes_vus)"));
-
-	if ($visible)
-		$res = debut_block_visible("lesmots");
-	else if ($nb_groupes > 0) {
-		$res = debut_block_visible("lesmots");
-			// vilain hack pour redresser un triangle
-		$couche_a_redresser = $GLOBALS['numero_block']['lesmots'];
-		if ($GLOBALS['browser_layer'])
-			$res .= http_script("
-				triangle = findObj('triangle' + $couche_a_redresser);
-				if (triangle) triangle.src = '" . _DIR_IMG_PACK . "deplierbas$spip_lang_rtl.gif';");
-	} else $res = debut_block_invisible("lesmots");
-
-	if ($nombre_mots_associes > 3) {
-		$res .= "<div align='right' class='arial1'>"
-		  . ajax_action_auteur('editer_mot', "$id_objet,-1,$table,$table_id,$objet", $url_base, "$table_id=$id_objet", array(_T('info_retirer_mots'),''),"&id_objet=$id_objet&objet=$objet")
-		. "</div><br />\n";
-	}
-
-	$result_groupes = spip_query("SELECT id_groupe,unseul,obligatoire,titre, ".creer_objet_multi ("titre", $spip_lang)." FROM spip_groupes_mots WHERE $table = 'oui' AND ".substr($connect_statut,1)." = 'oui' AND (unseul != 'oui'  OR (unseul = 'oui' AND id_groupe NOT IN ($cond_id_groupes_vus))) ORDER BY multi");
-
-	// Afficher un menu par groupe de mots
-	$ajouter ='';
-	while ($row = spip_fetch_array($result_groupes)) {
-		if ($menu = menu_mots($row, $id_groupes_vus, $les_mots)) {
-			$menu = ajax_action_auteur('editer_mot',
-				"$id_objet,,$table,$table_id,$objet",
-				$url_base,
-				"$table_id=$id_objet",
-				$menu,
-				"&id_objet=$id_objet&objet=$objet&select_groupe="
-					.$row['id_groupe']
-			);
-			$ajouter .= "<div>$menu</div>\n";
-		}
-	}
-	if ($ajouter) {
-		$message = "<span class='verdana1'><b>"._T('titre_ajouter_mot_cle')."</b></span>\n";
-		$res .= "<div style='float:$spip_lang_right; width:280px;position:relative;display:inline;'>"
-			. $ajouter
-			."</div>\n" ;
-	}
-
-	if (acces_mots()) {
-		$titre = _request('cherche_mot')
-			? "&titre=".rawurlencode(_request('cherche_mot')) : '';
-		$bouton_ajouter = icone_horizontale(_T('icone_creer_mot_cle'), generer_url_ecrire("mots_edit","new=oui&ajouter_id_article=$id_objet&table=$table&table_id=$table_id$titre&redirect=" . generer_url_retour($url_base, "$table_id=$id_objet")), "mot-cle-24.gif", "creer.gif", false)
-		. "\n";
-	}
-
-	if ($message OR $bouton_ajouter) {
-		$res .= "<div style='width:170px;'>$message
-			<br />$bouton_ajouter</div>\n";
-	}
-
-	return $res . fin_block();
-}
-
-// http://doc.spip.org/@menu_mots
-function menu_mots($row, $id_groupes_vus, $les_mots)
-{
-	$id_groupe = $row['id_groupe'];
-
-	$result = spip_query("SELECT id_mot, type, titre FROM spip_mots WHERE id_groupe =$id_groupe " . ($les_mots ? "AND id_mot NOT IN ($les_mots) " : '') .  "ORDER BY type, titre");
-
-	$n = spip_num_rows($result);
-	if (!$n) return '';
-
-	$titre = textebrut(typo($row['titre']));
-	$titre_groupe = entites_html($titre);
-	$unseul = $row['unseul'] == 'oui';
-	$obligatoire = $row['obligatoire']=='oui' AND !in_array($id_groupe, $id_groupes_vus);
-
-	$res = '';
-	$ancre = "valider_groupe_$id_groupe"; 
-
-	// forcer le recalcul du noeud car on est en Ajax
-	$jscript1 = "findObj_forcer('$ancre').style.visibility='visible';";
-	$jscript2 = "if(!antifocus_mots[$id_groupe]){this.value='';antifocus_mots[$id_groupe]=true;}";
-
-	if ($n > 50) {
-		$jscript = "onfocus=\"$jscript1 $jscript2\"";
-
-		if ($obligatoire)
-			$res .= "<input type='text' name='cherche_mot' class='fondl' style='width: 180px; background-color:#E86519;' value=\"$titre_groupe\" size='20' $jscript>";
-		else if ($unseul)
-			$res .= "<input type='text' name='cherche_mot' class='fondl' style='width: 180px; background-color:#cccccc;' value=\"$titre_groupe\" size='20' $jscript>";
-		else
-			$res .= "<input type='text' name='cherche_mot'  class='fondl' style='width: 180px; ' value=\"$titre_groupe\" size='20' $jscript>";
-
-		$res .= "<input type='hidden' name='select_groupe'  value='$id_groupe' />";
-		$res .= "<span class='visible_au_chargement' id='$ancre'>";
-		$res .= " <input type='submit' value='"._T('bouton_chercher')."' class='fondo' style='font-size:10px'>";
-		$res .= "</span>"; 
-	} else {
-
-		$jscript = "onchange=\"$jscript1\"";
-	  
-		if ($obligatoire)
-			$res .= "<SELECT NAME='nouv_mot' SIZE='1' STYLE='width: 180px; background-color:#E86519;' CLASS='fondl' $jscript>";
-		else if ($unseul)
-			$res .= "<SELECT NAME='nouv_mot' SIZE='1' STYLE='width: 180px; background-color:#cccccc;' CLASS='fondl' $jscript>";
-		else
-			$res .= "<SELECT NAME='nouv_mot' SIZE='1' STYLE='width: 180px; ' CLASS='fondl' $jscript>";
-
-		$res .= "\n<option value='x' style='font-variant: small-caps;'>$titre</option>";
-		while($row = spip_fetch_array($result)) {
-			$res .= "\n<option value='" .$row['id_mot'] .
-				"'>&nbsp;&nbsp;&nbsp;" .
-				textebrut(typo($row['titre'])) .
-				"</option>";
-		}
-		$res .= "</SELECT>";
-		$res .= "<span class='visible_au_chargement' id='$ancre'>";
-		$res .= "\n&nbsp;<input type='submit' value='"._T('bouton_choisir')."' CLASS='fondo' />";
-		$res .= "</span>";
-	}
-
-	return $res;
-}
-
 ?>