var rubrique_courant = '';
var rubrique_choix = '';
var srubrique_courant = '';
var chaine = '';
var popNom = '';
var popX = 0;
var popY = 0;
var popWidth = 0;
var couleurOff = '#888888';
var couleurOn = '#b1b1b1';
var compteur;
var chemin = '../';
var pageOK = false;

function rollon(rubrique) {
  if (pageOK) {
    lockmenu();
    if (rubrique != rubrique_courant) {
      if (rubrique_courant != '') effaceroll();
      rubrique_courant = rubrique;
      document.getElementById('menu'+rubrique).style.visibility = 'visible';
    }
  }
}

function menuChoix(choix) {
  if (pageOK) {
    lockmenu();
    effaceSousroll();
    if (rubrique_choix != choix) {
      if (rubrique_choix) rubrique_choix.style.background = couleurOff;
      choix.style.background = couleurOn;
      rubrique_choix = choix;
    }
  }
}

function rollSouson(rubrique) {
  if (pageOK) {
    if (rubrique != srubrique_courant) {
      effaceSousroll();
      srubrique_courant = rubrique;
      document.getElementById('menu'+rubrique).style.visibility = 'visible';
    }
  }
}

function rolloff(niveau) {
  compteur = setTimeout("effaceroll()",500);
}

function lockmenu() {
  clearTimeout(compteur);
}

function effaceroll() {
  if (pageOK) {
    var rb = rubrique_courant;
    if (!rb) return;
    if (srubrique_courant) effaceSousroll();
    document.getElementById('menu'+rb).style.visibility = 'hidden';
    rubrique_courant = '';
    if (rubrique_choix) {
      rubrique_choix.style.background = couleurOff;
      rubrique_choix = '';
    }
  }
}

function effaceSousroll() {
  if (pageOK) {
    var rb = srubrique_courant;
    if (!rb) return;
    document.getElementById('menu'+rb).style.visibility = 'hidden';
    srubrique_courant = '';
  }
}

function debutMenu(nom,posX,posY,largeur) {
  popNom = nom;
  popX = posX;
  popY = posY;
  popWidth = largeur;
  chaine = '';
  chaine += '<div id="menu'+nom+'" style="position: absolute; top: '+posY+'; left: '+posX+'; width: '+popWidth+'; background-color: #ffffff; visibility: hidden; z-index: 1000">\n';
  chaine += '<table border="0" cellpadding="2" cellspacing="0" width="' + largeur + '" onMouseOver="rollon(\'' + nom + '\')" onMouseOut="rolloff()" class="menucadre">';
}

function addChoix(lien,libelle,cible,schoix) {
  if (cible == '') cible = '_self';
  chaine += '  <tr>\n';
  if (schoix) {
    chaine += '    <td class="MenuChoix" width="' + popWidth + '" height="18" onMouseOver="menuChoix(this);rollSouson(\'' + schoix + '\')"><a href="' + chemin + lien + '" target="' + cible + '" onMouseOver="lockmenu()" onClick="return false">' + libelle + '</a></td>\n';
  }
  else {
    chaine += '    <td class="MenuChoix" width="' + popWidth + '" height="18" onMouseOver="menuChoix(this);" onClick="window.open(\'' + chemin + lien + '\',\'' + cible + '\')"><a href="' + chemin + lien + '" target="' + cible + '" onMouseOver="lockmenu()" onClick="return false">' + libelle + '</a></td>\n';
  }
  chaine += '  </tr>\n';
}

function finMenu() {
  chaine += '</table></div>';
  document.write(chaine);
}

function debutSousMenu(nom,posX,posY,largeur) {
  popNom = nom;
  popX = posX;
  popY = posY;
  popWidth = largeur;
  chaine = '';
  chaine += '<div id="menu'+nom+'" style="position: absolute; top: '+posY+'; left: '+posX+'; width: '+popWidth+'; background-color: #ffffff; visibility: hidden; z-index: 1000">\n';
  chaine += '<table border="0" cellpadding="2" cellspacing="0" width="' + largeur + '" onMouseOver="lockmenu()" onMouseOut="rolloff(\'s\')" class="sousmenucadre">';
}

function addSousChoix(lien,libelle,cible) {
  if (cible == '') cible = '_self';
  chaine += '  <tr>\n';
  chaine += '    <td class="SousMenuChoix" width="' + popWidth + '" height="26" onMouseOver="lockmenu();this.style.background=\''+ couleurOn + '\'" onMouseOut="this.style.background=\''+ couleurOff + '\'" onClick="window.open(\'' + chemin + lien + '\',\'' + cible + '\')"><a href="' + chemin + lien + '" target="' + cible + '" onMouseOver="lockmenu()" onClick="return false">' + libelle + '</a></td>\n';
  chaine += '  </tr>\n';
}

function finSousMenu() {
  chaine += '</table></div>';
  document.write(chaine);
}

function profil(id) {
  return false;
}

function accFlash() {
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="190" height="75" align="top">');
  document.write('<param name="movie" value="img/logo.swf">');
  document.write('<param name=quality value=high>');
  document.write('<embed src="img/logo.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="190" height="75" align="top">');
  document.write('</embed>');
  document.write('</object>');
}
