diff --git a/ecrire/inc/commencer_page.php b/ecrire/inc/commencer_page.php
index 910782f660c05a610410c2e956939f95d962bb8d..542d746406d3840615f5345618a62440200682bf 100644
--- a/ecrire/inc/commencer_page.php
+++ b/ecrire/inc/commencer_page.php
@@ -58,19 +58,14 @@ function init_head($titre='', $dummy=0, $minipres=false) {
 		. "<meta http-equiv='Content-Type' content='text/html"
 		. (($c = $GLOBALS['meta']['charset']) ?
 			"; charset=$c" : '')
-		. "' />\n"
-		. envoi_link($nom_site_spip,$minipres);
-
-	$head .= "
-	<script type='text/javascript'><!--
-	jQuery(document).ready(function(){
-	" .	repercuter_gadgets() . '
-	});
-	var style = document.createElement("style");
-	style.innerHTML = ".jsnone {display:none;}";
-	document.getElementsByTagName("head")[0].appendChild(style);
-	// --></script>
-	';
+		. "' />\n";
+
+	$head .= "<script type='text/javascript'>/*<![CDATA[*/\n"
+	."var url_menu_rubrique='./?exec=menu_rubriques\\x26date=" .  $GLOBALS['meta']['date_calcul_rubriques']."';\n"
+	."(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement);\n"
+	."/*]]>*/</script>\n";
+	$head .= envoi_link($nom_site_spip,$minipres);
+
 	return pipeline('header_prive', $head);
 }
 
diff --git a/ecrire/inc/lang.php b/ecrire/inc/lang.php
index bb2c12018234834e99d4c1b35edf9628f94e5118..f74490c8763eb00a5cb52de33a603387958048b3 100644
--- a/ecrire/inc/lang.php
+++ b/ecrire/inc/lang.php
@@ -349,11 +349,9 @@ function init_langues() {
 // http://doc.spip.org/@html_lang_attributes
 function html_lang_attributes()
 {
-	return  "<html xmlns='http://www.w3.org/1999/xhtml' lang='"
-	. $GLOBALS['spip_lang']
-	. "' dir='"
-	. ($GLOBALS['spip_lang_rtl'] ? 'rtl' : 'ltr')
-	  . "'>\n" ;
+	$lang = $GLOBALS['spip_lang'];
+	$dir = ($GLOBALS['spip_lang_rtl'] ? 'rtl' : 'ltr');
+	return  "<html class='$dir $lang no-js' xmlns='http://www.w3.org/1999/xhtml' lang='$lang' dir='$dir'>\n" ;
 }
 init_langues();
 utiliser_langue_site();
diff --git a/ecrire/inc/pipelines_ecrire.php b/ecrire/inc/pipelines_ecrire.php
index 8e7fe77903af054ed32df581c945fe41b5d8420b..6df0d09b40f4d144a3639706764b58deaa51f2ae 100644
--- a/ecrire/inc/pipelines_ecrire.php
+++ b/ecrire/inc/pipelines_ecrire.php
@@ -28,7 +28,13 @@ function f_jQuery_prive ($texte) {
 	))) as $script)
 		if ($script = find_in_path($script))
 			$x .= "\n<script src=\"$script\" type=\"text/javascript\"></script>\n";
-	$texte = $x.$texte;
+	// inserer avant le premier script externe ou a la fin
+	if (preg_match(",<script[^><]*src=,",$texte,$match)
+	  AND $p = strpos($texte,$match[0])){
+	  $texte = substr_replace($texte,$x,$p,0);
+	}
+	else
+		$texte .= $x;
 	return $texte;
 }
 
diff --git a/ecrire/inc/presentation_mini.php b/ecrire/inc/presentation_mini.php
index 4bb91c81aaf1a82028a159c0ede945f870a47e9d..6fd772ff89511bf202185f8fed45b00791e987e8 100644
--- a/ecrire/inc/presentation_mini.php
+++ b/ecrire/inc/presentation_mini.php
@@ -87,10 +87,6 @@ function envoi_link($nom_site_spip, $minipres=false) {
 	// CSS espace prive : la vraie
 	. '<link rel="stylesheet" type="text/css" href="'
 	. generer_url_public('style_prive', $paramcss) .'" />' . "\n"
-	. "<!--[if lt IE 8]>\n"
-	. '<link rel="stylesheet" type="text/css" href="'
-	. generer_url_public('style_prive_ie', $paramcss) .'" />' . "\n"
-	. "<![endif]-->\n"
 
 	// CSS optionelle minipres
 	. ($minipres?'<link rel="stylesheet" type="text/css" href="'
@@ -103,9 +99,7 @@ function envoi_link($nom_site_spip, $minipres=false) {
 	. url_absolue($favicon)
 	. "\" type='image/x-icon' />\n";
 	
-	$js = debut_javascript();
-
-	if ($spip_display == 4) return $res . $js;
+	list($inlinejs,$js) = debut_javascript();
 
 	$nom = entites_html($nom_site_spip);
 
@@ -121,7 +115,7 @@ function envoi_link($nom_site_spip, $minipres=false) {
 			. " ("._T("info_breves_03")
 			. ")\" href='" . generer_url_public('backend-breves') . "' />\n";
 
-	return $res . $js;
+	return $inlinejs . $res . $js;
 }
 
 // http://doc.spip.org/@debut_javascript
@@ -148,13 +142,11 @@ function debut_javascript()
 
 	if (!defined('_LARGEUR_ICONES_BANDEAU'))
 		include_spip('inc/bandeau');
-	return
-	// envoi le fichier JS de config si browser ok.
-		$GLOBALS['browser_layer'] .
-	 	http_script(
-			((isset($_COOKIE['spip_accepte_ajax']) && $_COOKIE['spip_accepte_ajax'] >= 1)
+	return array(
+	 	"<script type='text/javascript'>/*<![CDATA[*/"
+			.((isset($_COOKIE['spip_accepte_ajax']) && $_COOKIE['spip_accepte_ajax'] >= 1)
 			? ''
-			: "jQuery.ajax({'url':'$testeur'});") .
+			: "\nfunction test_accepte_ajax(){jQuery.ajax({'url':'$testeur'});}") .
 			(_OUTILS_DEVELOPPEURS ?"var _OUTILS_DEVELOPPEURS=true;":"") .
 			"\nvar ajax_image_searching = \n'<img src=\"".url_absolue(chemin_image("searching.gif"))."\" alt=\"\" />';" .
 			"\nvar stat = " . (($GLOBALS['meta']["activer_statistiques"] != 'non') ? 1 : 0) .
@@ -167,11 +159,12 @@ function debut_javascript()
 			   ($browser_version >= 6))) ? 1 : 0) .
 			"\nvar confirm_changer_statut = '" .
 			unicode_to_javascript(addslashes(html2unicode(_T("confirm_changer_statut")))) .
-			"';\n") .
-		//plugin needed to fix the select showing through the submenus o IE6
-    (($browser_name == "MSIE" && $browser_version <= 6) ? http_script('', 'bgiframe.js'):'' ) .
-    http_script('', 'presentation.js') . 
-    http_script('', 'gadgets.js');
+			"';\n/*]]>*/</script>\n",
+	// envoi le fichier JS de config si browser ok.
+		$GLOBALS['browser_layer'] .
+    http_script('', 'presentation.js') .
+    http_script('', 'gadgets.js')
+		);
 }
 
 //
