diff --git a/ecrire/exec/documenter.php b/ecrire/exec/documenter.php
index ff381cd7c3915b8ad0b7484db086bde60f35dd8a..2a1ff9b2b5b8f0775ad2c76e550cf8e6100ea2e2 100644
--- a/ecrire/exec/documenter.php
+++ b/ecrire/exec/documenter.php
@@ -18,6 +18,7 @@ include_spip('inc/texte');
 function exec_documenter_dist()
 {
 	$type = _request("type");
+	$script = _request("script"); // generalisation a tester
 	$s = _request("s");
 	$id = intval(_request(($type == 'article') ? 'id_article' : 'id_rubrique'));
 
@@ -41,7 +42,8 @@ function exec_documenter_dist()
 		minipres(_T('info_acces_interdit'));
 	}
 
-	$f = charger_fonction('documenter', 'inc');
-	return $f($id, $type, $album, 'ajax');
+	$documenter = charger_fonction('documenter', 'inc');
+	return $documenter($id, $type, $album, 'ajax', '', $script);
+
 }
 ?>
diff --git a/ecrire/inc/actions.php b/ecrire/inc/actions.php
index a6b4ec4b22c4e5b3975790d7b2bd7e717d353534..c1f58acaed598c25e22c0b2b052ab1963e20a50e 100644
--- a/ecrire/inc/actions.php
+++ b/ecrire/inc/actions.php
@@ -200,7 +200,7 @@ function declencheur_action_ajax($request, $noeud, $fct_ajax)
 	. ")'";
 }
 
-function greffe_action_ajax($idom, $corps, $atts='')
+function greffe_action_ajax($idom, $corps)
 {
 	return _request('var_ajaxcharset')
 	? $corps
diff --git a/ecrire/inc/documenter.php b/ecrire/inc/documenter.php
index b3e3878e775fc94e4d82259f622b03605769d5ff..be4bcf40beb461199788f9c515ac733f1c8609ba 100644
--- a/ecrire/inc/documenter.php
+++ b/ecrire/inc/documenter.php
@@ -97,7 +97,7 @@ function inc_documenter_dist(
 
 		if (count($documents) > 3) {
 			$head .= "<div style='background-color: #dddddd; padding: 4px; color: black; text-align: right' class='arial1'>"
-			  . ajax_action_auteur('documenter', "$s$doc/$type", $GLOBALS['exec'], "id_$type=$doc&s=$s&type=$type",array(_L('Supprimer_tout')))
+			. ajax_action_auteur('documenter', "$s$doc/$type", $script, "id_$type=$doc&s=$s&type=$type",array(_L('Supprimer_tout')))
 			. "</div>\n";
 		}
 	} else $head = '';
@@ -107,5 +107,5 @@ function inc_documenter_dist(
 	. $res
 	. "</table>";	  
 
-	return greffe_action_ajax("documenter-$s$doc", $res);
+	return greffe_action_ajax("documenter-$s$doc", $res, $flag==='ajax');
 }
diff --git a/ecrire/inc/joindre.php b/ecrire/inc/joindre.php
index a9f63d1cf401bf6e144795a31a2205f3bf8d435b..85bdbcfdcdd2e2de8003571414ee6bba26debcdb 100644
--- a/ecrire/inc/joindre.php
+++ b/ecrire/inc/joindre.php
@@ -72,13 +72,11 @@ function inc_joindre_dist($script, $args, $id=0, $intitule='', $mode='', $type='
 	else
 		$res = $res . $milieu;
 
-	$f = generer_action_auteur('joindre',
+	return generer_action_auteur('joindre',
 		(intval($id) .'/' .intval($id_document) . "/$mode/$type"),
 		generer_url_ecrire($script, $args),
 		"$debut$intitule$res$dir_ftp$distant$fin",
 		" method='post' enctype='multipart/form-data' style='border: 0px; margin: 0px;'");
-
-	return $f;
 }
 
 
diff --git a/ecrire/inc/legender.php b/ecrire/inc/legender.php
index a753cff09f5e4ef1594825c8063771417a84b7b7..92de13a3c509d39de81275c78004d4dba78cb453 100644
--- a/ecrire/inc/legender.php
+++ b/ecrire/inc/legender.php
@@ -110,11 +110,16 @@ function inc_legender_dist($id_document, $document, $script, $type, $id, $ancre)
 	. "\n\n\n\n"
 	. icone_horizontale($texte, $action, $supp, "supprimer.gif", false);
 
-	$corps = block_parfois_visible("legender-aff-$id_document", $entete, $corps, "text-align:center;", $flag);
 
-	$atts = " class='verdana1' style='color: " . $GLOBALS['couleur_foncee'] . "; border: 1px solid ". $GLOBALS['couleur_foncee'] .";  padding: 5px; margin: 3px; background-color: white;'";
+	$corps = "<div class='verdana1' style='color: "
+	. $GLOBALS['couleur_foncee']
+	. "; border: 1px solid "
+	. $GLOBALS['couleur_foncee']
+	. ";  padding: 5px; margin: 3px; background-color: white;'>"
+	. block_parfois_visible("legender-aff-$id_document", $entete, $corps, "text-align:center;", $flag)
+	. "</div>";
 
-	return greffe_action_ajax("legender-$id_document", $corps, $atts);
+	return greffe_action_ajax("legender-$id_document", $corps);
 }