diff --git a/ecrire/inc_auxbase.php3 b/ecrire/inc_auxbase.php3
index 3b4ea0a05c78e17eb9b5a7781891438256685597..3f5219442ed97bdb46bd30b5ff5f75358c4ec986 100644
--- a/ecrire/inc_auxbase.php3
+++ b/ecrire/inc_auxbase.php3
@@ -345,7 +345,9 @@ $spip_ortho_dico = array(
 	"id_auteur" => "BIGINT UNSIGNED NOT NULL",
 	"maj" => "TIMESTAMP");
 $spip_ortho_dico_key = array(
-	"PRIMARY KEY" => "lang, mot",);
+	"PRIMARY KEY" => "lang, mot");
+
+
 
 
 global $tables_auxiliaires;
diff --git a/ecrire/inc_layer.php3 b/ecrire/inc_layer.php3
index c29c75faf6d524fe9ee0639e5f45cb12de910afb..4d8df1a5c357800df145f4092a8504bce695b91f 100644
--- a/ecrire/inc_layer.php3
+++ b/ecrire/inc_layer.php3
@@ -17,6 +17,8 @@ define("_INC_LAYER", "1");
 
 include_ecrire("inc_filtres.php3"); # pour http_script (normalement déjà fait)
 
+
+
 function debut_block_visible($nom_block){
 	global $numero_block, $compteur_block, $browser_layer;
 	if (!$browser_layer) return '';
diff --git a/ecrire/inc_majbase.php3 b/ecrire/inc_majbase.php3
index 2e35d28e5e931b6676abd0a45d7c16058d0f23f9..72fe2e459910aa9357a41d83fbaaffb9873414f6 100644
--- a/ecrire/inc_majbase.php3
+++ b/ecrire/inc_majbase.php3
@@ -1045,6 +1045,10 @@ function maj_base() {
 		spip_query("ALTER TABLE spip_mots CHANGE type type TEXT NOT NULL");
 		maj_version(1.822);
 	}
+	// ajouter une table de fonctions pour ajax
+	if ($version_installee < 1.825) {
+		maj_version(1.825);
+	}
 
 	return true;
 }
diff --git a/ecrire/inc_presentation.php3 b/ecrire/inc_presentation.php3
index 5b2f0b7018c5a89da40ba42f9816366ba1f55101..ac87ee3149e5cd8e19260ddbe43394c83a93d6bc 100644
--- a/ecrire/inc_presentation.php3
+++ b/ecrire/inc_presentation.php3
@@ -483,7 +483,7 @@ function afficher_liste($largeurs, $table, $styles = '') {
 	echo "\n";
 }
 
