// Gestion Flash
function loadFlash(url, largeur, hauteur, tag, id){
   var flash;
   var endTag;
 
   if(id != "")
      id = " id=\""+id+"\"";
 
   if(tag != ""){
      endTag = "</"+tag+">";
      tag = "<"+tag+id+">";
   }
 
   flash = tag+"<object type='application/x-shockwave-flash' data='"+url+"' width='"+largeur+"' height='"+hauteur+"'>";
   flash += "<param name='movie' value='"+url+"' \/>";
   flash += "<param name='menu' value='false' \/>";
   flash += "<param name='wmode' value='opaque' \/>";
   flash += "<param name='scalemode' value='noborder' \/>";
   flash += "<p>Veuillez télécharger le <a href='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=French'>plugin Flash<\/a> pour voir l'animation.<\/p>";
   flash += "<\/object>"+endTag;
   document.write(flash);
}

// Gestion Menu
function rollout(objMenuitem, objEvent) {
  var iKeyCode;
  if (objEvent && objEvent.type == 'keypress') {
    if (objEvent.keyCode)
      iKeyCode = objEvent.keyCode;
    else if (objEvent.which)
      iKeyCode = objEvent.which;
    if (iKeyCode != 13 && iKeyCode != 32)
      return true;
  }
  if (objMenuitem.nextSibling.style.display == 'block')
    var strDisplay = 'none'
  else
    var strDisplay = 'block';
  var objMenu = document.getElementById('menu');
  var objNested = objMenu.getElementsByTagName('ul');
  for (var i=0; i<objNested.length; i++) {
    if (objNested[i].style.display == 'block')
      objNested[i].style.display = 'none';
  }
  objMenuitem.nextSibling.style.display = strDisplay;
  while (objMenuitem.parentNode.parentNode.id != 'menu') {
    objMenuitem = objMenuitem.parentNode.parentNode;
    objMenuitem.style.display = 'block';
  }
  return false;
}
 
function initMenus() {
  var bRollup, objLinks, objNode, objAnchor;
  if (document.getElementById && document.createElement) {
    var strLocation = window.location;
    var objMenu = document.getElementById('menu');
    var objNested = objMenu.getElementsByTagName('ul');
    for (var i=0; i<objNested.length; i++) {
      bRollup = true;
      objLinks = objNested[i].getElementsByTagName('a');
      for (var j=0; j<objLinks.length; j++) {
        if (objLinks[j].href == strLocation) {
          bRollup = false;
          objNode = objLinks[j];
          strContent = objNode.firstChild.data;
          var objCurrentPage = document.createElement('strong');
          objCurrentPage.appendChild(document.createTextNode(strContent));
          objNode.parentNode.replaceChild(objCurrentPage, objNode);
          objCurrentPage.id = 'keepOpen';
        }
      }
      if (bRollup == true)
        objNested[i].style.display = 'none';
      else
        objNested[i].style.display = 'block';
      objNode = objNested[i].parentNode;
      strContent = objNode.firstChild.data;
      objAnchor = document.createElement('a');
      objAnchor.href = '#';
      objAnchor.onclick = function(event) {
        return rollout(this, event);
      }
      objAnchor.onkeypress = function(event) {
        return rollout(this, event);
      }
      objAnchor.appendChild(document.createTextNode(strContent));
      objNode.replaceChild(objAnchor, objNode.firstChild);
    }
    if (document.getElementById('keepOpen')) {
      var objKeepOpen = document.getElementById('keepOpen');
      while (objKeepOpen.parentNode.id != 'menu') {
        objKeepOpen = objKeepOpen.parentNode;
        objKeepOpen.style.display = 'block';
      }
    }
  }
}
 
// Gestion chargement
function initPrimary() {
   if (arguments.callee.done) return;
   arguments.callee.done = true;
   if (_timer) {
      clearInterval(_timer);
      _timer = null;
   }
 
   // Liste des fonctions à exécuter
   initMenus();
}
if (document.addEventListener) {
   document.addEventListener("DOMContentLoaded", initPrimary, false);
}
/*@cc_on @*/
/*@if (@_win32)
   document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
   var script = document.getElementById("__ie_onload");
   script.onreadystatechange = function() {
      if (this.readyState == "complete") {
         initPrimary();
      }
   };
/*@end @*/
if (/WebKit/i.test(navigator.userAgent)) {
   var _timer = setInterval(function() {
      if (/loaded|complete/.test(document.readyState)) {
         initPrimary();
      }
   }, 10);
}
window.onload = function () {
  initPrimary();
}; 