var hBar = new ItemStyle(40, 6, '', 2, 2, '15#F5F5F5', '10#FDEBBF', 'highText', 'highText', 'itemBorder', 'itemBorder',
null, null, 'hand', 'default');


var subM = new ItemStyle(22, 0, '&gt;', -15, 3, '#F5F5F5', '#FFFFFF', 'lowText', 'highText',
 'itemBorder', 'itemBorder', null, null, 'hand', 'default');

// 'subBlank' is similar, but has an 'off' border the same colour as its background so it
// appears borderless when dim, and 1px spacing between items to show the hover border.
var subBlank = new ItemStyle(22, 0, '&gt;', -15, 3, '10#CCCCDD', '10#FFE4C4', 'lowText', 'highText',
 'itemBorder', 'itemBorder', null, null, 'hand', 'default');

// The purplish 'button' style also has 1px spacing to show up the fancy border, and it has
// different colours/text and less padding. They also have translucency set -- these items
// are 80% opaque when dim and 95% when highlighted. It uses the 'crosshair' cursor for items.
var button = new ItemStyle(22, 1, '&gt;', -15, 2, '10#FFFFFF', '10#FFE4C4', 'buttonText', 'buttonHover',
 'buttonBorder', 'buttonBorderOver', 80, 95, 'hand', 'default');


