// horizontal top menu

var blnOk=true;
var menudecalleft=12;       // décallage depuis la gauche
var menudecaltop=0;         // distance du haut de page à la ligne du menu
var subMenuDecalTop = 2.4;
var menuwidth=7;           // largeur de chaque tableau
var nmenu=20;                             // nombre maxi de sou-menu de 1er niveau
var nsmenu=20;                          // nombre maximum de sous-menu de 2nd niveau

function Chargement() {

  if(document.body.style.backgroundColor!="") { blnOk=false; }
  if(document.body.style.color!="") { blnOk=false; }
  if(document.body.style.marginTop!="") { blnOk=false; }
  if(document.getElementById) {
      /*
    with(document.getElementById("texte").style) {
      if(position!="") { blnOk=false; }
      if(top!="") { blnOk=false; }
      if(left!="") { blnOk=false; }
      if(width!="") { blnOk=false; }
      if(height!="") { blnOk=false; }
      if(zIndex!="") { blnOk=false; }
      if(margin!="") { blnOk=false; }
      if(padding!="") { blnOk=false; }
      if(visibility!="") { blnOk=false; }
    }
    */
  }
  else {
    blnOk=false;
  }

    if(blnOk) {
        /*with(document.body.style) {
            marginTop="5em";
        }*/
        /*
        if (document.getElementById("logo")) {
                with(document.getElementById("logo").style) {
                position="absolute";
                top="0.1em";
                left="0.1em";
                width="10em";
                margin="0";
                zIndex="3";
                }
        }

        if (document.getElementById("texte")) {
                with(document.getElementById("texte").style) {
                marginTop="5.6em";
                border="2px solid black";
                width="100%";
            }
        }*/

    /*      WE DONT NEED TO SETUP THIS

        if (document.getElementById("access"))
        with(document.getElementById("access").style) {
      position="absolute";
      top="1em";
      left=(menudecalleft-1)+"em";
      margin="0";
    }
/**/

//Custom JavaScript Functions by Shawn Olson
//Copyright 2004
//http://www.shawnolson.net
//If you copy any functions from this page into your scripts, you must provide credit to Shawn Olson & http://www.shawnolson.net
//*******************************************
    function changecss(theClass,element,value) {
    //documentation for this script at http://www.shawnolson.net/a/503/
     var cssRules;
     if (document.all) {
      cssRules = 'rules';
     }
     else if (document.getElementById) {
      cssRules = 'cssRules';
     }
     for (var S = 0; S < document.styleSheets.length; S++){
      for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
       if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
        document.styleSheets[S][cssRules][R].style[element] = value;
       }
      }
     }
    }


    /*      MENU    */
    with (document.getElementById("menu").style) {
        top="2.9em";
        background="#A77D52 url('images/bg_nav.png') repeat-x";
        width="100%";
    }

    /*changecss("ul.menu a", "color", "white");
    // Helas ne fonctionne pas a distance et avec https */

    for(i=1;i<=nmenu;i++)
      if (document.getElementById("menu"+i)) {
      document.getElementById("menu"+i).className="menujs";
      with(document.getElementById("menu"+i).style) {
        position="absolute";
        top=(menudecaltop)+"em";
        left=(menudecalleft+((i-1)*(menuwidth+0.5))+1)+"em";
        width= (menuwidth+0.5)+"em";
        height="2.6em";
        textAlign="center";
        margin="0";
        padding="0";
        zIndex="2";
      }
    }

    /*  SUB_MENU    */
    for(i=1;i<=nmenu;i++)
        if (document.getElementById("ssmenu"+i)) {
        with(document.getElementById("ssmenu"+i).style) {
            position="absolute";
            top=(menudecaltop+subMenuDecalTop)+"em";
            left=(menudecalleft+((i-1)*(menuwidth+0.5))+1.0)+"em";
            width="12em";
            margin="0";
            padding="0";
            zIndex="3";
        }

        /*  SUB_SUB_MENU    *//*
        for(ii=1;ii<=nsmenu;ii++)
            if (document.getElementById("sssmenu"+i+"_"+ii)) {
            with(document.getElementById("sssmenu"+i+"_"+ii).style) {
                position="absolute";
                top=((ii-1)*1.7+0.3)+"em";
                left=(menuwidth*1.8)+"em";
                width="12em";
                margin="0";
                padding="0";
                zIndex="3";
            }
        }*/
    } // if

        CacherMenus();
        //document.getElementById("access").style.visibility="hidden";
  }
}

function MontrerMenu(strMenu, strsMenu) {
    if(blnOk) {
            CacherMenus();
            if (document.getElementById(strMenu)) {
                document.getElementById(strMenu).style.visibility="visible";
        }
        if (document.getElementById(strsMenu)) {
                document.getElementById(strsMenu).style.visibility="visible";
        }
    }
}

function CacherMenus(txt) {
    if(blnOk) {
            for(i=1;i<=nmenu;i++) {
                if (document.getElementById("ssmenu"+i)) {
                with(document.getElementById("ssmenu"+i).style) {
                    visibility="hidden";
                }
            }
            for(ii=1;ii<=nsmenu;ii++) {
                if (document.getElementById("sssmenu"+i+"_"+ii)) {
                    with(document.getElementById("sssmenu"+i+"_"+ii).style) {
                        visibility="hidden";
                    }
                }
            }
        }
    }
}
