var persistmenu="no" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="local" //enter "sitewide" for menu to persist across site, "local" for this page only

if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.menucontent{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj,exclude)
{
  if ((document.getElementById) && (obj!="unknown"))
  {
    var el = document.getElementById(obj);
    var ar = document.getElementById("masterdiv").getElementsByTagName("span");

    if (el.style.display != "block")
    {
      for (var i=0; i<ar.length; i++)
      {
        if (ar[i].className=="menucontent") //DynamicDrive.com change
	ar[i].style.display = "none";
      }
      el.style.display = "block";
      expand(obj,exclude);
    } else {
      el.style.display = "none";
      expand(obj,exclude);
    }
  } else {

  }
}

function expand(cat,exclude)
{
  var cats = new Array();
  cats[0] = "aggregates";
  cats[1] = "bricks_blocks";
  cats[2] = "ceilings";
  cats[3] = "doors";
  cats[4] = "electrical";
  cats[5] = "fixings_ironmongery";
  cats[6] = "fi_screws";
  cats[7] = "fi_bolts";
  cats[8] = "fi_nails";
  cats[9] = "fi_accessories";
  cats[10] = "fi_handleslocks";
  cats[11] = "fi_hangersties";
  cats[12] = "fi_ironmongery";
  cats[13] = "flooring";
  cats[14] = "heavyside";
  cats[15] = "insulation";
  cats[16] = "joinery";
  cats[17] = "j_stairparts";
  cats[18] = "kitchens";
  cats[19] = "landscaping";
  cats[20] = "ls_blockpaving";
  cats[21] = "ls_flagging";
  cats[22] = "ls_gardening";
  cats[23] = "machinedtimber";
  cats[24] = "mt_decking";
  cats[25] = "mt_par";
  cats[26] = "mt_periodmoulds";
  cats[27] = "mt_skirtarc";
  cats[28] = "mt_smallbeadings";
  cats[29] = "paints_chems";
  cats[30] = "pc_paintsstains";
  cats[31] = "pc_chemprods";
  cats[32] = "plumb_drain";
  cats[33] = "pd_ducting";
  cats[34] = "pd_guttering";
  cats[35] = "pd_loosefitting";
  cats[36] = "pd_manholesetc";
  cats[37] = "pd_plumbingfittings";
  cats[38] = "roofing";
  cats[39] = "sheetmaterials";
  cats[40] = "timber";
  cats[41] = "toolsworkwear";
  cats[42] = "tw_tools";
  cats[43] = "tw_workwear";
  cats[44] = "webspecials";

  for (i=0; i<=44; i++)
  {
    if ((cats[i] != cat) && (cats[i] != exclude))
    {
      tocollapse = document.getElementById(cats[i]);
      tocollapse.style.display = "none";
    }
  }
}