-function afficher_tranches_requete(&$query, $colspan) {
+function afficher_tranches_requete(&$query, $colspan, $tmp_var=false, $javascript=false) {
 	static $ancre = 0;
 	global $spip_lang_right, $spip_display;
 
@@ -505,7 +505,9 @@ function afficher_tranches_requete(&$query, $colspan) {
 	$texte = "\n";
 
 	if ($num_rows > $nb_aff) {
-		$tmp_var = 't_'.substr(md5($query), 0, 4);
+		if (!$tmp_var) $tmp_var = substr(md5($query), 0, 4);
+		$tmp_var = 't_'. $tmp_var;
+		
 		$deb_aff = intval($GLOBALS[$tmp_var]);
 		$ancre++;
 
@@ -523,9 +525,19 @@ function afficher_tranches_requete(&$query, $colspan) {
 			else {
 				$link = new Link;
 				$link->addVar($tmp_var, strval($deb - 1));
-				$texte .= "<a href=\"".$link->getUrl()."#a$ancre\">$deb</a>";
+				if ($javascript) {
+					$jj = ereg_replace("::deb::", "&$tmp_var=$deb", $javascript);
+					$texte .= "<a onMouseOver=\"this.href='javascript:$jj;'; \" href=\"".$link->getUrl()."#a$ancre\">$deb</a>";
+				}
+				else $texte .= "<a href=\"".$link->getUrl()."#a$ancre\">$deb</a>";
 			}
 		}
+	
+		if ($javascript) {
+			$id_img = "img_".substr($tmp_var, 2, strlen($tmp_var));
+			$texte .= "<img src='img_pack/searching.gif' id='$id_img' style='visibility: hidden; margin-left: 10px; border: 0px; vertical-align: middle;' />";
+		}
+
 		if ($spip_display != 4) {
 			$texte .= "</td>\n";
 			$texte .= "<td class=\"arial2\" style='border-bottom: 1px solid #444444; text-align: $spip_lang_right;' colspan=\"1\" align=\"right\" valign=\"top\">";
@@ -538,14 +550,20 @@ function afficher_tranches_requete(&$query, $colspan) {
 		} else {
 			$link = new Link;
 			$link->addVar($tmp_var, -1);
-			$texte .= "<A HREF=\"".$link->getUrl()."#a$ancre\">"._T('lien_tout_afficher')."</A>";
+				if ($javascript) {
+					$jj = ereg_replace("::deb::", "&$tmp_var=-1", $javascript);
+					$texte .= "<a onMouseOver=\"this.href='javascript:$jj;'; \" href=\"".$link->getUrl()."#a$ancre\">"._T('lien_tout_afficher')."</a>";
+				}
+				else  $texte .= "<A HREF=\"".$link->getUrl()."#a$ancre\">"._T('lien_tout_afficher')."</A>";
 		}
 
+
 		if ($spip_display != 4) $texte .= "</td>\n";
 		if ($spip_display != 4) $texte .= "</tr>\n";
 
 
 		if ($deb_aff != -1) {
+			if ($deb_aff > 0) $deb_aff --;  // Correction de bug: si on affiche "de 1 a 10", alors LIMIT 0,10
 			$query = eregi_replace('LIMIT[[:space:]].*$', '', $query);
 			$query .= " LIMIT $deb_aff, $nb_aff";
 		}
@@ -723,6 +741,7 @@ function afficher_articles($titre_table, $requete, $afficher_visites = false, $a
 	global $spip_lang_left, $spip_lang_right;
 
 
+
 	$activer_messagerie = "oui";
 	$activer_statistiques = lire_meta("activer_statistiques");
 	$afficher_visites = ($afficher_visites AND $connect_statut == "0minirezo" AND $activer_statistiques != "non");
@@ -748,15 +767,52 @@ function afficher_articles($titre_table, $requete, $afficher_visites = false, $a
 	if ($options == "avancees")  $ajout_col = 1;
 	else $ajout_col = 0;
 
-	$tranches = afficher_tranches_requete($requete, $afficher_auteurs ? 4 + $ajout_col : 3 + $ajout_col);
+	
+	$jjscript["function"] = "afficher_articles";
+	$jjscript["titre_table"] = $titre_table;
+	$jjscript["requete"] = $requete;
+	$jjscript["afficher_visites"] = $afficher_visites;
+	$jjscript["afficher_auteurs"] = $afficher_auteurs;
+	$jjscript = addslashes(serialize($jjscript));
+	$hash = "0x".substr(md5($connect_id_auteur.$jjscript), 0, 16);
+
+	$tmp_var = substr(md5($jjscript), 0, 4);
+	
+	
+	// Voir si deja stocke
+	$res_proch = spip_query("SELECT id_ajax_fonc FROM spip_ajax_fonc WHERE hash=$hash AND id_auteur=$connect_id_auteur ORDER BY id_ajax_fonc DESC LIMIT 0,1");
+	if ($row = spip_fetch_array($res_proch)) {
+		$id_ajax_fonc = $row["id_ajax_fonc"];
+	} else {
+		$creer_lien_ajax = true;
+		// Recuperer l'incrementation actuelle d'id_ajax_fonc 
+		// (l'insert ne sera fait qu'apres tranche)
+		$res_proch = spip_query("SELECT id_ajax_fonc FROM spip_ajax_fonc ORDER BY id_ajax_fonc DESC LIMIT 0,1");
+		if ($row = spip_fetch_array($res_proch)) {
+			$id_ajax_fonc = $row["id_ajax_fonc"];
+		} 
+		else $id_ajax_fonc = 0;
+		if (!$GLOBALS["t_$tmp_var"]) $id_ajax_fonc ++;
+	}
+		
+	$javascript = "charger_id_url(\'ajax_page.php?id_ajax_fonc=$id_ajax_fonc::deb::\',\'$tmp_var\')";
+	$tranches = afficher_tranches_requete($requete, $afficher_auteurs ? 4 + $ajout_col : 3 + $ajout_col, $tmp_var, $javascript);
+
 
 	$requete = str_replace("FROM spip_articles AS articles ", "FROM spip_articles AS articles LEFT JOIN spip_petitions AS petitions USING (id_article)", $requete);
 
 	if (strlen($tranches) OR $toujours_afficher) {
 		$result = spip_query($requete);
 
-		// if ($afficher_cadre) debut_cadre_gris_clair("article-24.gif");
 
+		if (!$GLOBALS["t_$tmp_var"]) {
+			if ($creer_lien_ajax) {
+				include_ecrire ("inc_abstract_sql.php3");
+				$id_fonc = spip_abstract_insert("spip_ajax_fonc", "(id_auteur, fonction, variables, hash, date)", "($connect_id_auteur, 'afficher_articles', '$jjscript', $hash, NOW())");
+			}
+			echo "<div id='$tmp_var'>";
+		
+		}
 
 		echo "<div style='height: 12px;'></div>";
 		echo "<div class='liste'>";
@@ -880,6 +936,9 @@ function afficher_articles($titre_table, $requete, $afficher_visites = false, $a
 		//echo "</table>";
 		echo afficher_liste_fin_tableau();
 		echo "</div>";
+		
+		if (!$GLOBALS["t_$tmp_var"]) echo "</div>";
+		
 		//if ($afficher_cadre) fin_cadre_gris_clair();
 
 	}
diff --git a/ecrire/inc_serialbase.php3 b/ecrire/inc_serialbase.php3
index 696234a2fce231ce3cf91f66b434d4ce0118faf9..e6da35e4da194ac21026741368b356489f4f0b47 100644
--- a/ecrire/inc_serialbase.php3
+++ b/ecrire/inc_serialbase.php3
@@ -332,6 +332,20 @@ $spip_signatures_key = array(
 		"KEY idx"		=> "idx",
 		"KEY statut" => "statut");
 
+
+$spip_ajax_fonc = array(
+		"id_ajax_fonc" => "bigint(21) NOT NULL",
+		"id_auteur" => "bigint(21) NOT NULL",
+		"fonction" => "varchar(50) DEFAULT '0' NOT NULL",
+		"variables" => "text NOT NULL",
+		"date"	=> "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
+		"`hash`"	=> "BIGINT UNSIGNED NOT NULL" );
+
+$spip_ajax_fonc_key = array(
+		"PRIMARY KEY"		=> "id_ajax_fonc",
+		"KEY `hash`"	=> "`hash`");
+
+
 global $tables_principales;
 
 /// Attention: mes_fonctions peut avoir deja defini cette variable
@@ -363,5 +377,7 @@ $tables_principales['spip_forum'] =
 	array('field' => &$spip_forum,	'key' => &$spip_forum_key);
 $tables_principales['spip_signatures'] =
 	array('field' => &$spip_signatures, 'key' => &$spip_signatures_key);
+$tables_principales['spip_ajax_fonc'] =
+	array('field' => &$spip_ajax_fonc, 'key' => &$spip_ajax_fonc_key);
 
 ?>
diff --git a/ecrire/inc_version.php3 b/ecrire/inc_version.php3
index d8a9f36f72b0ba36426fcadd6be229ed03713904..cf1e7773e9379cb90e84828786e191fdb42fcd27 100644
--- a/ecrire/inc_version.php3
+++ b/ecrire/inc_version.php3
@@ -412,7 +412,7 @@ define_once('_AUTH_USER_FILE', '.htpasswd');
 // (utilise pour les modifs de la base de donnees)
 
 // version de la base
-$spip_version = 1.822;
+$spip_version = 1.825;
 
 // version de spip
 $spip_version_affichee = "1.8.2 SVN";
diff --git a/ecrire/layer.js b/ecrire/layer.js
index 1f30beca04b2a26b9e01ed45aba0bc850fb4b150..6c8ef4eb675ffd2a2d2df0a8ce01a9e86af0a9f6 100644
--- a/ecrire/layer.js
+++ b/ecrire/layer.js
@@ -88,3 +88,42 @@ function acceder_couche(couches, n, dir, icone, texte, sens) {
 	    dir + icone + '" alt="' + texte + '" title="' + texte +
 	    '" width="10" height="10" border="0"></a>');
 }
+
+
+//
+// Cette fonction charge du contenu - dynamiquement - dans un 
+
+
+var url_chargee = new Array();
+
+function charger_id_url(myUrl,myField) 
+{
+	var Field = findObj(myField); // selects the given element
+	if (!Field) return;
+	
+	document.getElementById('img_'+myField).style.visibility = "visible";
+	
+	if (url_chargee['mem_'+myUrl]) {
+		Field.innerHTML = url_chargee['mem_'+myUrl];
+	} else {
+        if(window.XMLHttpRequest) {
+                xmlhttp = new XMLHttpRequest(); 
+        } else if(window.ActiveXObject) {
+                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+        } else {
+                return false;
+        }
+        xmlhttp.open("GET", myUrl, true);
+
+        xmlhttp.onreadystatechange = function() {
+                if (xmlhttp.readyState == 4) { 
+                        Field.innerHTML = xmlhttp.responseText; // puts the result into the element
+						url_chargee['mem_'+myUrl] = Field.innerHTML;
+						document.getElementById('img_'+myField).style.visibility = "hidden";
+               }
+        }
+        xmlhttp.send(null); 
+    }
+}
+
+