diff --git a/ecrire/calendrier.php3 b/ecrire/calendrier.php3
index 56c759ea2f5d597b8135e3266dea9376e4c59a06..2b5c482f9d3b4d463fdfbcbdb86fec918ea660b4 100644
--- a/ecrire/calendrier.php3
+++ b/ecrire/calendrier.php3
@@ -10,7 +10,6 @@
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
 \***************************************************************************/
 
-
   // ce script peut etre recopie a la racine pour obtenir le calendrier
   // a partir de l'espace public. 
   // Evidemment les messages internes a la redaction seront absents.
@@ -26,22 +25,15 @@ if (!_DIR_RESTREINT)
 	include_ecrire("inc_layer.php3");
  }
 
-$today=getdate(time());
-$jour_today = $today["mday"];
-$mois_today = $today["mon"];
-$annee_today = $today["year"];
-
 // sans arguments => mois courant
 if (!$mois){
-  $jour=$jour_today;
-  $mois=$mois_today;
-  $annee=$annee_today;
- } else {if (!isset($jour)) $jour = 1;}
+  $today=getdate(time());
+  $jour = $today["mday"];
+  $mois = $today["mon"];
+  $annee = $today["year"];
+ } else {if (!isset($jour)) {$jour = 1; $type= 'mois';}}
 
 $date = date("Y-m-d", mktime(0,0,0,$mois, $jour, $annee));
-$jour = journum($date);
-$mois = mois($date);
-$annee = annee($date);
 
 if (!isset($type)) $type = 'mois';
 
@@ -51,21 +43,15 @@ if ($type == 'semaine') {
 	$afficher_bandeau_calendrier_semaine = true;
 
 	$titre = _T('titre_page_calendrier',
-		    array('nom_mois' => nom_mois($date), 'annee' => $annee));
+		    array('nom_mois' => nom_mois($date), 'annee' => annee($date)));
 	  }
 elseif ($type == 'jour') {
-	$titre = nom_jour("$annee-$mois-$jour")." ".
-	  affdate_jourcourt("$annee-$mois-$jour");
-	$jour = $jour_today;
-	$mois = $mois_today;
-	$annee = $annee_today;
+	$titre = nom_jour($date)." ". affdate_jourcourt($date);
  }
  else {
 	$type = 'mois';
-	$jour = '01';
 	$titre = _T('titre_page_calendrier',
-		    array('nom_mois' => nom_mois($annee . '-' . sprintf("%02d", $mois) . '-01'), 
-			  'annee' => $annee));
+		    array('nom_mois' => nom_mois($date), 'annee' => annee($date)));
 	  }
 
 if (!_DIR_RESTREINT) 
@@ -73,8 +59,14 @@ if (!_DIR_RESTREINT)
  else debut_html($titre);
 
 $f = 'http_calendrier_init_' . $type;
-echo $f($jour,$mois,$annee, $date, $GLOBALS['PHP_SELF']);
+echo $f($date, $echelle, $partie_cal, $GLOBALS['PHP_SELF']);
 
 if (!_DIR_RESTREINT) fin_page(); else 	echo "</body></html>\n";
 
+// partie_cal est utilisee dans:
+// calendrier_navication navi_jour navi_sem 
+// calendrier_mois   calendrier_jour
+
+
+// calendrier_suite_heures
 ?>
diff --git a/ecrire/inc_calendrier.php b/ecrire/inc_calendrier.php
index a98464ef5fa505f0b59f3750c7caa3d2024f87eb..239c1952ef127ffc2fb738b25b633154d8480b74 100644
--- a/ecrire/inc_calendrier.php
+++ b/ecrire/inc_calendrier.php
@@ -143,7 +143,7 @@ function http_calendrier_ics($evenements, $amj = "")
 
 # affiche un mois en grand, avec des tableau de clics vers d'autres mois
 
