// Cascading Popup Menus v5.2 - Single Frame Menu example script.


// If you're upgrading from v5.1, you can paste your existing menu data in, and if you're
// upgrading from v5.0 you need to add 'cursor' settings to your ItemStyles.
//
// And before going ANY further, you must have READ and AGREE TO the script license!
// It can be found on my site, in the syntax helpfile, or in the demo script document.


// 'horizontal Bar' style: menu items that use this ItemStyle are 40px wide, have 10px gaps
// between them, no popout indicator (the ">" in some menus) or popout indicator position,
// 0px padding of the text within items, #336699 background colour, a hover colour of #6699CC,
// 'highText' is the stylesheet class used for the menu text both normally and when highlighted,
// no border styles, 'null' means fully opaque items (set them to numbers between 0 and 100 to
// enable semitranslucency), and the 'hand'/'default' cursors are used for linked/submenu items.

var hBar = new ItemStyle(100, 0, '', -50, 1, '', '', 'highText', 'highText2', '0', '',
null, 50, 'hand', 'default');


var hBar1 = new ItemStyle(100, 0, '', -50, 1, '', '', 'highText', 'highText2', '0', '',
null, null, 'hand', 'default');

var hBar2 = new ItemStyle(100, 0, '', -50, 1, '', '', 'highText', 'highText2', '0', '',
null, null, 'hand', 'default');

// The 'sub Menu' items: these have popout indicators of "Greater Than" signs ">" 15px from their
// right edge, and CSS borders. Text class also changes on mouseover.


var subM = new ItemStyle(20, 1, '', -15, 0, '#fff', '#fff', 'highText2', 'lowText',
 '', 'itemBorder', 65, 90, 'hand', 'default');

var subMbreit = new ItemStyle(42, 1, '', -15, 0, '#fff', '#fff', 'highText2', 'lowText',
 '', 'itemBorder', 65, 90, 'hand', 'default');


var subMbreit1 = new ItemStyle(35, 1, '', -15, 0, '#fff', '#fff', 'highText2', 'lowText',
 '', 'itemBorder', 65, 90, 'hand', 'default');

var subMbreit2 = new ItemStyle(22, 1, '', -15, 0, '', '', 'highText2', 'lowText',
 '', 'itemBorder', 65, 90, 'hand', 'default');

// Create a PopupMenu() object, and pass its own name so it can reference itself later on.
// We also use a 'with' block to work with its properties and functions below.

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

// Here's what the values in the next startMenu() command mean, in order:
//  'root': the name of this menu.
//   false: orientated as a horizontal menu (true creates a vertical menu).
//      10: the 'left' offset of this menu in pixels.
//       0: the 'top' offset of this menu in pixels.
//      17: the height of this menu (for vertical menus, this becomes the menu width).
//    hBar: the ItemStyle used to give this menu colours and layout/formatting.
//      '': this menu does not display within a frame (see the Frameset Example Script to do that).
//   false: this menu shows submenus on mouseover. 'true' means show on click.
//
// Most of the items are 'sm:' items popping out submenus, except the last 'js:' JavaScript command
// to pop open a new window. I've also given each item a length in pixels, overriding the ItemStyle.

//&nbsp;|
//<br />&nbsp;
// |m

startMenu('root', false, 30, -6, 15, hBar, '', false);
addItem('&nbsp;HOME&nbsp;', 'http://www.inbuonacompagnia.ch', '', null, 100);
addItem('&nbsp;IDEE&nbsp;', 'Idee', 'sm:', null, 100);
addItem('&nbsp;UNSER BAU&nbsp;', 'Bau', 'sm:', null, 120);
addItem('&nbsp;GENOSSENSCHAFT', 'Genossenschaft', 'sm:', null, 160);
addItem('&nbsp;KONTAKT & LINKS&nbsp', 'Kontakt', 'sm:', null, 160);
addItem('&nbsp;BONADUZ&nbsp;', 'Bonaduz','sm:', null, 80);




// This is a vertical menu positioned 0px across and 22px down from its trigger, and is 80px wide.
// The URLs are set to # here, be sure to replace them with your path/file names or JS functions!
// Also note how the types are '', indicating these links open in the current frame/window.
// The last item here changes its text on mouseover (^ separates the two strings), links to my site,
// and has a custom ItemStyle and length specified so it's longer than the rest.

