//au chargement de la page, on appelle la fonction montre()
window.onload = montre;
 
//affichage du menu déroulant et placement de ce dernier
function montre(id,affiche) {

  var d = document.getElementById(id);
  //si on quitte un élément du menu
  if (d && !affiche) 
  {
    d.style.display='none'; //on l'efface
    var c=d.parentNode; //son parent
  }
  //sinon si on se met sur un élément du menu
  else if (d && affiche)
  { 
    d.style.display='block'; //on l'affiche
    var c=d.parentNode; //son parent
  }
}

// Menu de sélection rapide
function MM_jumpMenu(targ,selObj,restore) { //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// Affichage du lien "Haut de page"
/***********************************************
* Script adapted from :
* Jump To Top Link Script- © Dynamic Drive (www.dynamicdrive.com)
* Last updated Nov 13th, 03'.
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var displayed="<img src='../images/Top_page.png' width='12' height='13' border='0'>"
var link='javascript:window.scrollTo(0,0)'
var ie4=document.all
var ns6=document.getElementById&&!document.all

function ietruebody() {
  return (document.compatMode && document.compatMode!="BackCompat") ? document.documentElement : document.body
  }

function afficheTop() {
  document.write('<span id="gotop" style="position:absolute;visibility:hidden;top:-300px;z-index:100">'+displayed+'</span>')
}

function staticit() {
  var w2 = ns6 ? pageXOffset + w : ietruebody().scrollLeft + w
  var h2 = ns6 ? pageYOffset + h : ietruebody().scrollTop + h
  crossgotop.style.left = w2 + "px"
  crossgotop.style.top = h2 + "px"
}

function inserttext() {
  crossgotop = document.getElementById("gotop")
  crossgotop.innerHTML = '<a href="'+link+'">'+displayed+'</a>'
  var position = 355 - crossgotop.offsetWidth/2
  w = ns6 || window.opera ? window.innerWidth/2 + position - 8 : ietruebody().clientWidth/2 + position
  h = ns6 || window.opera ? window.innerHeight-crossgotop.offsetHeight - 15 : ietruebody().clientHeight-crossgotop.offsetHeight - 16
  s = ns6 || window.opera ? window.innerHeight-5 : ietruebody().clientHeight
  crossgotop.style.left = w + "px"
  crossgotop.style.top = h + "px"
  if (document.body.scrollHeight > s + 40) crossgotop.style.visibility = "visible" // Displays icone only if page is bigger than window
  else return
  if (ie4)
    window.onscroll = staticit
  else if (ns6)
    startstatic = setInterval("staticit()", 100)
}

if (window.addEventListener) // Firefox,Opera & Safari
  window.addEventListener("load", inserttext, false)
else if (window.attachEvent) // ?
  window.attachEvent("onload", inserttext)
else // IE
  window.onload = inserttext
  //window.onresize = new Function("window.location.reload()")