-function http_calendrier_init_mois($premier_jour, $mois, $annee, $date, $script)
+function http_calendrier_init_mois($date, $echelle, $partie_cal, $script)
 {
 	global $spip_lang_left, $largeur_table, $largeur_gauche, $spip_ecran;
 
@@ -155,11 +155,11 @@ function http_calendrier_init_mois($premier_jour, $mois, $annee, $date, $script)
 		$largeur_table = 730;
 	}
 
-/*	$fclic = ((lire_meta("activer_messagerie") == "oui") AND 
-		($GLOBALS["connect_activer_messagerie"] != "non"))?
-		'http_calendrier_clics' : 
-		'http_calendrier_sans_clics';*/
 	$fclic = 'http_calendrier_clics';
+	$premier_jour = '01';
+	$mois = mois($date);
+	$annee = annee($date);
+
 	$dernier_jour = 31;
 	while (!(checkdate($mois,$dernier_jour,$annee))) $dernier_jour--;
 	$today=getdate(time());
@@ -182,8 +182,7 @@ function http_calendrier_init_mois($premier_jour, $mois, $annee, $date, $script)
 	$total = "<div>&nbsp;</div>" .
 		"<table cellpadding=0 cellspacing=0 border=0 width='$largeur_table'>" .
 		"\n<tr><td width='$largeur_table' valign='top'>" .
-		http_calendrier_mois($mois, $annee, $premier_jour, $dernier_jour, 
-				     $GLOBALS['echelle'], $messages, $fclic);
+	  http_calendrier_mois($mois, $annee, $premier_jour, $dernier_jour, $partie_cal, $echelle, $messages, $fclic);
 		"</td></tr>\n</table>";
 
 	# messages sans date ?
@@ -214,7 +213,6 @@ function http_calendrier_aide_mess()
     "</font></td></tr>\n</table>";
  }
 
