   function getClientSize() {
     var myWidth = 0, myHeight = 0;
     if( typeof( window.innerWidth ) == 'number' ) {
       //Non-IE
       myWidth = window.innerWidth;
       myHeight = window.innerHeight;
     } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
       //IE 6+ in 'standards compliant mode'
       myWidth = document.documentElement.clientWidth;
       myHeight = document.documentElement.clientHeight;
     } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
       //IE 4 compatible
       myWidth = document.body.clientWidth;
       myHeight = document.body.clientHeight;
     }
     return [ myWidth, myHeight ];
   }

   function getScrollXY() {
     var scrOfX = 0, scrOfY = 0;
     if( typeof( window.pageYOffset ) == 'number' ) {
       //Netscape compliant
       scrOfY = window.pageYOffset;
       scrOfX = window.pageXOffset;
     } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
       //DOM compliant
       scrOfY = document.body.scrollTop;
       scrOfX = document.body.scrollLeft;
     } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
       //IE6 standards compliant mode
       scrOfY = document.documentElement.scrollTop;
       scrOfX = document.documentElement.scrollLeft;
     }
     return [ scrOfX, scrOfY ];
   }


   var IEfader = (navigator.appName == "Microsoft Internet Explorer");

    function fade_in(id,op,max) {
      if (element = document.getElementById(id)) {
          if (op==0) element.style.visibility = "visible";
          if (op>max) op=max;
          if (IEfader)
            element.style.filter = "alpha(opacity="+op+")";
          else {
            element.style.opacity = (op / 100);
            element.style.MozOpacity = (op / 100);
          }
          if (op < max) setTimeout('fade_in("'+id+'",'+(op+15)+','+max+');',75);          
      }
    }

    function fade_out(id,op,min) {
      if (element = document.getElementById(id)) {
          if (op < min) op=min;
          if (IEfader)
            element.style.filter = "alpha(opacity="+op+")";
          else {
            element.style.opacity = (op / 100);
            element.style.MozOpacity = (op / 100);
          }
          if (op>min) setTimeout('fade_out("'+id+'",'+(op-20)+','+min+');',55);
          if (op==0) element.style.visibility = "hidden";
      }
    }

   /* ------------------  Fonctions de fenêtres "génériques"..  ------ */
    function Ouvrir(id) {
      if (!IEfader)
        fade_in(id,0,100);
      document.getElementById(id).style.display = "block";
    }

    function Fermer(id) {
      if (!IEfader)
        fade_out(id,70,0);
      else document.getElementById(id).style.display = "none";
    }


/* ------------------  Fonction de base pour capture / drag de la souris..  ------ */

   var nowX = 0;
   var nowY = 0;
   var curr_z = 200;

   var sourisX1 = 0;
   var sourisY1 = 0;
   var objX1 = 0;
   var objY1 = 0;
   var initialise = false;

   function getMouseXY(e) {
      var posX = 0;
      var posY = 0;
      var e = (!e) ? window.event : e;
      if (e.pageX || e.pageY) {
         posX = e.pageX;
         posY = e.pageY;
      }
      else if (e.clientX || e.clientY) {
         if (document.body.scrollLeft || document.body.scrollTop) {
            posX = e.clientX + document.body.scrollLeft;
            posY = e.clientY + document.body.scrollTop;
         }
         else {
            posX = e.clientX + document.documentElement.scrollLeft;
            posY = e.clientY + document.documentElement.scrollTop;
         }
      }
      nowX = posX;
      nowY = posY;
   }

   /* onmousemove appelle toujours getMouseXY, */
   /* pour s'assurer que lorsqu'on commence un drag, on a une valeur de nowX et nowY valide */
   document.onmouseup = function() {
       document.onmousemove = function(e) { getMouseXY(e); }
   }
   document.onmousemove = function(e) { getMouseXY(e); }

    function drag(id) {
       obj = document.getElementById(id);
       obj.style.zIndex = curr_z++;
       /* initialise les positions relatives au début du drag */
       sourisX1 = nowX;
       sourisY1 = nowY;
       objX1 = obj.offsetLeft;
       objY1 = obj.offsetTop;
       /* redéfinis la fonction temporairement (jusqu'à "onmouseup") */
       document.onmousemove = function(e) {
           getMouseXY(e);
           newX = (objX1-sourisX1+nowX);
           newY = (objY1-sourisY1+nowY);
           obj.style.left = newX+"px";
           obj.style.top = newY+"px";
       }
   }


   /* ------------------  Fin des fonctions de capture de la souris..  ------ */


/* ---------------------------------------------------------------
 *
 *          Fonctions ALBUM PHOTOS
 *
 * -------------------------------------------------------------*/

var album_page_active = "";
var album_photo_active = "";
var album_page_back_admin = "";
var album_photo_back_admin = "";

