

var hBar = new ItemStyle(40, 0, '', 0, 0, '#000066', '#990033', 'highText', 'highText', '', '',
 null, null, 'hand', 'default');

var subM = new ItemStyle(22, 0, '&gt;', -15, 3, '#CCCCDD', '#990033', 'lowText', 'highText',
 'itemBorder', 'itemBorder', 100, 100, 'hand', 'default');

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

var button = new ItemStyle(22, 1, '&gt;', -15, 2, '#006633', '#CC6600', 'buttonText', 'buttonHover',
 'buttonBorder', 'buttonBorderOver', 80, 95, 'crosshair', 'default');


var pMenu = new PopupMenu('pMenu');

// adjusts center alignment for 10 pixel width browser scroll bar
var scrolladjust = 10;


// Additional browser support available by adding navigator.appName statement

if (navigator.userAgent.indexOf("Firefox")!=-1) {
	var winW = window.innerWidth;
} else if (navigator.appName=="Netscape") {
  var winW = window.innerWidth;
		scrolladjust =8;
} else if (navigator.userAgent.indexOf("Opera")!=-1) {
	var winW = window.innerWidth; 
	scrolladjust = 8;
} else if (navigator.appName.indexOf("Microsoft")!=-1) {
  var winW = document.body.offsetWidth;

 } 

with (pMenu)
{



startMenu('root', false, '(winW/2 - pMenu.menu.root[0].menuW/2) - scrolladjust ', 120, 18, hBar); // Centres.

addItem('<IMG SRC="http://www.calsalmon.org/images/layout/layout_04.gif" WIDTH=99 HEIGHT=18 ALT="About SRF">', 'mAbout', 'sm:', '', 99);
addItem('<IMG SRC="http://www.calsalmon.org/images/layout/layout_05.gif" WIDTH=170 HEIGHT=18 ALT="Training Opportunities">', 'mTraining', 'sm:', '', 170);
addItem('<IMG SRC="http://www.calsalmon.org/images/layout/layout_06.gif" WIDTH=57 HEIGHT=18 ALT="Tools">', 'mTools', 'sm:', '', 57);
addItem('<IMG SRC="http://www.calsalmon.org/images/layout/layout_07.gif" WIDTH=86 HEIGHT=18 ALT="Advocacy">', 'mAdvocacy', 'sm:', '', 86);
addItem('<IMG SRC="http://www.calsalmon.org/images/layout/layout_08.gif" WIDTH=103 HEIGHT=18 ALT="Support">', 'mSupport', 'sm:', '', 103);
addItem('<IMG SRC="http://www.calsalmon.org/images/layout/layout_09.gif" WIDTH=96 HEIGHT=18 ALT="Newsletters">', 'mNewsletters', 'sm:', '', 96);
addItem('<IMG SRC="http://www.calsalmon.org/images/layout/layout_10.gif" WIDTH=124 HEIGHT=18 ALT="Conference">', 'mConference', 'sm:', '', 124);

startMenu('mAbout', true, 1, 17, 90, subM);

addItem('Overview', 'http://www.calsalmon.org/about.html', '');
addItem('Board bios', 'http://www.calsalmon.org/board-members.html', '');
addItem('Contact info', 'http://www.calsalmon.org/contact-us.html', '');
// addItem('History', '#', '');
// addItem('Pictures', '#', '');

startMenu('mTraining', true, 1, 17, 145, subM);
addItem('Job Board', 'http://www.calsalmon.org/jobboard.html', '');
addItem('Field Schools', 'http://www.calsalmon.org/fs/index.html', '');

//addItem('3nd Annual Spring-Run', 'http://www.calsalmon.org/training/river_dive.html', '');
// addItem('Central Coast Field School', '#', '');
// addItem('North Coast Field School', '#', '');


startMenu('mTools', true, 1, 17, 330, subM);

addItem('Limiting Factors', 'http://www.calsalmon.org/tools/limiting-factor.htm', '');
addItem('Fish-friendly road improvements and culvert replacements', 'http://www.calsalmon.org/tools/roads/roads.htm', '');
addItem('Fisheries Data Sources', 'http://www.calsalmon.org/fisheriesdata.htm', '');
addItem('Water Quality', 'http://www.calsalmon.org/tools/water-quality.htm', '');
addItem('Watershed Forum', 'http://www.calsalmon.org/tools/watershed-forum.htm', '');
addItem('Permitting tips', 'http://www.calsalmon.org/restoration-permitting-tips.htm', '');
addItem('Water Conservation Information', 'http://www.calsalmon.org/tools/water-conservation.htm', '');
addItem('Dam Removal', 'http://www.calsalmon.org/tools/dam-removal.htm', '');
addItem('Links', 'http://www.calsalmon.org/links.html', '');
addItem('Fisheries and Watershed Links', 'http://www.calsalmon.org/fisherieswatershed.htm', '');
addItem('Watershed and Salmon Education', 'http://www.calsalmon.org/watershedandsalmon.htm', '');
//addItem('Directory of restoration practitioners', '#');

startMenu('mAdvocacy', true, 1, 17, 220, subM);
addItem('Federal Stimulus Action Alert', 'http://www.calsalmon.org/advocacy/fedstim.htm', '');
addItem('Free the Bond Freeze', 'http://www.calsalmon.org/advocacy/bondfreeze.htm', '');
addItem('Save the CCC', 'http://www.calsalmon.org/advocacy/saveccc.htm', '');
addItem("Urgent 2006 Water Bond", 'http://www.calsalmon.org/advocacy/alert0306.htm', '');
addItem("Fish Passage Legislation", 'http://www.calsalmon.org/advocacy/fish-passage-legislation.htm', '');
addItem("Sustained State Restoration Funding", 'http://www.calsalmon.org/advocacy/state_res_fund.htm', '');
addItem("Critical Habitat", 'http://www.calsalmon.org/advocacy/critical-habitat.htm', '');
addItem("NOAA's Policies", 'http://www.calsalmon.org/advocacy/NOAA-Hatchery-Policy/index.htm', '');
addItem('Prevailing Wage', 'http://www.calsalmon.org/advocacy/prevailing-wage/prevailing-wage.html', '');
addItem('Past Alerts', 'http://www.calsalmon.org/past-alerts.html', '');

//addItem('Directory of CA Legislators', '#', '');
//addItem('CA Watershed Legislation Day', '#', '');

startMenu('mSupport', true, 1, 17, 150, subM);
addItem('Merchandise', 'http://www.calsalmon.org/merchandise.html', '');
addItem('Membership Information', 'http://www.calsalmon.org/membership.html', '');
addItem('Make a Contribution', 'https://www.calsalmon.org/cart/index.php?main_page=product_info&cPath=9&products_id=35', '');
addItem('Enter the Shopping Cart', 'https://www.calsalmon.org/cart/', '');
//addItem('Bequest Information', '#', '');

startMenu('mNewsletters', true, 1, 17, 150, subM);

addItem('Newsletters', 'http://www.calsalmon.org/newsletter.html', '');
addItem('E-Newsletter Sign Up', 'http://www.calsalmon.org/enewsletters/subscribe.htm', '');
addItem('Archive of E-Newsletters', 'http://www.calsalmon.org/enewsletters/archive.htm', '');



startMenu('mConference', true, 1, 17, 190, subM);
addItem('2009 Conference Presentations', 'http://www.calsalmon.org/conference/2009/archive.htm', '');
addItem('2009 Conference Agenda', 'http://www.calsalmon.org/pdf/SRF_NwsltrSummer2008_5-11 proof.pdf', '');
addItem('2009 Workshops and Tours', 'http://www.calsalmon.org/conference/2009/Field_Tours.htm', '');
addItem('2008 Conference Archive', 'http://www.calsalmon.org/conference/2008/archive.htm', '');
addItem('2008 Conference Proceedings', 'http://www.calsalmon.org/pdf/SRF 2008Proceeding_complete.pdf', '');
addItem('2007 Conference Archive', 'http://www.calsalmon.org/conference/2007/archive.htm', '');
addItem('2007 Conference Proceedings', 'http://www.calsalmon.org/pdf/SRF_Proceedings_07.pdf', '');
addItem('2006 Conference Archive', 'http://www.calsalmon.org/conference/2006/archive.htm', '');
addItem('2006 Conference Proceedings', 'http://www.calsalmon.org/pdf/SRF_Proceedings_06.pdf', '');
addItem('2005 Conference Archive', 'http://www.calsalmon.org/conference/2005/archive.htm', '');
addItem('2005 Conference Proceedings', 'http://www.calsalmon.org/pages/page-2', '');

//addItem('PDFs of program', '#', '');
//addItem('Searchable database of proceedings', '#', '', '', 35);



}




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


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