var pMenu = new PopupMenu('pMenu');
with (pMenu)
{



startMenu('root', false, 'window.page.winW()/2 - menuW/2', 120, 20, hBar, '', false);
addItem('Klinik', 'mKlinik', 'sm:', null, 80);
addItem('Behandlung', 'mBehandlung', 'sm:', null, 90);
addItem('Techniken', 'mTechniken', 'sm:', null, 90);
addItem('Fragen & Antworten', 'mFAQs', 'sm:', null, 140);
addItem('Medienspiegel', 'mMedien', 'sm:', null, 110);
addItem('Kontakt', 'kontakt.html', '', null, 90);
addItem('Impressum', 'impressum.html', '', null, 90);
addItem('Home', 'default.html', '', null, 80);


startMenu('mKlinik', true, 0, 22, 130, subM, '', false);
addItem('Philosophie', 'philosophie.html', '');
addItem('Team', 'team.html', '');
addItem('Klinikum Stuttgart', 'zertifizierung.html', '');
addItem('SWAP:Krankenhaus<br />Bad Cannstatt^im Klinikum<br /><b>Stuttgart</b>',
 'portraet.html', '', '', 38);
addItem('Anfahrt', 'mAnfahrt', 'sm:');

startMenu('mBehandlung', true, 0, 22, 150, subM, '', false);
addItem('Falten', 'falten.html', '');
addItem('Haarentfernung', 'haarentfernung.html', '');
addItem('Äderchen', 'aederchen.html', '');
addItem('Besenreiser <br >und Venen', 'besenreiser.html', '', '', 38);
addItem('Narben', 'narben.html', '');
addItem('Tätowierungen', 'tattoos.html', '');
addItem('Pigmentierungen', 'pigmente.html', '');
addItem('Flecken', 'flecken.html', '');
addItem('Überstehende <br >Hautveränderungen', 'irritation.html', '', '', 38);
addItem('Warzen', 'warzen.html', '');
addItem('Übermäßiges <br >Schwitzen', 'schwitzen.html', '', '', 38);
addItem('Gynäkomastie', 'gyno.html', '');
addItem('Schlupflider', 'schlupflider.html', '');

startMenu('mTechniken', true, 0, 22, 120, subM, '', false);
addItem('Laser', 'mLasertechnik', 'sm:');
addItem('Füllmaterialen', 'mFuell', 'sm:');

startMenu('mLasertechnik', true, 122, 0, 120, subM, '', false);
addItem('Typen &<br > Indikationen', 'typen.html', '', '', 38);
addItem('Funktionsweise', 'funktion.html', '');

startMenu('mFuell', true, 122, 0, 120, subM, '', false);
addItem('Eigenfett', 'eigenfett.html', '');
addItem('Hyaluronsäure', 'hyaluron.html', '');
addItem('Polymilchsäure', 'polymilch.html', '');

startMenu('mFAQs', true, 0, 22, 140, subM, '', false);
addItem('Vorgespräch', 'ablauf.html', '');
addItem('Sicherheit', 'sicherheit.html', '');
addItem('Kosten', 'kosten.html', '');
addItem('Unsere ärztliche <br > Qualifikation', 'qualifikation.html', '', '', 38);
addItem('Klinikaufenthalt <br >und Dauer', 'aufenthalt.html', '', '', 38);

startMenu('mMedien', true, 0, 22, 120, subM, '', false);
addItem('Radio & TV', 'tv.html', '');
addItem('Zeitungen und<br >Zeitschriften', 'zeitungen.html', '', '', 38);

startMenu('mAnfahrt', true, 132, 0, 120, subM, '', false);
addItem('Bahn / Flugzeug', 'bahn.html', '');
addItem('Mit dem PKW', 'auto.html', '');
addItem('Umgebungsplan', 'umgebungsplan.html', '');




startMenu('mEdit', true, 0, 22, 120, subM, '', false);
addItem('Kinder', 'am1.htm', '');
addItem('Erwachsene', 'am2.htm', '');
addItem('Schrittmacher', 'am3.htm', '');
addItem('Marfan', 'am4.htm', '');



startMenu('mHelp', true, 0, 22, 120, subM, '', false);
addItem('OP-Dienst', 'op_dienst.htm', '');
addItem('Aufenthalt', 'aufenthalt.htm', '');
addItem('Anreise / Anfahrt', 'mAnreise', 'sm:');
addItem('Veranstaltungen', 'event.htm', '');
addItem('&nbsp; &nbsp; Literatur', 'mAbout', 'sm:', subM, 22, 0, '&lt;', 3);
addItem('&nbsp; &nbsp; Links im Netz', 'mLinks', 'sm:', subM, 22, 0, '&lt;', 3);
addItem('Wörterbuch', 'window.open("textfutter/ABC.htm")', 'js:');


startMenu('mVeranstaltungen', true, 120, 0, 120, subBlank, '', false);
addItem('Für Mediziner', 'v_med.htm', '', button,35);
addItem('Für Laien', 'v_laien.htm', '', button, 35);
addItem('Sonstiges', 'v_sonstiges.htm', '', button, 35);


// This is 85px across and 0px down... a horizontal popout.
// Again these items have their own ItemStyles, and unique lengths / spacings between specified.

startMenu('mReopen', true, 120, 0, 140, button, '', false);
addItem('Interventionelle<br />Kinderkardiologie', 'katheter.htm', '', button, 35);
addItem('Operativ-chirurgisch', 'mOperation', 'sm:');

startMenu('mOperation', true, 140, 0, 120, button, '', false);
addItem('bei Neugeborenen<br />und Säuglingen', 'op.htm', '', button, 35);
addItem('bei Kindern und <br />Jugendlichen', 'op_kinder.htm', '', button, 35);
addItem('Eingriffe bei<br />Erwachsenen', 'op_erwachsene.html', '', button,35);


startMenu('mAnreise', true, 120, 0, 120, button, '', false);
addItem('Öffentliche<br />Verkehrsmittel', 'anreise_oepv.htm', '', button, 35);
addItem('Mit dem<br />eigenen Auto', 'anreise_auto.htm', '', button, 35);
addItem('Kartenskizze', 'karte.htm', '', subM);



startMenu('mWissen', true, 125, 0, 150, button, '', false);
addItem('Neugeborene/Säuglinge', 'neugeborene.htm', '');
addItem('Kinder / Jugendliche', 'kinder.htm', '');
addItem('Erwachsene', 'erwachsene.htm', '');


startMenu('mKliniken', true, 120, 0, 120, button, '', false);
addItem('Sana Herzchirurgie', 'shs.htm', '');
addItem('Olgahospital', 'oh.htm', '');
addItem('Katharinenhospital', 'kh.htm', '');


// Leftwards popout with a negative x and y relative to its trigger. The item has a custom height.

startMenu('mAbout', true, -85, -18, 80, subM, '', false);
addItem('Vorschläge<br>willkommen!', 'links_vorschlag.htm', '', subM, 40);

startMenu('mLinks', true, -115, 0, 115, button, '', false);
addItem('Patienten & Eltern<br />Interessierte', 'links_pat.htm', '', button, 35);
addItem('Fachgesellschaften<br />Institutionen', 'links_med.htm', '', button, 35, 5);
addItem('Vorschläge<br>willkommen!', 'links_vorschlag.htm', '', subM, 40);


//menu.root[0].oncreate = function() { pMenu.doVis('root', true) }

// End of 'with (pMenu)' block. That's one menu object created!

}