function AfficheAlbumThumbs(idalbum) {
   if ( document.getElementById('album_pres_thumbs')) {
      
     document.getElementById('album_pres_thumbs_titre').innerHTML = document.getElementById('album_titre_page_'+idalbum).innerHTML;

     if (album_page_active != idalbum) {
        if (album_page_active != "" && document.getElementById('album_thumbs_page_'+album_page_active))
            document.getElementById('album_thumbs_page_'+album_page_active).style.display = "none";
        album_page_active = idalbum;

        if (document.getElementById('album_thumbs_page_'+idalbum)) Ouvrir('album_thumbs_page_'+idalbum);
     }

   }
}
function AfficheAlbumPhoto(idphoto) {
   if ( document.getElementById('album_pres_photo') && document.getElementById('album_photo_src_'+idphoto)) {
     if (album_photo_active != idphoto) {
       /*document.getElementById('album_pres_photo').style.visibility = "hidden";*/
       fade_out('album_pres_photo',10,0);
       album_photo_active = idphoto;

       document.getElementById('album_pres_titre').innerHTML = document.getElementById('album_photo_titre_'+idphoto).innerHTML;
       document.getElementById('album_pres_photo').innerHTML = '<img src="'+document.getElementById('album_photo_src_'+idphoto).innerHTML+'" />';

       setTimeout("fade_in('album_pres_photo',0,100);",200); // puisque juste l'image, IE AUSSI, donc fade_in sans "ouvrir" ! :)

       document.getElementById('album_pres_contenu').innerHTML = document.getElementById('album_photo_contenu_'+idphoto).innerHTML;
     }
   }
}
/*
function AjusteOmbres() {
 document.getElementById('img_ombre_verticale').style.height = (document.getElementById('album_pres_conteneur').scrollHeight+6)+"px";
 document.getElementById('img_ombre_horizontale').style.width = (document.getElementById('album_pres_conteneur').scrollWidth+6)+"px";

}
*/
   /* ------------------  Fin des fonctions de l'album photo..  ------ */

/* ---------------------------------------------------------------
 *
 *          Fonctions CALENDRIER D'ÉVENEMENTS
 *
 * -------------------------------------------------------------*/


var check_today = new Date.today().toString('yyyy-MM-dd');
var mois_courant = new Date.today().moveToFirstDayOfMonth();
var mois_nom = "";
var titres_jours_ev = '<div class="cal_ev_nom_jour">D</div><div class="cal_ev_nom_jour">L</div><div class="cal_ev_nom_jour">M</div><div class="cal_ev_nom_jour">M</div><div class="cal_ev_nom_jour">J</div><div class="cal_ev_nom_jour">V</div><div class="cal_ev_nom_jour">S</div>';

var cal_ev_contenu = new Array();
var cal_ev_titres = new Array();
var cal_ev_mois_presents = new Array();

var cal_ev_aujourdhui = true;

var cal_ev_dispo = true;


function CalEvSelect(d) {

  j = Date.parse(d);

  jnom = decodeURIComponent( escape( j.getDayName() ) ); // puisque UTF8.. :)
  jnom = jnom.substr(0,1).toUpperCase() + jnom.substr(1); // première lettre majuscule...
  jnum = j.toString('dd');
  mn = decodeURIComponent( escape( j.getMonthName() ) );
  an = j.toString('yyyy');

  jour_affiche = jnom+' le '+jnum+' '+mn+' '+an;
  document.getElementById('cal_ev_pres_titre').innerHTML = jour_affiche;
  if (cal_ev_contenu[d]) {
   document.getElementById('cal_ev_pres_contenu').innerHTML = cal_ev_contenu[d];
  }
  else {
   document.getElementById('cal_ev_pres_contenu').innerHTML = '<h4>Aucune activité prévue aujourd\'hui.</h4>';
  }
}

function CalEvMouseOver(obj) {
  obj.style.backgroundColor = "#bb9988";

}

function CalEvMouseOut(obj,bg) {
   obj.style.backgroundColor = bg;
}


function GetCalEv(mois_diff) {
  if (cal_ev_dispo) {
     mois_courant.addMonths(mois_diff);
     mois_check = mois_courant.toString('yyyy-MM');
     if (!cal_ev_mois_presents[mois_check]) {
       cal_ev_dispo = false;


          var html_doc = document.getElementsByTagName('head').item(0);
          var js = document.createElement('script');
          js.setAttribute('language', 'javascript');
          js.setAttribute('type', 'text/javascript');
          js.setAttribute('src', 'cal_ev.php?mois='+mois_check);
          html_doc.appendChild(js);

       cal_ev_mois_presents[mois_check] = true;
     }
     else {
       AfficheCalEv();
     }
  }
}

