/*********************************************************************************************
 * File Name:     subMenuSetup.js
 *
 * Description:   This file contains the (mostly) Dreamweaver-generated function 'mmLoadMenus()' used for
 *                pop-up (sub)menus. This function was moved into this separate javascript file, rather than
 *                have the exact same function/code in all pages on the site. This way it will make it easier
 *                to implement changes the (sub)menus on all pages, rather than updating each pafge individually.
 *                (See the UPDATE NOTE below for information on updating the function/(sub)menus.)
 *
 * Changes from the Dreamweaver-generated version:
 *                1) In order to make this work for all pages on the site, including those in subdirectories,
 *                   some logic had to be added to adjust the path based on where the current page is located.
 *                   The variables 'currentPage' and 'pathAdjust' were added.
 *                      - 'currentPage' will be set to the current page address (entire path)
 *                      - 'pathAdjust' will be set to either:  "" (for no adjustment)
 *                                                             "../" (for one level adjustment)
 *                                                             "../../" (for two level adjustment)
 *
 *                2) In order to show/hide specific (sub)menus, four parameters are passed in to specify whether
 *                   to display each menu group, and logic added in the code to show/hide the menu as indicated.
 *                   To show the menu, the parameter should be set to true. To hide the menu, the parameter should
 *                   be set to false. The variables passed in are 'showRegular', 'showCreamy', 'showMayonnaise', &
 *                   'showChocolate'.
 *                      - 'showRegular' will show/hide the Regular Sheese menu
 *                      - 'showCreamy' will show/hide the Regular Sheese menu (show if true / hide if false)
 *                      - 'showMayonnaise' will show/hide the Regular Sheese menu (show if true / hide if false)
 *                      - 'showChocolate' will show/hide the Regular Sheese menu (show if true / hide if false)
 *                   Note: Ultimately the true/false values are set via ColdFusion in the application.cfm file.
 *
 * UPDATE NOTE:   In order to use Dreamweaver to make menu updates (like adding another submenu), all the additional
 *                changes (listed above) must first be removed. Then this function must be copied back into one of the
 *                calling pages (i.e. index.cfm) and the calling javascript tag commented out. Then Dreamweaver can be
 *                used to access javascript code and update the menu(s). When the updates are finished, the updated
 *                function should then be copied back into this file, replacing the version below, and the calling
 *                javascript tag uncommented. Finally, all additional changes must be added back in. Then all calling
 *                pages will have the updates.
 *
 *	Revision History:
 *    12/04/07    ERP   Initial implementation by Dreamweaver and separated into stand alone file.
 *    05/02/08    ERP   Added passed parameters to show/hide specific menus.
 *
 *********************************************************************************************/