diff --git a/ecrire/inc/utils.php b/ecrire/inc/utils.php
index c901a4de5cef10299bd0b496fc2bc6702eac60ac..52b5c350f526e341db267d69c30349f82b34ac2f 100644
--- a/ecrire/inc/utils.php
+++ b/ecrire/inc/utils.php
@@ -605,9 +605,9 @@ function http_script($script, $src='', $noscript='') {
 	}
 	else $src = '';
 	if ($script)
-		$script = ("<!--\n" .
+		$script = ("/*<![CDATA[*/\n" .
 		preg_replace(',</([^>]*)>,','<\/\1>', $script) .
-		"\n//-->\n");
+		"/*]]>*/");
 	if ($noscript)
 		$noscript = "<noscript>\n\t$noscript\n</noscript>\n";
 
diff --git a/prive/javascript/gadgets.js b/prive/javascript/gadgets.js
index c95d9e1e16ebb345849e0aa1d13f1d80b1de6a6e..b5271424ed1279d1590c0103f58d044f55e4f98c 100644
--- a/prive/javascript/gadgets.js
+++ b/prive/javascript/gadgets.js
@@ -1,8 +1,8 @@
-function init_gadgets(url_toutsite,url_navrapide,url_agenda,html_messagerie){
+function init_gadgets(){
 	jQuery('#boutonbandeautoutsite').one('mouseover',function(){
 		jQuery(this).siblings('ul').animeajax();
 		jQuery.ajax({
-						url: url_toutsite,
+						url: url_menu_rubrique,
 						success: function(c){
 							jQuery('#boutonbandeautoutsite').siblings('ul').remove();
 							jQuery('#boutonbandeautoutsite')
@@ -17,6 +17,7 @@ function focus_zone(selecteur){
 	return false;
 }
 jQuery(document).ready(function(){
+	init_gadgets();
 	var is_open = 0;
 	jQuery.fn.menuItemOpen = function(){
 		jQuery(this)
@@ -103,4 +104,6 @@ jQuery(document).ready(function(){
 		.blur(function(){
 			jQuery('#bando_liens_rapides').removeClass('actif');
 		});
+	if (typeof window.test_accepte_ajax != "undefined")
+		test_accepte_ajax();
 });
diff --git a/prive/style_prive.html b/prive/style_prive.html
index ca1a05760ae60f53df32f3ba67651700c728ac39..bfb0a5367ceac6436137792371d7ff15fafb7706 100644
--- a/prive/style_prive.html
+++ b/prive/style_prive.html
@@ -37,8 +37,10 @@ body { font-size:0.625em; font-family: Verdana, Geneva, Sans, sans-serif; }
 .nettoyeur { clear: both; height: 0; margin: 0; padding: 0; border: 0; line-height: 1px; font-size: 1px; }
 
 /* Non visible a l'ecran */
-.invisible { position: absolute; top: -3000em; height: 1%; }
-.none { display: none; }
+.none,.js .none-js,.no-js .none-nojs { display: none; }
+.hidden,.js .hidden-js,.no-js .hidden-nojs  {visibility:hidden;}
+.invisible, /* compat */
+.over,.js .over-js,.no-js .over-nojs { position: absolute; left: -3000em; height: 1%; }
 
 /* ajax */
 .image_loading {float:#GET{right};}
@@ -76,6 +78,15 @@ body.edition .large #extra,
 .breves_edit .large #extra,
 .rubriques_edit .large #extra {width:140px;}
 
+/*fix all layout problems of IE6 and IE7*/
+.lte7 .cadre,
+.lte7 .fiche_objet, /*title not visible*/
+.lte7 .ajax-action, /*containers of expandible boxes go mad*/
+.lte7 .tabs-container, /*containers of expandible boxes go mad*/
+.lte7 #portfolio,
+.lte7 #documents {zoom:1}
+
+
 /* style par defaut sur les tables. selecteur generique pour avoir une faible priorite */
 table {
 	border-collapse: collapse; /* equivalent a cellspacing=0 */