// Menu entries.
// Each entry: text name, name of next level, hyperlink address
var mnuAbout = new Array

var mnuAboutReview = new Array ("NCVS Paid Staff", "", "about/review/paid.htm",
				"NCVS Volunteers", "", "about/review/volunteers.htm",
				"NCVS Board of Trustees", "", "about/review/board.htm",
			  	"Sections", "", "about/review/sections.htm",
				"Notice", "", "about/review/section1.htm",
				"Directors’/ Trustees’ Report", "", "about/review/section2.htm",
				"Auditors’ Report", "", "about/review/section3.htm",
				"Statement of Financial Activities", "", "about/review/sections.htm",
				"Balance Sheet", "", "about/review/sections.htm",
				"Notes to the Financial Statements", "", "about/review/sections.htm",
				"Statement of Funds", "", "about/review/sections.htm",
				"Financial Review", "", "about/review/finance.htm");

var mnuFunding = new Array

var mnuGroups = new Array

var mnuGroupsEvents = new Array ("Starting", "", "groups/events/getting.htm",
				 "Planning", "", "groups/events/planning.htm",
				 "The Venue", "", "groups/events/venue.htm",
				 "Publicity", "", "groups/events/publicity.htm",
				 "Opening", "", "groups/events/opening.htm",
				 "On The Day", "", "groups/events/ontheday.htm",
				 "Practice", "", "groups/events/examples.htm",
				 "After", "", "groups/events/after.htm",
				 "Problems", "", "groups/events/problems.htm",
				 "Checklist", "", "groups/events/checklist.htm");

var mnuHelp = new Array ("How to Use", "", "helpful/how.htm",
			 "How to Search", "", "helpful/search_help.htm",
			 "Accessibility", "", "helpful/access.htm",
			 "Site Map", "", "helpful/map.htm");


var mnuHome = new Array ("Home", "", "index.html",
						 "About NCVS", "mnuAbout", "about/index.htm",					 
						 "Volunteering", "mnuVolunteer", "volunteer/index.htm",
						 "Partnerships", "mnuPartnerships", "partnerships/index.htm",
						 "Groups", "mnuGroups", "groups/index.htm",
						 "CRB checks Vetting and Barring", "mnuGroups", "crb/index.htm",
						 "Funding", "mnuGroups", "funding/index.htm",
                         "Training", "mnuTraining", "training/ncvs/index.htm",
						 "Meeting Rooms", "mnuNvac", "nvac/index.html",
						 "Jobs", "", "jobs/index.htm",
                       	 "Communications", "", "bulletins/index.htm",
                         //"ICT Support Service", "mnuICT", "ict/index.htm",
						 "Links", "mnuLinks", "links/index.htm",
                         "Help", "mnuHelp", "helpful/index.htm",
                         "Contacts", "", "about/contact.htm");

var mnuTraining = new Array

var mnuLinks = new Array

var mnuICT = new Array ("Service", "", "ict/service.htm",
                        "Price", "", "ict/price.htm");

var mnuNvac = new Array

var mnuNVACSpace = new Array

var mnuPartnerships = new Array

var mnuVolunteer = new Array

function writeMenu(menuLevel, indent)
{
   var menuLevelObj = eval(menuLevel);
   var menu = "";
   var item = 0;

   // Write the container for this menu level
   menu += "<DIV ID=\"" + menuLevel + "div\" STYLE=\"display: none\">\n";
   
   for (item = 0; item < menuLevelObj.length; item += 3)
   {
      // If there is a submenu, allow it to be toggled from this menu
      menu += "<DIV>";

      // Display an item for the type of item
      // + = expand, - = contract, . = plain
      if (menuLevelObj[item + 1] != "")
      {
         menu += indent + '<IMG ALIGN="ABSMIDDLE" ALT="Click to display / hide the sub menu." HEIGHT="9" SRC="' + TheIndent + 'images/menu/menu_plus.gif" STYLE="cursor: hand" WIDTH="9" ONCLICK="toggleMenu(\'' + menuLevelObj[item + 1] + 'div\', this);">';
      }
      else
      {
         menu += indent + '<IMG ALIGN="ABSMIDDLE" ALT="Click to display / hide the sub menu." HEIGHT="9" SRC="' + TheIndent + 'images/menu/menu_dot.gif" WIDTH="9">';
      }
      menu += "&nbsp;";

      // Write out each entry
      if (menuLevelObj[item + 2] == "")
      {
         menu += menuLevelObj[item] + "</DIV>\n";
      }
      else
      {
         menu += "<A HREF=\"" + TheIndent + menuLevelObj[item + 2] + "\">" + menuLevelObj[item] + "</A></DIV>\n";
      }

      // If there is a submenu, go process it
      if (menuLevelObj[item + 1] != "")
      {
         menu += writeMenu(menuLevelObj[item + 1], indent + "&nbsp;&nbsp;&nbsp;");
      }

   }
   menu += "</DIV>\n";

   return menu;
}


