var rootBar = new ItemStyle(0, 0, '', 0, 0, '', '', 'PrimaryNavText', 'PrimaryNavHover', '', '', null, null, 'hand', 'default');
var hBar1 = new ItemStyle(0, 28, '', 0, 0, '#FFFFFF', '#ffffff', 'PrimaryNavText', 'PrimaryNavHover', '', '', null, null, 'hand', 'default');
var hBar2 = new ItemStyle(0, 30, '', 0, 0,'#FFFFFF', '#003366', 'PrimaryNavText', 'PrimaryNavHover', '', '', null, null, 'hand', 'default');
var hBar3 = new ItemStyle(0, 30, '', 0, 0, '#FFFFFF', '#003366', 'PrimaryNavText', 'PrimaryNavHover', '', '', null, null, 'hand', 'default');
var hBar4 = new ItemStyle(0, 30, '', 0, 0, '#FFFFFF', '#003366', 'PrimaryNavText', 'PrimaryNavHover', '', '', null, null, 'hand', 'default');
var hBar5 = new ItemStyle(0, 30, '', 0, 0, '#FFFFFF', '#003366', 'PrimaryNavText', 'PrimaryNavHover', '', '', null, null, 'hand', 'default');
var hBar6 = new ItemStyle(0, 30, '', 0, 0, '#FFFFFF', '#003366', 'PrimaryNavText', 'PrimaryNavHover', '', '', null, null, 'hand', 'default');

var subM = new ItemStyle(30, 0, '', -15, 2, '#F6EEC7', '#990000', 'PrimaryNavText', 'PrimaryNavHover', 'PrimaryNavBorder', 'PrimaryNavBorder', 80, 100, 'hand', 'default');
var subM2 = new ItemStyle(20, 0, '', -15, 2, '#F6EEC7', '#990000', 'PrimaryNavText', 'PrimaryNavHover', 'PrimaryNavBorder', 'PrimaryNavBorder', 80, 100, 'hand', 'default');
var pMenu = new PopupMenu('pMenu');

with (pMenu)
{
startMenu('root', true, '0', 122, 0, rootBar);
//startMenu('root', false, '', 105, 0, rootBar);

addItem('<A HREF="http://www.bermanauctions.com/calendar.html"><IMG SRC="http://www.bermanauctions.com/images/calendar_off.jpg" BORDER="0" ALT="Calendar"></A>', 'Calendar', 'sm:', hBar1);
addItem('<A HREF="http://www.bermanauctions.com/services.html"><IMG SRC="http://www.bermanauctions.com/images/services_off.jpg" BORDER=0 ALT="Services"></a>', 'Services','sm:', hBar1);
addItem('<A HREF="http://www.bermanauctions.com/about.html"><IMG SRC="http://www.bermanauctions.com/images/about_off.jpg" BORDER=0 ALT="Programs"></A>', 'About', 'sm:', hBar1);
addItem('<A HREF="http://www.bermanauctions.com/contact.html"><IMG SRC="http://www.bermanauctions.com/images/contact_off.jpg" BORDER=0 ALT="Contact"></A>', 'Contact', 'sm:', hBar1);
addItem('<A HREF="http://www.bermanauctions.com/bid.html"><IMG SRC="http://www.bermanauctions.com/images/bid_off.jpg" BORDER=0 ALT="How to Bid"></A>', 'Bid', 'sm:', hBar1);
addItem('<A HREF="http://www.bermanauctions.com/offerings.html"><IMG SRC="http://www.bermanauctions.com/images/offerings_off.jpg" BORDER=0 ALT="Offerings"></A>', 'Offerings', 'sm:', hBar1);
addItem('<A HREF="http://www.bermanauctions.com/index.html"><IMG SRC="http://www.bermanauctions.com/images/home_off.jpg" BORDER=0 ALT="Home"></A>', '', 'sm:', hBar1);


startMenu('Calendar', true, 150, 0, 125, subM);
addItem('Worcester, MA <BR>TBA', 'http://www.bermanauctions.com/millbury_street/index.html', '');
addItem('Harvard, MA <BR>TBA', 'http://www.bermanauctions.com/harvard/index.html', '');
addItem('Bolton, MA <BR>TBA', 'http://www.bermanauctions.com/bolton1/index.html', '');
addItem('Auburn, MA <BR>TBA', 'http://www.bermanauctions.com/auburn/index.html', '');
addItem('Millbury, MA <BR>TBA', 'http://www.bermanauctions.com/millbury1/index.html', '');
addItem('Worcester, MA <BR>January 5, 2005', 'http://www.bermanauctions.com/stafford_street/index.html', '');
addItem('Worcester, MA <BR>January 18, 2005', 'http://www.bermanauctions.com/sears_island/index.html', '');
addItem('Lowell, MA <BR>January 19, 2005', 'http://www.bermanauctions.com/lowell/index.html', '');
addItem('Natick, MA <BR>January 19, 2005', 'http://www.bermanauctions.com/natick/index.html', '');
addItem('New Bedford, MA <BR>January 19, 2005', 'http://www.bermanauctions.com/new_bedford/index.html', '');
addItem('Winchester, MA <BR>January 19, 2005', 'http://www.bermanauctions.com/winchester/index.html', '');


startMenu('Services', true, 150, 0, 125, subM2);
addItem('Appraisal Services', 'http://www.bermanauctions.com/appraisals.html', '');
addItem('Real Estate Services', 'http://www.bermanauctions.com/real_estate.html', '');
addItem('Merchandise Services', 'http://www.bermanauctions.com/merchandise.html', '');


startMenu('About', true, 150, 0, 125, subM2);
addItem('History', 'http://www.bermanauctions.com/history.html', '');
addItem('Credentials', 'http://www.bermanauctions.com/credentials.html', '');
addItem('Experience', 'http://www.bermanauctions.com/experience.html', '');


startMenu('Contact', true, 150, 0, 125, subM2);
addItem('Mail List', 'http://www.bermanauctions.com/mail_list.html', '');
addItem('Comments', 'http://www.bermanauctions.com/comments.html', '');
addItem('Contact Info', 'http://www.bermanauctions.com/contact.html', '');


startMenu('Bid', true, 150, 0, 125, subM);
addItem('How to Bid<BR>on Real Estate', 'http://www.bermanauctions.com/bid_real_estate.html', '');
addItem('How to Bid<BR>on Merchandise', 'http://www.bermanauctions.com/bid_merchandise.html', '');

startMenu('Offerings', true, 150, 0, 125, subM2);
addItem('Real Estate', 'http://www.bermanauctions.com/re_offerings.html', '');
addItem('Merchandise', 'http://www.bermanauctions.com/merch_offerings.html', '');


}


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

//addDropShadow(pMenu, window.subM,
// [40,"#666666",6,6,-10,-10], [40,"#666666",4,4,0,0]);
//addDropShadow(pMenu, window.subBlank,
// [40,"#666666",6,6,-10,-10], [40,"#666666",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)
{
 // Write menus now in non-NS4 browsers, by calling the "Fast" mode .update(true) method.
 pMenu.update(true);
 //anotherMenu.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();
 //anotherMenu.position();
}

window.onscroll = function()
{
 pMenu.position();
 //anotherMenu.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);
}

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)
 {
  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)
{
 // 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)
{

 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;
 }
}
//--></script>


