////////////////////////////////////////////////////////////////////////////////////////////////////
// * //////////                        - Site A vue de nez -                         ////////// * //
// * //////////                Ce code à été écrit par Olivier Habert                ////////// * //
// * //////////          Ne peut être reproduit sans l'accord de son auteur          ////////// * //
// * //////////                        olivier.habert@free.fr                        ////////// * //
////////////////////////////////////////////////////////////////////////////////////////////////////

var nomMenuPrecedent="";
var nomMenu="";
var menuActif=0;
var timeoutMenu=0;
var bloquerMenu=0;

function startMenuTimer()
  {
  menuActif=0;
  stopMenuTimer();
  timeoutMenu=setTimeout('menuMasquer()',500);
  }

function stopMenuTimer()
  {
  if(timeoutMenu)
    {
    clearTimeout(timeoutMenu);
    timeoutMenu=0;
    }
  }

function menuAfficher()
  {
  if(timeoutMenu)
    {
    clearTimeout(timeoutMenu);
    timeoutMenu=0;
    }
  if(!bloquerMenu)
    {
    if(nomMenuPrecedent)
      {
      if(nomMenu!=nomMenuPrecedent)
        {
        menuMasquer(nomMenuPrecedent);
        nomMenuPrecedent=nomMenu;
        }
      }
    else nomMenuPrecedent=nomMenu;
    var contenuMenu=eval("contenu_"+nomMenu);
    if(!menuActif && nomMenu)
      {
      var nomMenuParent=nomMenu.substr(0,17)+nomMenu.substr(18,nomMenu.length);
      document.getElementById(nomMenuParent).innerHTML=document.getElementById(nomMenuParent).innerHTML.replace(new RegExp(/(.*<span class="titre_M1">).*(<\/span>.*)/gi),"$1&#9660 $2");
      document.getElementById(nomMenu).innerHTML=contenuMenu;
      }
    if(document.getElementById("calque_"+nomMenu))
      {
      var calqueMenuParent=document.getElementById("calque_"+nomMenu+"_parent");
      var posxCalqueMenu=calqueMenuParent.offsetLeft;
      var posyCalqueMenu=calqueMenuParent.offsetTop;
      while(calqueMenuParent.parentNode.id!="ligneMenu")
        {
        calqueMenuParent=calqueMenuParent.parentNode;
        if(calqueMenuParent.offsetLeft>1) posxCalqueMenu+=calqueMenuParent.offsetLeft;
        if(calqueMenuParent.offsetTop>1) posyCalqueMenu+=calqueMenuParent.offsetTop;
        }
      document.getElementById("calque_"+nomMenu).style.left=posxCalqueMenu+10;
      document.getElementById("calque_"+nomMenu).style.top=posyCalqueMenu+document.getElementById("calque_"+nomMenu+"_parent").offsetHeight+3;
      document.getElementById("calque_"+nomMenu).style.visibility="visible";
      }
    menuActif=1;
    }
  }

function menuMasquer(nomMenuMasquer)
  {
  if(nomMenu && !bloquerMenu)
    {
    if(!nomMenuMasquer)
      {
      nomMenuMasquer=nomMenu; 
      nomMenuPrecedent="";
      nomMenu="";
      }
    if(!menuActif)
      {
      if(document.getElementById("calque_"+nomMenuMasquer))
        {
        document.getElementById("calque_"+nomMenuMasquer).style.visibility="hidden";
        document.getElementById("calque_"+nomMenuMasquer).style.left=0;
        document.getElementById("calque_"+nomMenuMasquer).style.top=0;
        }
      var nomMenuParent=nomMenuMasquer.substr(0,17)+nomMenuMasquer.substr(18,nomMenuMasquer.length);
      document.getElementById(nomMenuParent).innerHTML=document.getElementById(nomMenuParent).innerHTML.replace(new RegExp(/(.*<span class="titre_M1">).*(<\/span>.*)/gi),"$1&#9658 $2");
      document.getElementById(nomMenuMasquer).innerHTML="";
      document.getElementById(nomMenuMasquer).style.height="";
      }
    stopMenuTimer;
    }
  }

function menuOverStyle(nomMenuStyle)
  {
  nomMenuStyle.style.backgroundColor='#336699';
  nomMenuStyle.style.color='#FFFFFF';
  }

function menuOutStyle(nomMenuStyle)
  {
  nomMenuStyle.style.backgroundColor='';
  nomMenuStyle.style.color='';
  }