if (!isOp && navigator.userAgent.indexOf('rv:0.')==-1)
{
 pMenu.showMenu = new Function('mN','menuAnim(this, mN, 30)');
 pMenu.hideMenu = new Function('mN','menuAnim(this, mN, -30)');

}


// *** (4) EVENTS ***

if (!isNS4)
{
 pMenu.update(true);
}
else
{
 var popOldOL = window.onload;
 window.onload = function()
 {
  if (popOldOL) popOldOL();
  pMenu.update();
 }
}



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

window.onscroll = function()
{
 pMenu.position();
}


// NS4 can't reliably capture clicks on layers, so here's a workaround.
if (isNS4)
{
 document.captureEvents(Event.CLICK);
 document.onclick = function(evt)
 {
  with (pMenu) if (overI) click(overM, overI);
  //with (anotherMenu) if (overI) click(overM, overI);
  return document.routeEvent(evt);
 }
}

// Activate the window.onscroll() event in non-Microsoft browsers.
if (!isIE || isOp)
{
 var nsPX=pageXOffset, nsPY=pageYOffset;
 setInterval('if (nsPX!=pageXOffset || nsPY!=pageYOffset) ' +
 '{ nsPX=pageXOffset; nsPY=pageYOffset; window.onscroll() }', 50);
}






// *** (5) OPTIONAL CODE ***   DELETE IF YOU'RE NOT USING THESE!



function menuAnim(menuObj, menuName, dir)
{
 var mD = menuObj.menu[menuName][0];
 if (!mD.timer) mD.timer = 0;
 if (!mD.counter) mD.counter = 0;

 with (mD)
 {
  // Stop any existing animation.
  clearTimeout(timer);

  if (!lyr || !lyr.ref) return;
  if (dir>0) lyr.vis('visible');
  lyr.sty.zIndex = 1001 + dir;
  lyr.clip(0, 0, menuW+2, (menuH+2)*Math.pow(Math.sin(Math.PI*counter/200),0.75) );
  if ((isDOM&&!isIE) && (counter>=100)) lyr.sty.clip='';

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

function addMenuBorder(mObj, iS, alpha, bordCol, bordW, backCol, backW)
{
 for (var mN in mObj.menu)
 {
  var mR=mObj.menu[mN], dS='<div style="position:absolute; background:';
  if (mR[0].itemSty != iS) continue;
  for (var mI=1; mI<mR.length; mI++)
  {
   mR[mI].iX += bordW+backW;
   mR[mI].iY += bordW+backW;
  }
  mW = mR[0].menuW += 2*(bordW+backW);
  mH = mR[0].menuH += 2*(bordW+backW);

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



