// generate the Menu structure that H|V_Menu wants from the Actinic section tree structures.
//
if (SingleRoot) NoOffFirstLineMenus = 1; else NoOffFirstLineMenus = section_tree_names.length;
// Menu tree
//	MenuX=new Array(Text to show, Link, background image (optional), number of sub elements, height, width);

//  Now building rest of menu by reading Actinic section arrays and creating Hv_Menu arrays instead.

function BuildMenuArray(pItem,pURL, base)
 {
 if (ThisLevel == 0) { var LineWidth=FirstLineWidth; var LineHeight=FirstLineHeight; var BGImage=FirstBGImage} // Top level
 else { var LineWidth=SubLineWidth; var LineHeight=SubLineHeight; var BGImage=SubBGImage} 
 ThisLevel++;
 for (var i = 1; i <= pItem.length; i++)
   {
   if (pItem[i].pChild) var children = pItem[i].pChild.length; else children = 0;
   // build a menu line from actinic section array and also fix the &#nn; stuff that Actinic puts in
   eval('Menu' + base + i + '=new Array("' 
        + pItem[i].sName.replace(/&#([\da-fA-F]{1,3}?);/g, function(match, bit) {return String.fromCharCode(bit - 0)})
	+ '","' + pURL[i].sURL + '","' + BGImage + '",' + children + ',' + LineHeight + ',' + LineWidth + ');');
   if (pItem[i].pChild) { BuildMenuArray(pItem[i].pChild, pURL[i].pChild, base + i + '_'); } // recurse if child section
   }
 ThisLevel--;
 }

  var ThisLevel = 0;
 if (SingleRoot) 			// single root
   {
   eval('Menu1=new Array("' + FirstLineText + '","' + FirstLineURL + '","' + FirstBGImage 
        + '",' + section_tree_names.length + ',' + FirstLineHeight + ',' + FirstLineWidth + ');');
   ThisLevel++;
   BuildMenuArray(section_tree_names,section_tree_URLs, '1_');
   }
  else                                          // multiple level base
   {
   BuildMenuArray(section_tree_names,section_tree_URLs, '');
   }
// free up actinic arrays
section_tree_names.length = 0;
section_tree_URLs.length = 0;
// end of - generate the Menu structure that H|V_Menu wants from the Actinic section tree structures.