function mmLoadMenus(showRegular, showCreamy, showMayonnaise, showChocolate)
{
   var currentPage = window.location.href.toLowerCase();
   var pathAdjust = "";
   //alert("currentPage = "+currentPage+"\npathAdjust = "+pathAdjust);

   /*
   alert("showRegular    = " + showRegular +
         "\nshowCreamy     = " + showCreamy +
         "\nshowMayonnaise = " + showMayonnaise +
         "\nshowChocolate  = " + showChocolate);
   */

   if ( (currentPage.indexOf("products/regular/") >= 0) ||
        (currentPage.indexOf("products/creamy/") >= 0 ) ||
        (currentPage.indexOf("products/mayonnaise/") >= 0 ) ||
        (currentPage.indexOf("products/chocolatespread/") >= 0) )
   {
      pathAdjust = "../../";
   }
   else if ( (currentPage.indexOf("products/regular.cfm") >= 0) ||
             (currentPage.indexOf("products/creamy.cfm") >= 0) ||
             (currentPage.indexOf("products/mayo.cfm") >= 0) ||
             (currentPage.indexOf("products/chocspread.cfm") >= 0) )
   {
      pathAdjust = "../";
   }
   //alert("currentPage = "+currentPage+"\npathAdjust = "+pathAdjust);

   if (window.mm_menu_1204133343_0) return;
   if (showRegular)
   {
      window.mm_menu_1204133343_0_1 = new Menu("Regular&nbsp;Sheese&reg;",151,18,"",12,"#000000","#FFFFFF","#E2E6E7","#93936F","left","middle",3,0,1000,-5,7,true,true,true,0,true,true);
      mm_menu_1204133343_0_1.addMenuItem("Blue","location='"+pathAdjust+"Products/Regular/blue.cfm'");
      mm_menu_1204133343_0_1.addMenuItem("Cheddar&nbsp;with&nbsp;Chives","location='"+pathAdjust+"Products/Regular/cheddarchives.cfm'");
      mm_menu_1204133343_0_1.addMenuItem("Gouda","location='"+pathAdjust+"Products/Regular/gouda.cfm'");
      mm_menu_1204133343_0_1.addMenuItem("Smoked&nbsp;Cheddar","location='"+pathAdjust+"Products/Regular/hickory.cfm'");
      mm_menu_1204133343_0_1.addMenuItem("Medium&nbsp;Cheddar","location='"+pathAdjust+"Products/Regular/medium_cheddar.cfm'");
      mm_menu_1204133343_0_1.addMenuItem("Mozzarella","location='"+pathAdjust+"Products/Regular/mozzarella.cfm'");
      mm_menu_1204133343_0_1.addMenuItem("Strong&nbsp;Cheddar","location='"+pathAdjust+"Products/Regular/strong_cheddar.cfm'");
      mm_menu_1204133343_0_1.fontWeight="bold";
      mm_menu_1204133343_0_1.hideOnMouseOut=true;
      mm_menu_1204133343_0_1.bgColor='#555555';
      mm_menu_1204133343_0_1.menuBorder=1;
      mm_menu_1204133343_0_1.menuLiteBgColor='#E0DFE3';
      mm_menu_1204133343_0_1.menuBorderBgColor='#777777';
   }
   if (showCreamy)
   {
      window.mm_menu_1204133343_0_2 = new Menu("Creamy&nbsp;Sheese&reg;",159,18,"",12,"#000000","#FFFFFF","#E2E6E7","#93936F","left","middle",3,0,1000,-5,7,true,true,true,0,true,true);
      mm_menu_1204133343_0_2.addMenuItem("Original","location='"+pathAdjust+"Products/Creamy/creamy_original.cfm'");
      mm_menu_1204133343_0_2.addMenuItem("Cheddar&nbsp;Style&nbsp;Spread","location='"+pathAdjust+"Products/Creamy/creamy_cheddar.cfm'");
      mm_menu_1204133343_0_2.addMenuItem("Garlic&nbsp;and&nbsp;Herb","location='"+pathAdjust+"Products/Creamy/creamy_garlicherb.cfm'");
      mm_menu_1204133343_0_2.addMenuItem("Chives","location='"+pathAdjust+"Products/Creamy/creamy_chives.cfm'");
      mm_menu_1204133343_0_2.addMenuItem("Mexican","location='"+pathAdjust+"Products/Creamy/creamy_mexican.cfm'");
      mm_menu_1204133343_0_2.fontWeight="bold";
      mm_menu_1204133343_0_2.hideOnMouseOut=true;
      mm_menu_1204133343_0_2.bgColor='#555555';
      mm_menu_1204133343_0_2.menuBorder=1;
      mm_menu_1204133343_0_2.menuLiteBgColor='#E0DFE3';
      mm_menu_1204133343_0_2.menuBorderBgColor='#777777';
   }

   if (showMayonnaise)
   {
      window.mm_menu_1204133343_0_3 = new Menu("Egg&nbsp;Free&nbsp;Mayonnaise",246,18,"",12,"#000000","#FFFFFF","#E2E6E7","#93936F","left","middle",3,0,1000,-5,7,true,true,true,0,true,true);
      mm_menu_1204133343_0_3.addMenuItem("Mayonnaise","location='"+pathAdjust+"Products/Mayonnaise/Mayonnaise.cfm'");
      mm_menu_1204133343_0_3.addMenuItem("Mayonnaise&nbsp;with&nbsp;Chili","location='"+pathAdjust+"Products/Mayonnaise/Mayonnaise_Chili.cfm'");
      mm_menu_1204133343_0_3.addMenuItem("Mayonnaise&nbsp;with&nbsp;Flax&nbsp;Oil","location='"+pathAdjust+"Products/Mayonnaise/Mayonnaise_FlaxOil.cfm'");
      mm_menu_1204133343_0_3.addMenuItem("Mayonnaise&nbsp;with&nbsp;Garlic","location='"+pathAdjust+"Products/Mayonnaise/Mayonnaise_Garlic.cfm'");
      mm_menu_1204133343_0_3.addMenuItem("Mayonnaise&nbsp;with&nbsp;Lemongrass","location='"+pathAdjust+"Products/Mayonnaise/Mayonnaise_Lemongrass.cfm'");
      mm_menu_1204133343_0_3.addMenuItem("Mayonnaise&nbsp;with&nbsp;Terragon&nbsp;&&nbsp;Chives","location='"+pathAdjust+"Products/Mayonnaise/Mayonnaise_TerragonChives.cfm'");
      mm_menu_1204133343_0_3.fontWeight="bold";
      mm_menu_1204133343_0_3.hideOnMouseOut=true;
      mm_menu_1204133343_0_3.bgColor='#555555';
      mm_menu_1204133343_0_3.menuBorder=1;
      mm_menu_1204133343_0_3.menuLiteBgColor='#E0DFE3';
      mm_menu_1204133343_0_3.menuBorderBgColor='#777777';
   }

   if (showChocolate)
   {
      window.mm_menu_1204133343_0_4 = new Menu("Organic&nbsp;Chocolate&nbsp;Spreads",219,18,"",12,"#000000","#FFFFFF","#E2E6E7","#93936F","left","middle",3,0,1000,-5,7,true,true,true,0,true,true);
      mm_menu_1204133343_0_4.addMenuItem("Chocolate&nbsp;Spread","location='"+pathAdjust+"Products/ChocolateSpread/ChocolateSpread.cfm'");
      mm_menu_1204133343_0_4.addMenuItem("Chocolate&nbsp;Spread&nbsp;with&nbsp;Hazelnut","location='"+pathAdjust+"Products/ChocolateSpread/ChocolateSpread_Hazelnut.cfm'");
      mm_menu_1204133343_0_4.addMenuItem("Orange&nbsp;Chocolate&nbsp;Spread","location='"+pathAdjust+"Products/ChocolateSpread/ChocolateSpread_Orange.cfm'");
      mm_menu_1204133343_0_4.fontWeight="bold";
      mm_menu_1204133343_0_4.hideOnMouseOut=true;
      mm_menu_1204133343_0_4.bgColor='#555555';
      mm_menu_1204133343_0_4.menuBorder=1;
      mm_menu_1204133343_0_4.menuLiteBgColor='#E0DFE3';
      mm_menu_1204133343_0_4.menuBorderBgColor='#777777';
   }

   window.mm_menu_1204133343_0 = new Menu("root",192,18,"",12,"#000000","#FFFFFF","#E2E6E7","#93936F","left","middle",3,0,1000,-5,7,true,true,true,0,true,true);
   if (showRegular)
      mm_menu_1204133343_0.addMenuItem(mm_menu_1204133343_0_1,"location='"+pathAdjust+"Products/regular.cfm'");

   if (showCreamy)
      mm_menu_1204133343_0.addMenuItem(mm_menu_1204133343_0_2,"location='"+pathAdjust+"Products/creamy.cfm'");

   if (showMayonnaise)
      mm_menu_1204133343_0.addMenuItem(mm_menu_1204133343_0_3,"location='"+pathAdjust+"Products/Mayo.cfm'");

   if (showChocolate)
      mm_menu_1204133343_0.addMenuItem(mm_menu_1204133343_0_4,"location='"+pathAdjust+"Products/ChocSpread.cfm'");

   mm_menu_1204133343_0.fontWeight="bold";
   mm_menu_1204133343_0.hideOnMouseOut=true;
   mm_menu_1204133343_0.childMenuIcon=pathAdjust+"images/arrows.gif";
   mm_menu_1204133343_0.bgColor='#555555';
   mm_menu_1204133343_0.menuBorder=1;
   mm_menu_1204133343_0.menuLiteBgColor='#E0DFE3';
   mm_menu_1204133343_0.menuBorderBgColor='#777777';

   mm_menu_1204133343_0.writeMenus();
} // mmLoadMenus()

