// Cascading Popup Menus v5.2 - Single Frame Menu example script.
 
var hBar = new ItemStyle(65, 5, '', 0, 0, '/images/menubarback2.png', '/images/menubarover2.png', 'highText', 'highText2', '', '',
 null, null, 'hand', 'default'); 
var button = new ItemStyle(26, 1, '<div class="arrow">4</div>', -15, 2, '/images/Logo-Gradient4.png', '/images/Logo-Gradient4-C45.png', 'buttonText', 'buttonHover', 'buttonBorder', 'buttonBorderOver', 100, 100, 'hand', 'hand');
var button2 = new ItemStyle(40, 1, '<div class="arrow">4</div>', -15, 2, '10#FFFFFF', '10#FFCC88', 'buttonText', 'buttonHover',
 'buttonBorder', 'buttonBorderOver', 100, 100, 'hand', 'hand');
var pdfwindowoptions = "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes";

// 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)
{
startMenu('root', false, 10, 'page.elmPos("menubarpos").y', 29, hBar, '', false);
//with(addItem('&nbsp; SITE', 'mSite', 'sm:', null, 40, 5)) onclick='window.location.href="/site/"';
addItem('&nbsp; SITE', 'mSite', 'sm:', null, 42, 5);
addItem('&nbsp; CAPACITY', 'mCapacity', 'sm:', null, 84, 5);
addItem('&nbsp; # AXLES', 'mAxles', 'sm:', null, 78, 5);
addItem('&nbsp; DECK STYLE', 'mDeck', 'sm:', null, 100, 5);
addItem('&nbsp; TRAILER USE', 'mUse', 'sm:', null, 110, 5);
addItem('&nbsp; MERCHANDISE', '/merchandise.php', '', null, 120, 5);
addItem('&nbsp; SEARCH', '/trailers.php', '', null, 70, 5);
//addItem('&nbsp; CONTACT', 'mContact', 'sm:', null, 80, 5);
with(addItem('&nbsp; CONTACT', 'mContact', 'sm:', null, 80, 5)) onclick='window.location.href="/contact_us.php"';
addItem('&nbsp; LOGIN', '/login.php', '', null, 60, 5);

//SITE
startMenu('mSite', true, 0, 29, 260, button, '', false);
addItem('&nbsp; Home', '/', '');
addItem('&nbsp; Featured Trailers', 'mFeatured', 'sm:');
addItem('&nbsp; Optional Equipment Photo Gallery', 'mOptional', 'sm:');
addItem('&nbsp; ROGERS Dealers', '/dealers.php', '');
addItem('&nbsp; Trailer Colors', '/trailer-colors.php', '');
addItem('&nbsp; ROGERS Press Releases', '/press_releases/', '');
addItem('&nbsp; ROGERS Ads', 'mAds', 'sm:');
addItem('&nbsp; ROGERS History', 'mHistory', 'sm:');
addItem('&nbsp; e-Newsletter Signup', '/signup.php', '');
addItem('&nbsp; Glossary', '/glossary/', '');
addItem('&nbsp; No-Foot Gooseneck Video', '/video-no-foot-gooseneck.php', '');

//FEATURED
startMenu('mFeatured', true, 260, 2, 180, button, '', false);
addItem('&nbsp; Detachable Gooseneck', '/trailers.php?&tt=1', '');
addItem('&nbsp; Fixed Gooseneck', '/trailers.php?&tt=2', '');
addItem('&nbsp; Tag-Along', '/trailers.php?&tt=3', '');
addItem('&nbsp; Specialized', '/trailers.php?&tt=4', '');

//OPTIONAL
startMenu('mOptional', true, 260, 2, 180, button, '', false);
addItem('&nbsp; Detachable Gooseneck', '/options.php?&tt=1', '');
addItem('&nbsp; Fixed Gooseneck', '/options.php?&tt=2', '');
addItem('&nbsp; Tag-Along', '/options.php?&tt=3', '');

//HISTORY
startMenu('mHistory', true, 260, 2, 380, button, '', false);
addItem('&nbsp; Brief Company History', '/history/', '');
//addItem('&nbsp; ROGERS - Then and Now (2003)', '/history/historybook.php', '');
addItem('&nbsp; <img src="/pdf/pdf16.png" width="16" height="16" alt="PDF Icon 16" align="absmiddle" border="0"> ROGERS - Then and Now (2005) [6.6MB PDF]', 'window.open("/history/History-of-Rogers-Brothers.pdf","_blank",pdfwindowoptions);', 'js:');
addItem('&nbsp; Old Trailer Showcase', '/history/old_trailer_photos.php', '');
addItem('&nbsp; 100th Anniversary Open House', '/anniversary-100.php', '');

//ADS
startMenu('mAds', true, 260, 2, 240, button, '', false);
addItem('&nbsp; <img src="/pdf/pdf16.png" width="16" height="16" alt="PDF Icon 16" align="absmiddle" border="0"> Check Us Out [PDF]', 'window.open("/pdf/RogersAd-CheckUsOut.pdf","_blank",pdfwindowoptions);', 'js:');
addItem('&nbsp; <img src="/pdf/pdf16.png" width="16" height="16" alt="PDF Icon 16" align="absmiddle" border="0"> Hassle Free Hauling [PDF]', 'window.open("/pdf/RogersAd-HassleFreeHauling.pdf","_blank",pdfwindowoptions);', 'js:');
addItem('&nbsp; <img src="/pdf/pdf16.png" width="16" height="16" alt="PDF Icon 16" align="absmiddle" border="0"> Versatility by the Ton [PDF]', 'window.open("/pdf/versatility-by-the-ton.pdf","_blank",pdfwindowoptions);', 'js:');

//CAPACITY
startMenu('mCapacity', true, 0, 29, 180, button, '', false);
addItem('&nbsp; 20-ton (18.1-metric ton)', '/trailers.php?&c=20', '');
addItem('&nbsp; 21-ton (19.1-metric ton)', '/trailers.php?&c=21', '');
addItem('&nbsp; 25-ton (22.7-metric ton)', '/trailers.php?&c=25', '');
addItem('&nbsp; 35-ton (31.8-metric ton)', '/trailers.php?&c=35', '');
addItem('&nbsp; 40-ton (36.3-metric ton)', '/trailers.php?&c=40', '');
addItem('&nbsp; 50-ton (45.4-metric ton)', '/trailers.php?&c=50', '');
addItem('&nbsp; 55-ton (49.9-metric ton)', '/trailers.php?&c=55', '');
addItem('&nbsp; 60-ton (54.4-metric ton)', '/trailers.php?&c=60', '');
addItem('&nbsp; 65-ton (59.0-metric ton)', '/trailers.php?&c=65', '');
addItem('&nbsp; 75-ton (68.0-metric ton)', '/trailers.php?&c=75', '');
addItem('&nbsp; 80-ton (72.6-metric ton)', '/trailers.php?&c=80', '');
addItem('&nbsp; 100-ton (90.7-metric ton)', '/trailers.php?&c=100', '');
//addItem('&nbsp; Production Models', 'mProduction', 'sm:');
//addItem('&nbsp; Specialized Models', 'mSpecialized', 'sm:');

//PRODUCTION
/*startMenu('mProduction', true, 180, 2, 210, button, '', false);
addItem('&nbsp; 20-ton (18.1-metric ton)', '/trailers.php?&sn=5&sno=5&c=20', '');
addItem('&nbsp; 21-ton (19.1-metric ton)', '/trailers.php?&sn=5&sno=5&c=21', '');
addItem('&nbsp; 25-ton (22.7-metric ton)', '/trailers.php?&sn=5&sno=5&c=25', '');
addItem('&nbsp; 35-ton (31.8-metric ton)', '/trailers.php?&sn=5&sno=5&c=35', '');
addItem('&nbsp; 40-ton (36.3-metric ton)', '/trailers.php?&sn=5&sno=5&c=40', '');
addItem('&nbsp; 50-ton (45.4-metric ton)', '/trailers.php?&sn=5&sno=5&c=50', '');
addItem('&nbsp; 55-ton (49.9-metric ton)', '/trailers.php?&sn=5&sno=5&c=55', '');
addItem('&nbsp; 60-ton (54.4-metric ton)', '/trailers.php?&sn=5&sno=5&c=60', '');*/

//SPECIALIZED
/*startMenu('mSpecialized', true, 180, 2, 210, button, '', false);
//addItem('&nbsp; 35-ton (31.8-metric ton)', '/trailers.php?&sn=5&c=35', '');
addItem('&nbsp; 40-ton (36.3-metric ton)', '/trailers.php?&sn=5&c=40', '');
addItem('&nbsp; 50-ton (45.4-metric ton)', '/trailers.php?&sn=5&c=50', '');
addItem('&nbsp; 55-ton (49.9-metric ton)', '/trailers.php?&sn=5&c=55', '');
addItem('&nbsp; 60-ton (54.4-metric ton)', '/trailers.php?&sn=5&c=60', '');
addItem('&nbsp; 65-ton (59.0-metric ton)', '/trailers.php?&sn=5&c=65', '');
addItem('&nbsp; 75-ton (68.0-metric ton)', '/trailers.php?&sn=5&c=75', '');
addItem('&nbsp; 80-ton (72.6-metric ton)', '/trailers.php?&sn=5&c=80', '');
addItem('&nbsp; 100-ton (90.7-metric ton)', '/trailers.php?&sn=5&c=100', '');*/

//# AXLES
startMenu('mAxles', true, 0, 29, 100, button, '', false);
addItem('&nbsp; 2 Axles', '/trailers.php?&a=1', '');
addItem('&nbsp; 3 Axles', '/trailers.php?&a=2', '');
addItem('&nbsp; 4 Axles', '/trailers.php?&a=3', '');
addItem('&nbsp; 2+1 Axles', '/trailers.php?&a=9', '');
addItem('&nbsp; 2+2 Axles', '/trailers.php?&a=10', '');
addItem('&nbsp; 3+1 Axles', '/trailers.php?&a=5', '');
addItem('&nbsp; 3+2 Axles', '/trailers.php?&a=6', '');
addItem('&nbsp; 3+3 Axles', '/trailers.php?&a=8', '');
addItem('&nbsp; 4+1 Axles', '/trailers.php?&a=7', '');

//DECK STYLE
startMenu('mDeck', true, 0, 29, 130, button, '', false);
addItem('&nbsp; Platform', '/trailers.php?&ds=1', '');
addItem('&nbsp; &quot;Sloper&quot;', '/trailers.php?&ds=2', '');
addItem('&nbsp; &quot;Gentle Riser&quot;', '/trailers.php?&ds=3', '');
addItem('&nbsp; Drop Side', '/trailers.php?&ds=4', '');
addItem('&nbsp; I-Beam', '/trailers.php?&ds=5', '');
//addItem('&nbsp; Extendible', '/trailers.php?&ds=6', '');

//USE
startMenu('mUse', true, 0, 29, 170, button, '', false);
addItem('&nbsp; Crane Loading', '/trailers.php?&tu=4', '');
addItem('&nbsp; Front Loading', 'mFrontLoading', 'sm:');
addItem('&nbsp; Front &amp; Rear Loading', '/trailers.php?&tu=5', '');
addItem('&nbsp; Modular', '/trailers.php?&tu=6', '');
addItem('&nbsp; Rear Loading', 'mRearLoading', 'sm:');
addItem('&nbsp; Permanent Load', '/trailers.php?&tu=7', '');

//CONTACT
startMenu('mContact', true, 0, 29, 300, button, '', false);
addItem('&nbsp; ROGERS Dealers', '/dealers.php', '');
addItem('&nbsp; <img src="/pdf/pdf16.png" width="16" height="16" alt="PDF Icon 16" align="absmiddle" border="0"> Finance Programs [PDF]', 'window.open("/pdf/Financing.pdf","_blank",pdfwindowoptions);', 'js:');
addItem('&nbsp; Corporate Office', '/contact_us.php', '');
addItem('&nbsp; Parts & Service', '/contact_us-parts-service.php', '');
addItem('&nbsp; Request for Quote', '/contact_us-RFQ.php', '');
addItem('&nbsp; Send ROGERS Trailer Photos', '/contact_us-old-trailers.php', '');

//REAR LOADING
startMenu('mRearLoading', true, 170, 2, 155, button, '', false);
addItem('&nbsp; Tag-Along', '/trailers.php?&tu=1', '');
addItem('&nbsp; Fixed-Gooseneck', '/trailers.php?&tu=2', '');

//FRONT LOADING
startMenu('mFrontLoading', true, 170, 2, 190, button, '', false);
addItem('&nbsp; Detachable Gooseneck', '/trailers.php?&sn=5&sno=5&tu=3', '');
addItem('&nbsp; Specialized', '/trailers.php?&sn=5&tu=3', '');

//MERCHANDISE
//startMenu('mMerchandise', true, 0, 29, 190, button, '', false);
//addItem('&nbsp; ROGERS Ball Caps', '/', '');
//addItem('&nbsp; ROGERS Shirts', '/', '');
//addItem('&nbsp; Novelty Items', '/', '');
//addItem('&nbsp; Special 100th Anniversary Edition', '/', '');

showDelay = 0;
hideDelay = 10;
}

addMenuBorder(pMenu, window.subBlank, null, '#666666', 1, '#CCCCDD', 2);

addDropShadow(pMenu, window.button, [50,"#000000",4,4,0,0]);
addDropShadow(pMenu, window.button2, [50,"#000000",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 ((navigator.userAgent.indexOf('rv:0.')==-1) &&
    !(isOp&&!document.documentElement) && !(isIE4&&!window.external))
{
 pMenu.showMenu = new Function('mN','menuAnim(this, mN, 20)');
 pMenu.hideMenu = new Function('mN','menuAnim(this, mN, -30)');
}







// ******************** FUNCTIONS CALLED BY THE EFFECTS SECTION ********************


// 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};
};




// Animation:

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 (!visNow && dir>0) dir = 0-dir;
  if (dir>0) lyr.vis('visible');
  lyr.sty.zIndex = dir>0 ? mD.zIndex + 1 : 1001;
  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);
 }
};




// 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;
 }
};