var tailleCourante = 0;
var tailleMin = -4;
var tailleMax = 4;
var pas = 2;

function popup(adresse) {
   var width = 645;
   var height = 600;
   var top = (screen.height - height) / 2;
   var left = (screen.width - width) / 2;
   if (adresse == "" || adresse == "?") {
      adresse = "?mode=popup";
   }
   else {
      adresse += "&mode=popup";
   }
   var popup = window.open(adresse, "popup", "directories=no, menubar=yes, status=yes, resizable=yes, scrollbars=yes, location=no, height=" + height + ", width=" + width + ", top=" + top + ", left=" + left);
   popup.focus();
}

function augmenter() {
   if (tailleCourante == tailleMax) {
      return;
   }
   tailleCourante += pas;
   changerFontSize(pas);
}
function diminuer() {
   if (tailleCourante == tailleMin) {
      return;
   }
   tailleCourante -= pas;
   changerFontSize(-pas);
}
function imprimer() {
   window.print();
}
function favoris() {
   var nomSite = html_entity_decode(document.getElementsByTagName('title')[0].innerHTML);
   var urlSite = window.location;
   if (window.external) {
      if (window.sidebar) {
         window.sidebar.addPanel(nomSite, urlSite, "");
      }
      else {
         window.external.AddFavorite(urlSite, nomSite);
      }
   }
   if (   document.all
       && navigator.userAgent.indexOf('Win') < 0) {
      alert ("COMMAND + B pour ajouter  " + nomSite + " à vos favoris !");
   }
   if (document.layers) {
      alert ("CTRL + D pour ajouter " + nomSite + " à vos favoris !");
   }
   if (navigator.userAgent.indexOf('Opera') != -1) {
      alert ("CTRL + T pour ajouter " + nomSite + " à vos favoris !");
   }
}
function html_entity_decode(texte) {
   var tarea = document.createElement('textarea');
   tarea.innerHTML = texte;
   return tarea.value;
}
function changerFontSize(valeur) {
   var rules = document.styleSheets[0].rules||document.styleSheets[0].cssRules;
   for (var r = 0 ; r < rules.length; r++) {
      if (!rules[r].selectorText) continue;
      if (   rules[r].style.cssText.toLowerCase().indexOf("font-size") != -1
          && parseInt(rules[r].style.fontSize) != 1) {
         rules[r].style.fontSize = parseInt(rules[r].style.fontSize)
            + parseInt(valeur) + "px";
      }
   }
}