function toggleMenu(menuObj, signObj)
{
   if (ie5 || ie55 || ie6 || ns6)
   {
      menuObj = document.getElementById(menuObj);
   }

   if (menuObj.style.display == "none")
   {
      menuObj.style.display = "block";
      signObj.src = TheIndent + "images/menu/menu_minus.gif";
   }
   else
   {
      menuObj.style.display = "none";
      signObj.src = TheIndent + "images/menu/menu_plus.gif";
   }
}


// Code that open up the right menu depending on the page location
function openMenu()
{
   var address = document.location.href;

   // 'about' for NCVS About
   if (address.indexOf("/about/") > -1 ||
       address.indexOf("\\about\\") > -1)
   {
      mnuAboutdiv.style.display = "block";
   }

  // 'about/review' for NCVS Annual Review 2006
   if (address.indexOf("/about/review/") > -1 ||
       address.indexOf("\\about\review\\") > -1)
   {
      mnuAboutReviewdiv.style.display = "block";
   }

   // 'funding' for Funding
   if (address.indexOf("/funding/") > -1 ||
       address.indexOf("\\funding\\") > -1)
   {
      mnuFundingdiv.style.display = "block";
   }

  // 'funding/grants' for Grants
   if (address.indexOf("/funding/grants/") > -1 ||
       address.indexOf("\\funding\grants\\") > -1)
   {
      mnuFundingGrantsdiv.style.display = "block";
   }

  // 'groups' for Groups
   if (address.indexOf("/groups/") > -1 ||
       address.indexOf("\\groups\\") > -1)
   {
      mnuGroupsdiv.style.display = "block";
   }

  // 'help' for Help
   if (address.indexOf("/help/") > -1 ||
       address.indexOf("\\help\\") > -1)
   {
      mnuHelpdiv.style.display = "block";
   }

  // 'events' for Organising Local events
   if (address.indexOf("/groups/events/") > -1 ||
       address.indexOf("\\groups\events\\") > -1)
   {
      mnuGroupsEventsdiv.style.display = "block";
   }

   // 'training' for Training
   if (address.indexOf("/training/") > -1 ||
       address.indexOf("\\training\\") > -1)
   {
      mnuTrainingdiv.style.display = "block";
   }

   // 'links' for Links
   if (address.indexOf("/links/") > -1 ||
       address.indexOf("\\links\\") > -1)
   {
      mnuLinksdiv.style.display = "block";
   }

   // 'nvac' for NVAC
   if (address.indexOf("/nvac/") > -1 ||
       address.indexOf("\\nvac\\") > -1)
   {
      mnuNvacdiv.style.display = "block";
   } 

  // 'space' for Space
   if (address.indexOf("/nvac/space/") > -1 ||
       address.indexOf("\\nvac\space\\") > -1)
   {
      mnuNVACSpacediv.style.display = "block";
   }
// 'partnerships' for Partnerships
   if (address.indexOf("/partnerships/") > -1 ||
       address.indexOf("\\partnerships\\") > -1)
   {
      mnuPartnershipsdiv.style.display = "block";
   }

// 'volunteer' for Volunteer
   if (address.indexOf("/volunteer/") > -1 ||
       address.indexOf("\\volunteer\\") > -1)
   {
      mnuVolunteerdiv.style.display = "block";
   }

}


// DEBUG CODE
//alert(writeMenu('mnuHome', ""));
//document.writeln( writeMenu('menuLevel1', "") );Copy of 7. Use links.htm