//}




addMenuBorder(pMenu, window.subBlank,
 null, '#666666', 1, '#CCCCDD', 2);





addDropShadow(pMenu, window.subM,
 [40,"#333333",6,6,-4,-4], [40,"#666666",4,4,0,0]);
addDropShadow(pMenu, window.subBlank,
 [40,"#333333",6,6,-4,-4], [40,"#666666",4,4,0,0]);
addDropShadow(pMenu, window.button,
 [40,"#333333",6,6,-4,-4], [40,"#666666",4,4,0,0]);




if ((navigator.userAgent.indexOf('rv:0.')==-1) &&
    !(isOp&&!document.documentElement) && !(isIE4&&!window.external))
{
 pMenu.showMenu = new Function('mN','menuAnim(this, mN, 10)');
 pMenu.hideMenu = new Function('mN','menuAnim(this, mN, -15)');

 // Add animation to other menu objects like this...
 //anotherMenu.showMenu = new Function('mN','menuAnim(this, mN, 10)');
 //anotherMenu.hideMenu = new Function('mN','menuAnim(this, mN, -15)');
}







// ******************** FUNCTIONS CALLED BY THE EFFECTS SECTION ********************

// These can be deleted if you're not using them. Alternatively, if you're using several menu
// data files, you may want to move them to the "core" script file instead.



// This is the "positioning from page anchors" code used by the advanced positioning expressions.
page.elmPos=function(e,p)
{
 var x=0,y=0,w=p?p:this.win;
 e=e?(e.substr?(isNS4?w.document.anchors[e]:getRef(e,w)):e):p;
 if(isNS4){if(e&&(e!=p)){x=e.x;y=e.y};if(p){x+=p.pageX;y+=p.pageY}}
 else if (e && e.focus && e.href && this.MS && /Mac/.test(navigator.platform))
 {
  e.onfocus = new Function('with(event){self.tmpX=clientX-offsetX;' +
   'self.tmpY=clientY-offsetY}');
  e.focus();x=tmpX;y=tmpY;e.blur()
 }
 else while(e){x+=e.offsetLeft;y+=e.offsetTop;e=e.offsetParent}
 return{x:x,y:y};
};





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 litNow() array doesn't show this menu as lit, and we're still showing it,
  // force a quick hide (this stops miscellaneous timer errors).
  //if (dir>0 && !menuObj.litNow[menuObj.menu[menuName][0].parentMenu]) dir = -100;

  // If the layer doesn't exist (cross-frame navigation) quit.
  if (!lyr || !lyr.ref) return;
  // This next line is not strictly necessary, but it stops the one-in-a-hundred menu that
  // shows and doesn't hide on very quick mouseovers.
  if (!visNow && dir>0) dir = 0-dir;
  // 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 = dir>0 ? mD.zIndex + 1 : 1001;

  

  // Straightforward downwards clipping animation (default setting):
  lyr.clip(0, 0, menuW+2, (menuH+2)*Math.pow(Math.sin(Math.PI*counter/200),0.75) );
  
  counter += dir;
  if (counter>100) { counter = 100; lyr.sty.zIndex = mD.zIndex }
  else if (counter<0) { counter = 0; lyr.vis('hidden') }
  else timer = setTimeout('menuAnim('+menuObj.myName+',"'+menuName+'",'+dir+')', 40);
 }
};





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+'%; 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)
{
  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]+'%; 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;
 }
};
