var pMenu = new PopupMenu('pMenu');
with (pMenu)
{startMenu('root', false,720,138, 0, hBar); 
addItem('<nobr><a href="index.php?rep=theorie&pages=theorie"><img src="images/index_09.gif" name="Image09" border="0"></a></nobr>', 'menu1', 'sm:',hBar,115);
startMenu('menu1', true, -35, 25, 120, subM);addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=theorie">Introduction</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=sol">Clé de Sol</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=fa">Clé de Fa</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=clavier">Lien  Portée/Clavier</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=notation_internationale">Notation internationale</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=acc_maj">Accords Majeurs</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=acc_min">Accords mineurs</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=acc_maj_renv">Accords Maj. renversés</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=acc_min_renv">Accords min. renversés</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=acc_majeurs7">Accords Majeurs 7</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=acc_mineurs7">Accords mineurs 7</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=renv_utilises">Choix des renversements</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=accords_speciaux">Accords spéciaux</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=exemples_accompagnements1">Accompagnements I</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=exemples_accompagnements2">Accompagnements II</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=exemples_accompagnements3">Accompagnements III</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=exemples_accompagnements4">Accompagnements IV</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=exemples_accompagnements5">Accompagnements V</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=grille_accords">La Grille d\'accords</a></center></nobr></div>');
addItem('<div style="cursor:pointer;"><nobr><center><a href="index.php?rep=theorie&pages=dictionnaire">Dictionnaire</a></center></nobr></div>');

}
addMenuBorder(pMenu, window.subBlank, null, '#666666', 1, '#CCCCDD', 2);

addDropShadow(pMenu, window.subM, [40,"#000000",6,6,-4,-4], [40,"",4,4,0,0]);
addDropShadow(pMenu, window.subBlank, [40,"#000000",6,6,-4,-4], [40,"",4,4,0,0]);

if (!isOp && navigator.userAgent.indexOf('rv:0.')==-1)
{
 pMenu.showMenu = new Function('mN','menuAnim(this, mN, 10)');
 pMenu.hideMenu = new Function('mN','menuAnim(this, mN, -10)');
}
if (!isNS4)
{
 pMenu.update(true);
 //anotherMenu.update(true);
}
else
{
 
 var popOldOL = window.onload;
 window.onload = function()
 {
  if (popOldOL) popOldOL();
  pMenu.update();
  //anotherMenu.update();
 }
}


// Other events must be assigned, these are less complicated, just add or remove menu objects.

var nsWinW = window.innerWidth, nsWinH = window.innerHeight, popOldOR = window.onresize;
window.onresize = function()
{
 if (popOldOR) popOldOR();
 if (isNS4 && (nsWinW!=innerWidth || nsWinH!=innerHeight)) history.go(0);
 pMenu.position();
 //anotherMenu.position();
}

window.onscroll = function()
{
 pMenu.position();
 //anotherMenu.position();
}


function menuAnim(menuObj, menuName, dir)
{
 // The array index of the named menu (e.g. 'mFile') in the menu object (e.g. 'pMenu').
 var mD = menuObj.menu[menuName][0];
 // Add timer and counter variables to the menu data structure, we'll need them.
 if (!mD.timer) mD.timer = 0;
 if (!mD.counter) mD.counter = 0;

 with (mD)
 {
  // Stop any existing animation.
  clearTimeout(timer);

  // If the layer doesn't exist (cross-frame navigation) quit.
  if (!lyr || !lyr.ref) return;
  // Show the menu if that's what we're doing.
  if (dir>0) lyr.vis('visible');
  // Also raise showing layers above hiding ones.
  lyr.sty.zIndex = 1001 + dir;



  lyr.clip(0, 0, menuW+2, (menuH+2)*Math.pow(Math.sin(Math.PI*counter/200),0.75) );
  // Remove clipping in NS6 on completion, seems to help old versions.
  if ((isDOM&&!isIE) && (counter>=100)) lyr.sty.clip='';

  // Increment the counter and if it hasn't reached the end (10 steps either way),
  // set the timer to call the show/hide function again in 40ms.
  counter += dir;
  if (counter>100) counter = 100;
  else if (counter<0) { counter = 0; lyr.vis('hidden') }
  else timer = setTimeout(menuObj.myName+'.'+(dir>0?'show':'hide')+'Menu("'+menuName+'")', 40);
 }
}