startMenu('Idee', true, 0, 22, 140, subM, '', false);
addItem('&nbsp;Architektur', 'http://www.inbuonacompagnia.ch/site09/Bauprojekt/Bauprojekt.html', '');
addItem('&nbsp;Was wir wollen...','http://www.inbuonacompagnia.ch/site09/Bauprojekt/WasWirWollen.html', '');
addItem('&nbsp;unsere<br/> &nbsp;Wohnphilosophie', 'http://inbuonacompagnia.ch/site09/Bauprojekt/Wohnphilosophie.html', '',subMbreit1);
addItem('&nbsp;Gute Gr&uuml;nde zum <br/> &nbsp;Mitmachen...', 'http://www.inbuonacompagnia.ch/site09/guteGruende/guteGruende.html','',subMbreit1);



startMenu('Bau', true, 0, 22, 140, subM, '', false);
addItem('&nbsp;Pl&auml;ne', 'http://inbuonacompagnia.ch/site09/Bauprojekt/ibcPlaeneSept09.html', '', subM);
addItem('&nbsp;Wohnungsbelegung', 'http://inbuonacompagnia.ch/site09/Vermietung/WngBelegung3.html', '', subM);
addItem('&nbsp;Geschichte<br/> &nbsp;des Projektes', 'http://inbuonacompagnia.ch/site09/Bauprojekt/Baugeschichte.html', '', subMbreit1);




startMenu('Genossenschaft', true, 0, 22, 140, subM, '', false);
addItem('&nbsp;Wer wir sind', 'http://inbuonacompagnia.ch/site09/Wer%20wir%20sind/WerWirSind.html', '');
addItem('&nbsp;der Vorstand ', 'http://inbuonacompagnia.ch/site09/Wer%20wir%20sind/Vorstand.html', '');
addItem('&nbsp;Das ABC einer &nbsp;Genossenschaft ', 'http://inbuonacompagnia.ch/site09/Wer%20wir%20sind/ABCderGenossenschaft.html', '', subMbreit1);
addItem('&nbsp;Gesellschaftliche<br/> &nbsp;Entwicklung', 'http://inbuonacompagnia.ch/site09/Bauprojekt/GesellschaftlicheEntwicklg.html', '', subMbreit1);
addItem('&nbsp;Statuten der <br/>&nbsp;Genossenschaft', 'http://inbuonacompagnia.ch/site09/Materialien/Genossenschaft/ibc Statuten rev. 22.9.08.pdf', '', subMbreit1);
addItem('&nbsp;interne Seiten', 'http://inbuonacompagnia.ch/site09/Wer wir sind/Intern Material/weiterIntern.html', '', subM);



startMenu('Kontakt', true, 0, 22, 140, subM, '', false);
addItem('&nbsp;Links zu verwandten<br/>&nbsp;Themen ', 'http://inbuonacompagnia.ch/site09/Bauprojekt/Links.html', '',subMbreit1);
addItem('&nbsp;der Vorstand ', 'http://inbuonacompagnia.ch/site09/Wer%20wir%20sind/Vorstand.html', '');






startMenu('Gruende', true, 140, 1, 142, subM, '', false);
addItem('&nbsp;7 gute Gr&uuml;nde', 'http://www.inbuonacompagnia.ch/site09/guteGruende/guteGruende.html','', subM);
addItem('&nbsp;zukunftsorientiertes<br/> &nbsp;Wohnen', 'http://www.inbuonacompagnia.ch/site09/guteGruende/guteGruendeWohnen.html','', subMbreit1);
addItem('&nbsp;Minergie P Standard', 'http://inbuonacompagnia.ch/site09/guteGruende/guteGruendeMinergieP.html','',  subM);
addItem('&nbsp;altersgerecht<br/> &nbsp;und hindernisfrei', 'http://inbuonacompagnia.ch/site09/guteGruende/guteGruendeAltergerecht.html','', subMbreit1);
addItem('&nbsp;Hausgemeinschaft', 'http://inbuonacompagnia.ch/site09/guteGruende/guteGruendeHausgemeinschaft.html','',  subM);addItem('&nbsp;Genossenschaft', 'http://inbuonacompagnia.ch/site09/guteGruende/guteGruendeGenossenschaft.html','',  subM);
addItem('&nbsp;Gartenlandschaft', 'http://inbuonacompagnia.ch/site09/guteGruende/guteGruendeGarten.html','',  subM);
addItem('&nbsp;Bonaduz', 'http://inbuonacompagnia.ch/site09/guteGruende/guteGruendeBonaduz.html','',  subM);

