// custom version of nortree_menu_create.js updated 16/01/02 to allow some first level sections to be omitted // NorTree / Advanced / Extra Code needs line :- var IgnoreList = /Ignore Me|Ignore Me Too|Ignore Me As Well/; // generate the Menu structure that HV_Menu wants from the Actinic section tree structures. // updated 15/01/02 to deal with elderly browsers that don't allow functions as regexp replacements // updated 14/01/02 to deal with "double quotes" in section names if (SingleRoot) NoOffFirstLineMenus = 1; else NoOffFirstLineMenus = section_tree_names.length; // Menu tree structure ( X is 1..n 1st level, 1_1..n second level 1_1_1..n third, etc // MenuX=new Array(Text to show, Link, background image (optional), number of sub elements, height, width); function BuildMenuArray(pItem, pURL, base) { if ( MaxDepth == 0) MaxDepth = 1000; if (ThisLevel == 0) { var LineWidth=FirstLineWidth; var LineHeight=FirstLineHeight; var BGImage=FirstBGImage} else { var LineWidth=SubLineWidth; var LineHeight=SubLineHeight; var BGImage=SubBGImage} ThisLevel++; for (var i = 1; i <= pItem.length; i++) { var SName = pItem[i].sName; var I = SName.indexOf("&#"); while ( I > -1) { var J = SName.indexOf(";", I); var SNVal = SName.substring(I + 2, J); SName = SName.substring(0, I) + String.fromCharCode(SNVal - 0) + SName.substr(J + 1); I = SName.indexOf("&#"); } SName = SName.replace(/"/g, "\\\""); // escape double quotes if ( (ThisLevel == 1) && SName.match(IgnoreList) ) { NoOffFirstLineMenus--; } else { if ((pItem[i].pChild) && (ThisLevel < MaxDepth)) 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 var LinkURL = pURL[i].sURL; // deal with V5 Preview by stripping all but page name if (location.href.indexOf('PreviewHTML') != -1 ) LinkURL = LinkURL.replace(/.*SECTIONID=(.*)&NOLOGIN.*/, "$1"); eval('Menu' + base + i + '=new Array("' + SName + '","' + LinkURL + '","' + BGImage + '",' + children + ',' + LineHeight + ',' + LineWidth + ');'); // recurse if child section if ((pItem[i].pChild) && (ThisLevel < MaxDepth)) { BuildMenuArray(pItem[i].pChild, pURL[i].pChild, base + i + '_'); } } } ThisLevel--; } var ThisLevel = 0; if (SingleRoot) { 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 HV_Menu wants from the Actinic section tree structures.