// Here's the alternative IE5.5+ filter animation function.
function menuFilterShow(menuObj, menuName, filterName)
{
 var mD = menuObj.menu[menuName][0];
 with (mD.lyr)
 {
  sty.filter = filterName;
  var f = ref.filters;
  if (f&&f.length&&f[0]) f[0].Apply();
  vis('visible');
  if (f&&f.length&&f[0]) f[0].Play();
 }
}

// BORDERS AND DROPSHADOWS:

function addMenuBorder(mObj, iS, alpha, bordCol, bordW, backCol, backW)
{
 // Loop through the menu array of that object, finding matching ItemStyles.
 for (var mN in mObj.menu)
 {
  var mR=mObj.menu[mN], dS='<div style="position:absolute; background:';
  if (mR[0].itemSty != iS) continue;
  // Loop through the items in that menu, move them down and to the right a bit.
  for (var mI=1; mI<mR.length; mI++)
  {
   mR[mI].iX += bordW+backW;
   mR[mI].iY += bordW+backW;
  }
  // Extend the total dimensions of menu accordingly.
  mW = mR[0].menuW += 2*(bordW+backW);
  mH = mR[0].menuH += 2*(bordW+backW);

  // Set the menu's extra content string with divs/layers underneath the items.
  if (isNS4) mR[0].extraHTML += '<layer bgcolor="'+bordCol+'" left="0" top="0" width="'+mW+
   '" height="'+mH+'" z-index="980"><layer bgcolor="'+backCol+'" left="'+bordW+'" top="'+
   bordW+'" width="'+(mW-2*bordW)+'" height="'+(mH-2*bordW)+'" z-index="990"></layer></layer>';
  else mR[0].extraHTML += dS+bordCol+'; left:0px; top:0px; width:'+mW+'px; height:'+mH+
   'px; z-index:980; '+(alpha!=null?'filter:alpha(opacity='+alpha+'); -moz-opacity:'+(alpha/100):'')+
   '">'+dS+backCol+'; left:'+bordW+'px; top:'+bordW+'px; width:'+(mW-2*bordW)+'px; height:'+
   (mH-2*bordW)+'px; z-index:990"></div></div>';
 }
}


function addDropShadow(mObj, iS)
{
 // Pretty similar to the one above, just loops through list of extra parameters making
 // dropshadow layers (from arrays) and extending the menu dimensions to suit.
 for (var mN in mObj.menu)
 {
  var a=arguments, mD=mObj.menu[mN][0], addW=addH=0;
  if (mD.itemSty != iS) continue;
  for (var shad=2; shad<a.length; shad++)
  {
   var s = a[shad];
   if (isNS4) mD.extraHTML += '<layer bgcolor="'+s[1]+'" left="'+s[2]+'" top="'+s[3]+'" width="'+
    (mD.menuW+s[4])+'" height="'+(mD.menuH+s[5])+'" z-index="'+(arguments.length-shad)+'"></layer>';
   else mD.extraHTML += '<div style="position:absolute; background:'+s[1]+'; left:'+s[2]+
    'px; top:'+s[3]+'px; width:'+(mD.menuW+s[4])+'px; height:'+(mD.menuH+s[5])+'px; z-index:'+
    (a.length-shad)+'; '+(s[0]!=null?'filter:alpha(opacity='+s[0]+'); -moz-opacity:'+(s[0]/100):'')+
    '"></div>';
   addW=Math.max(addW, s[2]+s[4]);
   addH=Math.max(addH, s[3]+s[5]);
  }
  mD.menuW+=addW; mD.menuH+=addH;
 }
}