// Define Main Menu ItemStyle
// Items in ItemStyle:
//		width (pixels)
//		gaps (pixels)
// 		popout indicator (e.g., null string or &gt)
//		popout indicator position (pixels)
//		padding of text within items (pixels)
//		background color
//		hover color
//		CSS class for the menu text normal
//		CSS class for the menu text highlighted
//		CSS class for border normal
//		CSS class for border highlighted
//		button opacity when normal (0 transparent to 100 [or null] for opaque)
//		opacity when highlighted
//		cursor type for link
//		cursor type for submenu
var PopInd = "-->"

var hBar = new ItemStyle(40, 10, '', 0, 2, '15#5568A5', '10#6699CC', 'highText', 'highText', 'itemBarBorder', 'itemBarBorder', null, null, 'hand', 'default');

var subM = new ItemStyle(22, 0, PopInd, -22, 2, '#CCCCDD', '#6699CC', 'lowText', 'highText',
 'itemBorder', 'itemBorder', null, null, 'hand', 'default');

var subBlank = new ItemStyle(22, 1, '&gt;', -15, 3, '#CCCCDD', '#6699CC', 'lowText', 'highText',
 'itemBorderBlank', 'itemBorder', null, null, 'hand', 'default');

// Here's what the values in the next startMenu() command mean, in order:
//  'root': the name of this menu.
//   false: oriented horizontally ('true' creates a vertical menu).
//      10: the 'left' offset of this menu in pixels.
//       3: the 'top' offset of this menu in pixels.
//      22: 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: 'false' means 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. Final number is a length in pixels, overriding the ItemStyle.

// Create the PopupMenu() object, and pass its own name so it can reference itself later on.
var pMenu = new PopupMenu('pMenu');
with (pMenu)
{
startMenu('root', false, 10, 3, 22, hBar, '', false);
addItem('Home', 'index.php', '', null, 50);
addItem('About Us', 'mAboutUs', 'sm:', null, 70);
addItem('Hear Us', 'mHearUs', 'sm:', null, 65);
addItem('Sing With Us', 'mSingWithUs', 'sm:', null, 95);
//addItem('News', 'mNews', 'sm:', null, 45);
addItem('Contact Us', 'Contacts.html', '', null, 75);
addItem('Members Only', 'password_protect/index.php', '', null, 95);
addItem('Harmony Explosion', 'HX/HX.php', '', null, 120);

	startMenu('mAboutUs', true, 5, 22, 130, subM, '', false); //vertical menu, offset 5 right and 22 down from parent, 130 wide
	addItem('Singing Is Life', 'Singing_Is_Life.html', '', null);
	addItem('Our Chorus', 'mChorus', 'sm:', null);
	addItem('Our Quartets', 'mQuartets', 'sm:', null);
	//addItem('What Is Barbershop <BR>&nbsp &nbsp &nbsp Harmony?', 'Barbershop Harmony.html', '', null, 40);
	//addItem('Our Society', 'BHS.html', '', null);

		startMenu('mChorus', true, 135, 5, 145, subM, '', false); //vertical menu, offset 135 right is 5 more than width (130) of parent, offset 5 down, 145 wide
		addItem('Director', 'mDirector', 'sm:', null);
		addItem('Associate Directors', 'mAssocDirs', 'sm:', null); 
		//addItem('Members', 'Members.html', '', null);
		//addItem('Repertoire', 'Repertoire.html', '', null);

			startMenu('mDirector', true, 150, 5, 120, subM, '', false);
			addItem('Dr. Rob Hopkins', 'RobHopkins.html', '', null);
			
			startMenu('mAssocDirs', true, 150, 5, 120, subM, '', false);
			addItem('Don Drake', 'DonDrake.html', '', null);
			addItem('Chaz Zelows', 'ChazZelows.html', '', null);

		startMenu('mQuartets', true, 135, 5, 135, subM, '', false);
		addItem('Bravo!', 'Bravo.php', '', null);
		addItem('Lost Horizons', 'LostHorizons.html', '', null);
		addItem('Full Circle', 'FullCircle.html', '', null);
		addItem('Firestorm', 'Firestorm.php', '', null);
		addItem('The Roman Rogues', 'RomanRogues.html', '', null);
		addItem('7th Dimension', '7thDimension.php', '', null);
		addItem('Canal Street', 'CanalStreet.html', '', null);

	startMenu('mHearUs', true, 5, 22, 120, subM, '', false);
	//addItem('Hire Us for your Event', 'HireUs.html', '', null);
	addItem('Upcoming Shows', 'mShows', 'sm:', null);
	//addItem('Singing Valentines', 'SingingValentines.html', '', null);
	
		startMenu('mShows', true, 125, 5, 200, subM, '', false);
		addItem('May 15, 2010 -<BR>&nbsp; &nbsp; "Wait! Wait! Please Tell Me"', 'mShow', 'sm:', null,40);  //use 40 as height for a 2-line item
			startMenu('mShow', true, 205, 5, 160, subM, '', false);
			addItem('Poster', 'ShowPoster.pdf', '', null);
			//addItem('Poster-dbl 8.5x11', 'ShowPoster-2X_letter.pdf', '', null);
			//addItem('Poster-dbl 8.5x14', 'ShowPoster-2X_legal.pdf', '', null);
			addItem('Flyer/Ticket Order Form', 'ShowFlyer.pdf', '', null);

	startMenu('mSingWithUs', true, 5, 22, 140, subM, '', false);
	addItem('Rehearsal Information', 'RehearsalInfo.html', '', null);

	//startMenu('mNews', true, 5, 22, 90, subM, '', false);
	//addItem('Press Releases', 'PressReleases.html', '', null);
	//addItem('The Pitch', 'Pitch.html', '', null);

	//startMenu('mContactUs', true, 5, 22, 185, subM, '', false);
	//addItem('Contact New Horizons Chorus', 'Contacts.html', '', null);

}

addMenuBorder(pMenu, window.subBlank, null, '#666666', 1, '#CCCCDD', 2);
addDropShadow(pMenu, window.subM, [60,"#346A9C",3,3,0,0], [40,"black",6,6,0,0]);
addDropShadow(pMenu, window.subBlank, [60,"#346A9C",3,3,0,0], [40,"black",6,6,0,0]);

// HIDE OR SHOW DELAYS (in milliseconds) can be customised. Defaults are:
showDelay = 300;
hideDelay = 300;
// 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.


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




// 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+'%; 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];
   // Safari 1.2 bug: it inherits alpha values SIDEWAYS!?!? What were they thinking?
   var alpha = (s[0]!=null && navigator.userAgent.indexOf('AppleWebKit') == -1);
   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)+'; '+
    (alpha?'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;
 }
};
