
// (1) ITEMSTYLES - These define the colour and size of menu items. Required to run.
// (2) MENU DATA - These specify the text and links in the menu. Required to run.
// (3) MENU EFFECTS - Want to remove, or change borders, shadows and animation? Edit them here,
//     or you can delete this section entirely to remove extra effects.
// (4) EVENTS - Activate the menu(s), and choose creation mode (Dynamic / Fast) etc. I recommend
//     you read it, but you only really need to change it if you want multiple menus on one page,
//     or are trying to combine this with other JavaScripts. Required to run.
// (5) OPTIONAL CODE - Extra features like adding clicking to 'sm:' items or status messages on


var hBar = new ItemStyle(150, 10, '', 0, 0, '', '', 'highText', 'highText', '', '',
 null, null, 'hand', 'default');


var subM = new ItemStyle(22, 0, '&gt;', '-15', 3, '#920192', '#FF05FF', 'lowText', 'lowText',
 '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');


var button = new ItemStyle(22, 1, '&gt;', -15, 2, '#66ff00', '#CC6600', 'buttonText', 'buttonHover',
 'buttonBorder', 'buttonBorderOver', 80, 95, 'crosshair', 'default');




var pMenu = new PopupMenu('pMenu');
with (pMenu)
{

// *** MOVE OR CENTRE THE MENU HERE ***


var tmpTop = 4;
var offsetSubTop = 0;

// special case for the searcg.cgi in windows
	if ((navigator.platform.toLowerCase().indexOf('win') > -1) 
	&& (location.pathname.toLowerCase().indexOf('cgi-bin/search/search.cgi') > -1))
	{
		tmpTop = 215;
		offsetSubTop = 213;
	}

// Floats with window as you scroll.
startMenu('root', false, 'page.winW()/2 - pMenu.menu.root[0].menuW/2', tmpTop, 17, hBar); 


addItem('HOMEPAGE', 'http://DatilSensation.com', '', hBar, 100);
addItem('OVERVIEW', 'mOverView', 'sm:', hBar, 100);
addItem('PRODUCTS', 'mProductServices', 'sm:', hBar, 100);
addItem('NEWS', 'mNews', 'sm:', hBar, 100);
addItem('CONTACT US', 'mContactUs', 'sm:', hBar, 100);


/*
// This is a vertical menu positioned 0px across and 22px down from its trigger, and is 80px wide.
startMenu('mHome', true, 0, 18+offsetSubTop, 80, subM);
// The URLs are set to # here, be sure to replace them with your path/file names or JS functions!
// Also note how all the types are '', indicating these links open in the current frame.
addItem('Open', '#', '');
addItem('Save', '#', '');
addItem('Reopen', 'mReopen', 'sm:');
addItem('Check for<br />Update...', '#', '', subM, 38);
*/

startMenu('mOverView', true, 0, 22+offsetSubTop, 180, subM);
addItem('ABOUT <i>DatilSensation</i>', 'http://www.appalachianrcd.org/localgoods/search.asp?ProductNames=datil', '');
addItem('How We Do It', '#', '');
addItem('Hot Ketchup', 'ketchupsauce.shtml', '');
addItem('Hot Mustard', 'mustardsauce.shtml', '');
addItem('Autumn Gold', '#', '');
addItem('Indian Summer', '#', '');
addItem('Growing Datils', 'growing.shtml', '');

// Popout slightly left of its trigger, for fun...
startMenu('mProductServices', true, 0, 22+offsetSubTop, 180, subM);
// Instead of using spaces to indent, consider 'text-indent' in the stylesheet class perhaps?
addItem('Purchase Locations', 'locations.shtml', '');
addItem('Order Online & Prices', 'locations.shtml#online', '');
addItem('Hot Sauces', '#', '');
addItem('Barbecue Sauces', '#', '');
addItem('Specialty Sauces', '#', '');
addItem('Specialty Rubs/Enhancers', 'rubs_enhancers.shtml', '');
addItem('Datil Dippers', 'datil_dippers.shtml', '');
addItem('Datil Pepper Recipes', 'recipes.shtml', '');

startMenu('mNews', true, 0, 22+offsetSubTop, 120, subM);
addItem('Specials', '#', '');
addItem('News', 'news.shtml', '');
addItem('Purchase Locations', 'locations.shtml', '');
addItem('Festival Flyer', 'Flyer_for_festival.shtml', '');
addItem('Festival Schedule', 'festivals.shtml', '');

startMenu('mContactUs', true, 0, 22+offsetSubTop, 160, subM);
addItem('Give Us A Call', '#', '');
addItem('Email', 'mail.shtml', '');
addItem('Purchase Locations', 'locations.shtml', '');
addItem('Order Online', 'locations.shtml#online', '');
addItem('Festival Flyer', 'Flyer_for_festival.shtml', '');
addItem('Festival Schedule', 'festivals.shtml', '');
addItem('&copy;s &amp; TMs', 'copyrights_trademarks.shtml', '');




// Leftwards popout with a negative x and y relative to its trigger. Custom height too.


}


// *** (3) MENU EFFECTS AND ANIMATION ***


addMenuBorder(pMenu, window.subBlank,
 null, '#666666', 1, '#CCCCDD', 2);


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]);


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)');

}


// *** (4) EVENTS ***

if (!isNS4)
{
 // Write menus now in non-NS4 browsers, by calling the "Fast" mode .update(true) method.
 pMenu.update(true);
 //anotherMenu.update(true);
}
else
{
 // For Netscape 4, back up the old onload function and make a new one to update our menus.
 // This is the regular "Dynamic" mode menu update, it works in IE and NS6 too if required.
 var popOldOL = window.onload;
 window.onload = function()
 {
  if (popOldOL) popOldOL();
  pMenu.update();
  //anotherMenu.update();
 }
}


// Other events must be assigned, these are less complicated, just add or remove menu objects.

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);
}


// *** (5) OPTIONAL CODE ***   DELETE IF YOU'RE NOT USING THESE!

/*
pMenu.onclick = function(mN, iN) { with (this)
{


 if (mN == 'root')
 {
  if (iN == 1) status = 'Congratulations, you\'ve mastered clicking!';
  // Click on second item in root menu will navigate to 'edit.html'. Copy and paste this for
  // each menu item to add click actions to 'sm:' items...
  if (iN == 2) location.href = 'edit.html';
  if (iN == 3) location.href = 'help.html';
 }
}}

// Set the status message to the URL if the 'action type' is nothing, and clear on mouseout.
pMenu.onmouseover = function(mN, iN) { with (this)
{
 // By now, you either have my JS Object Browser script from my site or you need it... try
 // embedding in an IFrame and typing 'pMenu' into its Go To field to see the menu internals.
 with (menu[mN][iN]) if (!type) status = href;
}}
pMenu.onmouseout = function() { status = '' }
*/



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)
 {
  // 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='';

  // Increment the counter and if it hasn't reached the end (10 steps either way),
  // set the timer to call the show/hide function again in 40ms.
  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();
 }
}



// 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/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];
   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;
 }
}



// *** (6) FRAMESET README ***