startMenu('Bonaduz', true, 0, 22, 140, subM, '', false);
addItem('&nbsp;Warum Bonaduz ?', 'http://inbuonacompagnia.ch/site09/Bonaduz/Bonaduz.html', '', subM);


// This 'mHelp' menu is aligned slightly left of its trigger (-10px).
// Instead of using spaces to indent, consider 'text-indent' in the stylesheet class perhaps?
// The last item is an example of adding extra optional parameters to the addItem() command.
// It uses the subM ItemSyle (regardless of what the rest of this menu uses), is 22px long,
// has 0px spacing after it, and a lesser-than-sign popout indicator positioned 3px from the left
// edge of this item. Note that the parameters after the ItemStyle name are in the same order as
// the ItemStyle command itself, and you can have as many as you want (e.g. background colours).

startMenu('mHelp', true, -10, 22, 80, subM, '', false);
addItem('&nbsp; &nbsp; Contents', '#', '');
addItem('&nbsp; &nbsp; Search', '#', '');
addItem('&nbsp; &nbsp; About', 'mAbout', 'sm:', subM, 22, 0, '&lt;', 3);


// 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, 85, 0, 120, button, '', false);
addItem('Recent Doc 1:<br />Schedule', '#', '', button, 35);
addItem('Recent Doc 2:<br />Cunning Plan', '#', '', button, 35, 5);
addItem('Etc. etc...', '#', '', subM);

// 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('Leftwards!<br>And up!', '#', '', subM, 40);


// HIDE OR SHOW DELAYS (in milliseconds) can be customised. Defaults are:
showDelay = 0;
hideDelay = 500;
// Specify hideDelay as zero if you want to disable autohiding, and showDelay as a couple of
// hundred if you don't want the menus showing instantaneously when moused over.

// HIDE MENUS ON DOCUMENT CLICK: Try uncommenting this, and perhaps set hideDelay to zero:
//hideDocClick = true;

// You can assign 'oncreate' events to specific menus. By default, the script has only one for
// the root menu that shows it when it is created. You may wish to change it to something like the
// following, which uses the animation function to show the menu, or delay its show altogether.
//menu.root[0].oncreate = function() { pMenu.doVis('root', true) }

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

}





// CREATE ANOTHER MENU OBJECT here if you want multiple menus on a page, or you can just
// duplicate this entire file and rename 'pMenu' to something else.
// Every menu object MUST have a menu named 'root' in it, as that's always visible.

//var anotherMenu = new PopupMenu('anotherMenu');
//with (anotherMenu)
//{
// startMenu('root', .....);
// ... make menus here ...
//}




// ******************** MENU EFFECTS ********************
//
// Now you've created a basic menu object, you can add optional effects like borders and
// shadows to specific menus. You can remove this section entirely if you want, the
// functions called are found at the bottom of this file.



// BORDER: Added to all menus in a named object using a specified ItemStyle. The syntax is:
//  addMenuBorder(menuObject, ItemStyle,
//   opacity of border, 'border colour', border width, 'padding colour', padding width);
// Opacity is a number from 0 to 100, or null for solid colour (just like the ItemStyles).

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



// DROPSHADOW: added to specific ItemStyles again. The syntax is similar, but later on you
// pass arrays [...] for each layer of the shadow you want. I've used two grey layers
// here, but you can use as many or as few as you want. The syntax for the layers is:
//  [opacity, 'layer colour', X offset, Y offset, Width Difference, Height difference]
// Opacity is from 0 to 100 (or null to make it solid), and the X/Y offsets are the
// distance in pixels from the menu's top left corner to that shadow layer's corner.
// The width/height differences are added or subtracted to the current menu size, for
// instance the first layer of this shadow is 4px narrower and shorter than the menu
// it is shadowing.

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]);



// ANIMATION SETTING: We add this to the 'pMenu' menu object for supported browsers.
// IE4/Mac and Opera 5/6 don't support clipping, and Mozilla versions prior to 1.x (such as
// Netscape 6) are too slow to support it, so I'm doing some browser sniffing.
// If you don't want animation, delete this entirely, and the menus will act normally.
// Change the speed if you want... it's the last number, between -100 and 100, and is
// defined as the percentage the animation moves each frame (defaults are 10 and 15).

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)');
}








