// Auteur : Julien Kronegg (jkronegg@bigfoot.com)
// Date   : 26 août 1999
// But Afficher la date de dernière modification du document en français

// MAJ : 
//   4 fév 2000   : o correction du bug Y2K pour le nom du jour et l'année
//                  o correction du bug du nom de jour (dimanche avait l'index 7)
//   20 août 2001 : o scramble des adresses email
//   24 août 2001 : o correction du bug Y2K qui est en fait dépendant du browser

// Prochaine vérification à faire en 2050 (tjrs le problème Y2K)

  Day_french = new Array(7)
  Day_french[0] = "Dimanche";
  Day_french[1] = "Lundi";
  Day_french[2] = "Mardi";
  Day_french[3] = "Mercredi";
  Day_french[4] = "Jeudi";
  Day_french[5] = "Vendredi";
  Day_french[6] = "Samedi";

  Month_french = new Array(12);  
  Month_french[0] = "Janvier";
  Month_french[1] = "Février";
  Month_french[2] = "Mars";
  Month_french[3] = "Avril"; 
  Month_french[4] = "Mai";
  Month_french[5] = "Juin";
  Month_french[6] = "Juillet";
  Month_french[7] = "Août";
  Month_french[8] = "Septembre";
  Month_french[9] = "Octobre";
  Month_french[10] = "Novembre";
  Month_french[11] = "Décembre";


  function print_date_updated_french() {
    // Affiche la date de la dernière mise à jour du fichier qui fait appel à cette fonction
    // Auteur : Julien Kronegg (jkronegg@bigfoot.com)
    // Date   : 26 août 1999, 4 fév 2000
    lastmod = document.lastModified     // get string of last modified date
    lastmoddate = Date.parse(lastmod);   // convert modified string to date
    if(lastmoddate == 0){               // unknown date (or January 1, 1970 GMT)
       document.writeln(" Unknown")
    } else {
      // affichage de la date en français
      // 2001.getYear() = 1 avec Netscape 4.5
      //                = 101 avec Netscape 4.7
      //                = 2001 avec Internet explorer 5.0
      

      // Si l'on admet qu'aucune date n'est inférieure à 1900 (comme c'est des dates de modification c'est OK),
      // alors on peut dire que :
      //  getYear() = 0..99 avec netscape 4.5
      //            = 0..oo avec netscape 4.7
      //            = 1900..oo avec IE5

      //document.writeln(lastmod) // affiche la date en anglais
      theDate = new Date(lastmod);		// convertit la string en date
      annee = theDate.getYear();
      if (annee<50) {
      	// après l'an 2000 => le jour n'est pas bien calculé (constatation : le bon jour est getDay()+6,  modulo 7 bien entendu)
      	// Netscape 4.5
        document.write(Day_french[(theDate.getDay()+6)% 7]+" ");
        annee += 2000;
      } else if (annee<1900) {
      	// avant l'an 2000 => tout va bien
      	// Netscape 4.7
        document.write(Day_french[theDate.getDay()]+" ");
        annee += 1900;
      } else {
        // IE5 => OK
        document.write(Day_french[theDate.getDay()]+" ");
      }//end if
      document.write(" "+theDate.getDate())
      document.write(" "+Month_french[theDate.getMonth()])
      document.write(" "+annee)
      document.write(", "+theDate.getHours()+":")
      if (theDate.getMinutes()<10) document.write('0'); // ajouter un 0 pour les temps inférieurs à 10 minutes
      document.write(theDate.getMinutes());
    }//end if
  }//end print_date_updated_french



  function print_date_updated_english() {
    // Affiche la date de la dernière mise à jour du fichier qui fait appel à cette fonction
    // Auteur : Julien Kronegg (jkronegg@bigfoot.com)
    // Date   : 26 août 1999
    
    // Y2K compliance not tested!!!
    lastmod = document.lastModified     // get string of last modified date
    lastmoddate = Date.parse(lastmod)   // convert modified string to date
    if(lastmoddate == 0){               // unknown date (or January 1, 1970 GMT)
       document.write(" Unknown")
    } else {
      // affichage de la date en français
      document.write(lastmod) // affiche la date en anglais
    }//end if
  }//end print_date_updated_english



  function space_to_nbsp(str) {
    // remplace tous les espaces de str par des nbsp;
    expression = / /gi;
    new_str1 = str;
    do {
      new_str2 = new_str1;
      new_str1 = new_str1.replace(expression, "&nbsp;");
    } while (new_str2 != new_str1);
    return new_str1;
  }




  // ********************* Julien KRONEGG *************************************
  function print_footer_jkronegg(email_subject, valid) {
    document.write("<br><hr><small><small><b>Dernière modification : </b>");
    print_date_updated_french();
    //document.write(",&nbsp;&nbsp; par "+escramble("jkronegg", "bigfoot.com", "Julien Kronegg", "?subject="+space_to_nbsp(email_subject+" ("+document.location+")"))+"<BR><b>Adresse de cette page :</b> "+document.location+"</td><td align=right>");
    document.write(",&nbsp;&nbsp; par "+escramble("webmaster", "pierreandregetaz.ch", "webmaster", "?subject="+space_to_nbsp(email_subject+" ("+document.location+")"))+"<BR><b>Adresse de cette page :</b> "+document.location+"</td><td align=right>");
    
    if (valid=="true") {// HTML 4.01 valid
      document.write("<a href=\"http://validator.w3.org/check/referer\"><img border=\"0\" src=\"images/valid-html401.gif\" alt=\"Valid HTML 4.01!\" height=\"31\" width=\"88\"></a>");
    }//end if
    document.write("</small></small>");
  }
  
  function print_footer_jkronegg_en(email_subject, valid) {
    document.write("<br><br><br><hr><small><small><b>Last_update : </b>");
    print_date_updated_english();
    document.write(",&nbsp;&nbsp;by "+escramble("jkronegg", "bigfoot.com", "Julien Kronegg", "?subject="+space_to_nbsp(email_subject+" ("+document.location+")"))+"<BR><b>Address of this page :</b> "+document.location+"</td><td align=right>");
    if (valid=="true") {// HTML 4.01 valid
      document.write("<a href=\"http://validator.w3.org/check/referer\"><img border=\"0\" src=\"images/valid-html401.gif\" alt=\"Valid HTML 4.01!\" height=\"31\" width=\"88\"></a>");
    }//end if
    document.write("</small></small>");
  }






  // ********************* Frédéric ROSSMANN *************************************
  function print_footer_frossmann(email_subject) {
    document.write("<br><br><br><hr><small><small><b>Dernière modification : </b>");
    print_date_updated_french();
    document.write(",&nbsp;&nbsp;by "+escramble("rossmann", "eig.unige.ch", "Fréderic Rossmann", "?subject="+space_to_nbsp(email_subject+" ("+document.location+")"))+"<BR><b>Adresse de cette page :</b> "+document.location+"</small></small>");
  }
    
  function print_footer_frossmann_en(email_subject) {
    document.write("<br><br><br><hr><small><small><b>Last_update : </b>");
    print_date_updated_english();
    document.write(",&nbsp;&nbsp;by "+escramble("rossmann", "eig.unige.ch", "Fréderic Rossmann", "?subject="+space_to_nbsp(email_subject+" ("+document.location+")"))+"<BR><b>Address of this page :</b> "+document.location+"</small></small>");
  }




  // ********************* Servlet server *************************************
  function print_footer_servlet(email_subject) {
    document.write("<br><br><br><hr><small><small><b>Dernière modification : </b>");
    print_date_updated_french();
    document.write(",&nbsp;&nbsp;by "+escramble("jkronegg", "bigfoot.com", "Servlet Server", "?subject="+space_to_nbsp(email_subject+" ("+document.location+")"))+"<BR><b>Adresse de cette page :</b> "+document.location+"</small></small>");
  }
    
function escramble(username, domaine, texte, param){
 var a,b,c,d,e,f,g,h,i
 a='<a href=\"mai'
 b=username
 c='\">'
 a+='lto:'
 b+='@'
 e='</a>'
 f=texte
 b+=domaine
 g='<img src=\"'
 h=''
 i='\" alt="Email us." border="0">'

 if (f) d=f
 else if (h) d=g+h+i
 else d=b

 return a+b+param+c+d+e+" ("+b+")"
}
  