-
 function http_calendrier_retire_args($script, $args)
 {
 	foreach($args as $arg) {
@@ -231,7 +229,7 @@ function http_calendrier_retire_args($script, $args)
 # 2 fleches appelant le $script sur les periodes $pred/$suiv avec une $ancre
 # et au center le $nom du calendrier
 
-function http_calendrier_navigation($jour, $mois, $annee, $echelle, $nom,
+function http_calendrier_navigation($jour, $mois, $annee, $partie_cal, $echelle, $nom,
 			    $script, $args_pred, $args_suiv, $type, $ancre)
 {
 	global $spip_lang_right, $spip_lang_left;
@@ -245,13 +243,13 @@ function http_calendrier_navigation($jour, $mois, $annee, $echelle, $nom,
   	$retour = "<div class='navigation-calendrier'>";
 
    	if ($type != "mois") {
-		if ($GLOBALS['partie_cal'] == "tout") $img_att = " class='navigation-bouton-desactive'";
+		if ($partie_cal == "tout") $img_att = " class='navigation-bouton-desactive'";
 		else $img_att = "";
 		$retour .= "<span$img_att>"
 		  .http_href_img(($script . "type=$type&set_partie_cal=tout&$args"),
 				 "heures-tout.png", "width='13' height='13' class='format_png'",  _T('cal_jour_entier')) . "</span>";
 
-		if ($GLOBALS['partie_cal'] == "matin") $img_att = " class='navigation-bouton-desactive'";
+		if ($partie_cal == "matin") $img_att = " class='navigation-bouton-desactive'";
 		else $img_att = "";
 		$retour .= "<span$img_att>"
 		  .http_href_img(($script . "type=$type&set_partie_cal=matin&$args"),
@@ -260,7 +258,7 @@ function http_calendrier_navigation($jour, $mois, $annee, $echelle, $nom,
 				 _T('cal_matin'))
 		  . "</span>";
 
-		if ($GLOBALS['partie_cal'] == "soir") $img_att = " class='navigation-bouton-desactive'";
+		if ($partie_cal == "soir") $img_att = " class='navigation-bouton-desactive'";
 		else $img_att = "";
 		$retour .= "<span$img_att>"
 		  .http_href_img(($script . "type=$type&set_partie_cal=soir&$args"),
@@ -385,7 +383,7 @@ style='position: absolute; padding: 5px; background-color: $couleur_claire; marg
  
 # affichage du bandeau d'un calendrier d'une journee
 
-function http_calendrier_navigation_jour($jour,$mois,$annee, $echelle, $script, $nav)
+function http_calendrier_navigation_jour($jour,$mois,$annee, $partie_cal, $echelle, $script, $nav)
 {
   $today=getdate(time());
   $jour_today = $today["mday"];
@@ -393,7 +391,7 @@ function http_calendrier_navigation_jour($jour,$mois,$annee, $echelle, $script,
   $annee_today = $today["year"];
 //  return "<table width='100%'>" .
    return
-     http_calendrier_navigation($jour, $mois, $annee, $echelle,
+     http_calendrier_navigation($jour, $mois, $annee, $partie_cal, $echelle,
 				(nom_jour("$annee-$mois-$jour") . " " .
 				 affdate_jourcourt("$annee-$mois-$jour")),
 				$script,
@@ -406,7 +404,7 @@ function http_calendrier_navigation_jour($jour,$mois,$annee, $echelle, $script,
 
 # affichage du bandeau d'un calendrier d'une semaine
 
-function http_calendrier_navigation_semaine($jour_today,$mois_today,$annee_today, $echelle, $jour_semaine, $script, $nav)
+function http_calendrier_navigation_semaine($jour_today,$mois_today,$annee_today, $partie_cal, $echelle, $jour_semaine, $script, $nav)
 {
    $debut = date("Y-m-d",mktime (1,1,1,$mois_today, $jour_today-$jour_semaine+1, $annee_today));
   $fin = date("Y-m-d",mktime (1,1,1,$mois_today, $jour_today-$jour_semaine+7, $annee_today));
@@ -415,6 +413,7 @@ function http_calendrier_navigation_semaine($jour_today,$mois_today,$annee_today
     http_calendrier_navigation($jour_today,
 			       $mois_today,
 			       $annee_today,
+			       $partie_cal, 
 			       $echelle,
 		     ((annee($debut) != annee($fin)) ?
 		      (affdate($debut)." -<br />".affdate($fin)) :
@@ -434,7 +433,7 @@ function http_calendrier_navigation_semaine($jour_today,$mois_today,$annee_today
 # et on place les boutons de navigations vers les autres mois et connexe;
 # sinon on considere que c'est un planning ferme et il n'y a pas de navigation
 
-function http_calendrier_mois($mois, $annee, $premier_jour, $dernier_jour, $echelle, $evenements, $fclic)
+function http_calendrier_mois($mois, $annee, $premier_jour, $dernier_jour, $partie_cal, $echelle, $evenements, $fclic)
 {
   global $couleur_claire, $couleur_foncee;
 
@@ -467,6 +466,7 @@ function http_calendrier_mois($mois, $annee, $premier_jour, $dernier_jour, $eche
       $nav = http_calendrier_navigation($j,
 					$mois,
 					$annee,
+					$partie_cal,
 					$echelle,
 					$periode,
 					$script,
@@ -633,13 +633,11 @@ function http_calendrier_clics($annee, $mois, $jour, $clic)
 # dispose les evenements d'une semaine
 
 function http_calendrier_suite_heures($jour_today,$mois_today,$annee_today,
-	$articles, $breves, $evenements, 
+				      $articles, $breves, $evenements, $partie_cal, $echelle,
 	$script, $nav)
 {
-  global $couleur_claire, $couleur_foncee, $spip_ecran, $spip_lang_left,$partie_cal;
+  global $couleur_claire, $couleur_foncee, $spip_ecran, $spip_lang_left;
 
-  $echelle = $GLOBALS['echelle'];
-	
 	if ($partie_cal == "soir") {
 		$debut = 12;
 		$fin = 23;
@@ -720,7 +718,7 @@ function http_calendrier_suite_heures($jour_today,$mois_today,$annee_today,
 	}
 	return 
 	"<table border='0' cellspacing='0' cellpadding='0' width='100%'>" .
-	http_calendrier_navigation_semaine($jour_today,$mois_today,$annee_today,
+	  http_calendrier_navigation_semaine($jour_today,$mois_today,$annee_today,  $partie_cal,
 		$echelle,
 		$jour_semaine,
 		$script,
@@ -1099,12 +1097,16 @@ function http_calendrier_jour_ics($debut, $fin, $largeur, $detcolor, $echelle, $
 }
 
 
-function http_calendrier_init_jour($jour_today,$mois_today,$annee_today, $date, $script){
-
+function http_calendrier_init_jour($date, $echelle,  $partie_cal, $script){
 	global $largeur_table, $largeur_gauche, $spip_ecran;
 	$jour = journum($date);
 	$mois = mois($date);
 	$annee = annee($date);
+	$today=getdate(time());
+	$jour_today = $today["mday"];
+	$mois_today = $today["mon"];
+	$annee_today = $today["year"];
+
 	if ($spip_ecran == "large") {
 		$largeur_table = 974;
 		$largeur_gauche = 200;
@@ -1120,21 +1122,21 @@ function http_calendrier_init_jour($jour_today,$mois_today,$annee_today, $date,
 	if ($spip_ecran == "large") {
 		$retour .= "<td width='$largeur_gauche' class='verdana1' valign='top'>" .
 			"<div style='height: 29px;'>&nbsp;</div>".
-			http_calendrier_jour($jour-1,$mois,$annee, "col") .
+		  http_calendrier_jour($jour-1,$mois,$annee, "col", $partie_cal, $echelle, 0, $script) .
 			"</td>\n<td width='20'>&nbsp;</td>\n";
 	}
 	$retour .= "\n<td width='$largeur_centre' valign='top'>"  .
 		"<div>" .
-		http_calendrier_navigation_jour($jour,$mois,$annee, $GLOBALS['echelle'], $script, '') .
+	  http_calendrier_navigation_jour($jour,$mois,$annee, $partie_cal, $echelle, $script, '') .
 		"</div>".
-		http_calendrier_jour($jour,$mois,$annee, "large") .
+	  http_calendrier_jour($jour,$mois,$annee, "large", $partie_cal, $echelle, 0, $script) .
 		'</td>';
 		
 		# afficher en reduction le tableau du jour suivant
 	$retour .= "\n<td width='20'>&nbsp;</td>" .
 			"\n<td width='$largeur_gauche' class='verdana1' valign='top'>" .
 			"<div style='height: 29px;'>&nbsp;</div>".
-			http_calendrier_jour($jour+1,$mois,$annee, "col") .
+	  http_calendrier_jour($jour+1,$mois,$annee, "col", $partie_cal, $echelle, 0, $script) .
 			'</td>';
 			
 	$retour .= '</tr></table>';
@@ -1142,9 +1144,9 @@ function http_calendrier_init_jour($jour_today,$mois_today,$annee_today, $date,
 	return $retour;
 }
 
-function http_calendrier_init_semaine($jour_today,$mois_today,$annee_today,$date, $script)
+function http_calendrier_init_semaine($date, $echelle, $partie_cal, $script)
 {
-	global $spip_ecran, $spip_lang_left, $couleur_claire;	
+  global $spip_ecran, $spip_lang_left, $couleur_claire;	
 	
 	if ($spip_ecran == "large") {
 		$largeur_table = 974;
@@ -1155,10 +1157,11 @@ function http_calendrier_init_semaine($jour_today,$mois_today,$annee_today,$date
 	}
 //	$largeur_table = $largeur_table - ($largeur_gauche+20);
   
-	$nom = mktime(1,1,1,$mois_today,$jour_today,$annee_today);
-	$jour_semaine = date("w",$nom);
-	$debut = mktime(1,1,1,$mois_today, $jour_today-$jour_semaine+1, $annee_today);
-	$debut = date("Y-m-d",$debut);
+	$jour_today = journum($date);
+	$mois_today = mois($date);
+	$annee_today = annee($date);
+	$jour_semaine = date("w",$date);
+	$debut = date("Y-m-d",mktime(1,1,1,$mois_today, $jour_today-$jour_semaine+1, $annee_today));
 
 	$today=getdate(time());
 	$jour = $today["mday"];
@@ -1172,9 +1175,7 @@ function http_calendrier_init_semaine($jour_today,$mois_today,$annee_today,$date
 		"<div>&nbsp;</div>" .
 		"<table cellpadding=0 cellspacing=0 border=0 width='$largeur_table'><tr>" .
 		"<td width='$largeur_table' valign='top'>" .
-		http_calendrier_suite_heures($jour_today,$mois_today,$annee_today, 			$articles, $breves, $messages,
-			$script,
-			'') .
+	  http_calendrier_suite_heures($jour_today,$mois_today,$annee_today, $articles, $breves, $messages, $partie_cal, $echelle, $script, '') .
 		"</td></tr></table>" .
 		(!(strlen($breves["0"]) > 0 OR $articles["0"] > 0) ? '' :
 			("<table width=400 background=''><tr width=400><td><FONT FACE='arial,helvetica,sans-serif' SIZE=1>" .
@@ -1185,12 +1186,11 @@ function http_calendrier_init_semaine($jour_today,$mois_today,$annee_today,$date
 			http_calendrier_aide_mess();
 }
 
-function http_calendrier_jour($jour,$mois,$annee,$large = "large", $le_message = 0) {
+function http_calendrier_jour($jour,$mois,$annee,$large = "large", $partie_cal, $echelle, $le_message = 0, $script =  'calendrier.php3') {
   global $spip_lang_rtl, $spip_lang_right, $spip_lang_left, $bleu, $vert,$jaune;
 	global $calendrier_message_fermeture;
-	global $partie_cal;
 	
-	$script =  'calendrier.php3' ; // ok pour espace de redac, pas pour public
+
 	if ($partie_cal == "soir") {
 		$debut_cal = 12;
 		$fin_cal = 23;
@@ -1266,7 +1266,7 @@ function http_calendrier_jour($jour,$mois,$annee,$large = "large", $le_message =
 	} else {
 		$largeur = 50;
 	}
-	$echelle = $GLOBALS['echelle'];
+
 	list($dimheure, $dimjour, $fontsize, $padding) =
 	  calendrier_echelle($debut_cal, $fin_cal, $echelle);
 	// faute de fermeture en PHP...
@@ -1302,27 +1302,6 @@ function http_calendrier_message($evenement)
     }
 }
 
-# Affiche l'encadre "lien iCal"
-# avec une simulation de
-# icone_horizontale (_T("icone_suivi_activite"), "synchro.php3", "synchro-24.gif")
-# qui fait des echo...
-function http_calendrier_ical($id) {
-  $lien = 'synchro.php3';
-  $fond = 'synchro-24.gif';
-  $fonction = "rien.gif";
-  $texte =_T("icone_suivi_activite") ;
-  return 
-    debut_cadre_enfonce('',true) .
-    "<div class='verdana1'>"._T("calendrier_synchro") .
-    "<a href='$lien' class='cellule-h'><table cellpadding='0' valign='middle'><tr>\n" .
-    "<td><a href='$lien'><div class='cell-i'>"
-    . http_img_pack($fonction, '', http_style_background($fond, "background-repeat: no-repeat; background-position: center center;"))
-    . "</div></a></td>\n"
-    . "<td class='cellule-h-lien'><a href='$lien' class='cellule-h'>$texte</a></td>\n"
-    . "</tr></table></a>\n" ."</div>" .
-    fin_cadre_enfonce(true);
-}
-
 function http_calendrier_rv($messages, $type) {
 	global $spip_lang_rtl, $spip_lang_left, $spip_lang_right;
 
diff --git a/ecrire/index.php3 b/ecrire/index.php3
index 42545e6376a7090c0eed627a227829a43fb1737e..b7f225b5ec9fbc2282ca94b43e683d990e65bb24 100644
--- a/ecrire/index.php3
+++ b/ecrire/index.php3
@@ -176,7 +176,7 @@ if ($spip_display != 4) {
 				"WHERE ((lien.id_auteur='$connect_id_auteur' AND lien.id_message=messages.id_message) OR messages.type='affich') ".
 					     "AND messages.rv='oui' AND messages.date_heure >='$annee_today-$mois_today-$jour_today' AND messages.date_heure < DATE_ADD('$annee_today-$mois_today-$jour_today', INTERVAL 1 DAY) AND messages.statut='publie' LIMIT 0,1"))) {
 			echo "<p />";
-			echo http_calendrier_jour($jour_today,$mois_today,$annee_today, "col");
+			echo http_calendrier_jour($jour_today,$mois_today,$annee_today, "col", $partie_cal, $echelle);
 		}
 }
 
diff --git a/ecrire/message.php3 b/ecrire/message.php3
index b36a731e682779ef50cdd6cb2df3eb4a03be1808..5c6138abe8b5b4fdd61d9d52d2f6b0c341388856 100644
--- a/ecrire/message.php3
+++ b/ecrire/message.php3
@@ -280,7 +280,7 @@ if ($row = spip_fetch_array(spip_query("SELECT * FROM spip_messages WHERE id_mes
 
 	if ($rv != "non") {
 	  creer_colonne_droite();	
-	  echo http_calendrier_jour($lejour,$lemois,$lannee, "col", $id_message);
+	  echo http_calendrier_jour($lejour,$lemois,$lannee, "col", $partie_cal, $echelle, $id_message);
 	}
 	debut_droite();
 
diff --git a/ecrire/messagerie.php3 b/ecrire/messagerie.php3
index 30ed8d490c4c8d88b846007d389f92533fb006cf..006349d1538e481fafb1c7f1c73c253869b7d5ba 100644
--- a/ecrire/messagerie.php3
+++ b/ecrire/messagerie.php3
@@ -13,7 +13,6 @@
 
 include ("inc.php3");
 include_ecrire ("inc_acces.php3");
-include_ecrire ("inc_calendrier.php");
 
 if ($supp_dest) {
 	spip_query("DELETE FROM spip_auteurs_messages WHERE id_message=$id_message AND id_auteur=$supp_dest");
@@ -65,15 +64,24 @@ debut_cadre_relief("messagerie-24.gif");
 fin_cadre_relief();
 
 
+# Affiche l'encadre "lien iCal"
 
-echo	http_calendrier_ical($connect_id_auteur);
+echo
+    debut_cadre_enfonce('',true) .
+    "<div class='verdana1'>"._T("calendrier_synchro") .
+    "<a href='synchro.php3' class='cellule-h'><table cellpadding='0' valign='middle'><tr>\n" .
+    "<td><a href='synchro.php3'><div class='cell-i'>"
+    . http_img_pack("rien.gif", '', http_style_background('synchro-24.gif', "; background-repeat: no-repeat; background-position: center center;"))
+    . "</div></a></td>\n"
+    . "<td class='cellule-h-lien'><a href='synchro.php3' class='cellule-h'>" 
+    . _T("icone_suivi_activite")
+    . "</a></td>\n</tr></table></a>\n" ."</div>" .
+    fin_cadre_enfonce(true);
 
 
 debut_droite("messagerie");
 
 
-
-
 $messages_vus = '';