function AfficheCalEv() {
 if (document.getElementById('grille_cal_ev')) {

  mois = mois_courant;
  max_mois = mois.getDaysInMonth();

  mois_nom = decodeURIComponent( escape( mois.getMonthName() ) ); // puisque UTF8.. :)

  mois_nom = mois_nom.substr(0,1).toUpperCase() + mois_nom.substr(1); // première lettre majuscule...


  mois_num = mois.getMonth();

  annee = mois.toString('yyyy'); //annee = mois.getYear(); // donne 109 au lieu de 2009

  first_day_of_week = 0;
  if (mois.is().sun()) first_day_of_week = 0;
  if (mois.is().mon()) first_day_of_week = 1;
  if (mois.is().tue()) first_day_of_week = 2;
  if (mois.is().wed()) first_day_of_week = 3;
  if (mois.is().thu()) first_day_of_week = 4;
  if (mois.is().fri()) first_day_of_week = 5;
  if (mois.is().sat()) first_day_of_week = 6;


  affichage = "";

  jours_affichage = new Date(mois); // nouvelle instance pour travailler quotidiennement sans modifier le mois courant...

  for (i = 0; i < first_day_of_week; i++)
     affichage += '<div class="cal_ev_vide">&nbsp;</div>';

  for (i = 1; i <= max_mois; i++) {

      date_present = jours_affichage.toString('yyyy-MM-dd');

      bg_jour = '#efdfbf';                                     // FIN DE SEMAINE
      if (jours_affichage.isWeekday()) bg_jour = '#ffefdf';    // JOUR DE SEMAINE
      if (date_present == check_today) bg_jour = '#afbfdf';    // AUJOURD'HUI

      details = '';
      style_txt = '';
      if (cal_ev_contenu[date_present]) {
         dp = "'"+date_present+"'";
         details = ' cursor:pointer;" title="'+cal_ev_titres[date_present]+'" onmouseover="CalEvMouseOver(this)" onmouseout="CalEvMouseOut(this,\''+bg_jour+'\')" onclick="CalEvSelect('+dp+');';
         style_txt = ' style="font-weight:bold; color:#116633; font-size:15px; padding:4px;"';
      }
      affichage += '<div class="cal_ev_jour" style="background-color: '+bg_jour+';'+details+'"><p '+style_txt+'>'+
                      i+
                    '</p></div>';
      jours_affichage.addDays(1);
  }

  for (i = first_day_of_week+max_mois; i%7!=0; i++)
    affichage += '<div class="cal_ev_vide">&nbsp;</div>';

  document.getElementById('cal_ev_mois').innerHTML = ''+mois_nom+" "+annee;
  document.getElementById('grille_cal_ev').innerHTML = ''+titres_jours_ev+affichage;

  if (cal_ev_aujourdhui) {
      CalEvSelect(Date.today().toString('yyyy-MM-dd'));
      cal_ev_aujourdhui = false;
  }
 }
}
   /* ------------------  Fin des fonctions de calendrier d'évènements..  ------ */


/* ---------------------------------------------------------------
 *
 *          Fonctions du MENU DÉROULANT
 *
 * -------------------------------------------------------------*/

var sm_actif = "aucun";
var sm_ancien = "aucun";

var pompe = 1;              // menu déroulants: contourne des petits problèmes (diff. IE vs FIREFOX)..

var hauteurs = Array();

function Enlever(Sousmenu) {
  if (sm_actif != Sousmenu) {
     document.getElementById(Sousmenu).style.visibility="hidden";
  }
}
function Apparait(Sousmenu) {
  if (Sousmenu != sm_actif) {
    sm_actif = Sousmenu;
    for (i = 1; i <= nombre_items_menu; i++) {Enlever("sm_"+i);}
    if (Sousmenu != "aucun") {

      /* mettre en commentaire pour enlever l'effet déroulant : */
        if (!hauteurs[Sousmenu])
           hauteurs[Sousmenu] = document.getElementById(Sousmenu).scrollHeight -2;
        maxy = hauteurs[Sousmenu];
        pompe = 15;
        document.getElementById(Sousmenu).style.height = pompe+"px";

        // les vitesse sont différentes selon les navigateurs
        // premier chiffre : milisecondes entre les rafraichissements
        // deuxième chiffre : nombre de pixel qu'on agrandit à chaque rafraichissements
    	if (navigator.appName=="Microsoft Internet Explorer")
    	    Deroule(Sousmenu,40,18,maxy-2);
        else
            Deroule(Sousmenu,40,14,maxy);

      /* fin */

        document.getElementById(Sousmenu).style.visibility="visible";
    }
  }
}
function Deroule(Sousmenu,ms,dy,maxy) {
    Numero = Sousmenu;
    milisec = ms;
    deltay = dy;
    max = maxy;
    if (Sousmenu == sm_actif) {
        if ((pompe + dy) >= maxy)
            document.getElementById(Sousmenu).style.height = maxy+"px";
        else {
            pompe = pompe+dy;
            document.getElementById(Sousmenu).style.height = pompe+"px";
            setTimeout("Deroule(Numero,milisec,deltay,max)",milisec);
        }
    }
}
function Disparait(Sousmenu) {
    sm_actif = "aucun";
    Numero = Sousmenu;
	if (navigator.appName=="Microsoft Internet Explorer") {setTimeout("Enlever(Numero)",1200);}
		else {setTimeout("Enlever(Numero)",400);}

}

function OverMenu(Sousmenu)	{
    sm_actif = Sousmenu;
}

function OutMenu(Sousmenu) {
	sm_actif = "aucun";
	Numero = Sousmenu;
	if (navigator.appName=="Microsoft Internet Explorer") {setTimeout("Enlever(Numero)",1200);}
		else {setTimeout("Enlever(Numero)",400);}

}

