// JavaScript Document

// ----------------------------------------------------------
// Permet de simuler la pseudo-classe 'hover' sur les listes
// ----------------------------------------------------------

sfHover = function()
{

  for (var i=0; sfEls = document.getElementsByTagName("LI")[i] ; i++)
  {
    sfEls.onmouseover=function()
    {
      this.className+=" sfhover";
    }
    sfEls.onmouseout=function()
    {
      this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    }
  }
}

if (window.attachEvent) window.attachEvent("onload", sfHover);

// ----------------------------------------------------
// Permet d'activer les feuilles de style alternatives
// ----------------------------------------------------

var attribut_title = "taille" //default stylesheet
var size = 0;

function selectStyleSheet(dir)
{
  var li; // link items - that is, stylesheets//make sure we're under limit
  size = size + dir;  //don't forget to increment the size, so we know what's next....
  if (-2<size && size<3){
    for(var i=0; li=document.getElementsByTagName("link")[i]; i++) {
      // get stylesheets
      if(li.getAttribute("rel").indexOf("style") != -1 && li.getAttribute("title")) {
        if(li.getAttribute("title").indexOf(attribut_title) !=-1) li.disabled = true;
        // check if 1 - it's a stylesheet with a title, 2- if it is an article stylesheet, disable it
        if (li.getAttribute("title").indexOf(attribut_title + " " + size)>-1) li.disabled = false;
        // if it's the next in line, enable it
      }
    }
  }
}

// --------------------------------------------------------------------
// Permet d'ajouter l'url de la page courante à la liste des bookmarks
// --------------------------------------------------------------------

function addbookmark()
{
      var bookmarkurl=window.location;
      var bookmarktitle=document.title;

      if ( navigator.appName != 'Microsoft Internet Explorer' )
        window.sidebar.addPanel(bookmarktitle,bookmarkurl,"");
      else window.external.AddFavorite(bookmarkurl,bookmarktitle);
      
}

// --------------------------------------------------------------------
// Efface ...
// --------------------------------------------------------------------

function effaceRecherche()
{
      if ( document.getElementById("val_rech").value=="Rechercher" ) 
      {
        document.getElementById("val_rech").value = '';
      }  
}

function ajouteRecherche()
{
      if ( document.getElementById("val_rech").value=="" ) 
      {
        document.getElementById("val_rech").value = 'Rechercher';
      }  
}
