var ptr=0; var mptr=0; var lptr=0; var menuArray = new Array(); var itemArray = new Array(); var levelArray = new Array(); var maxLevel=3; var menuDelay=5; var parentHashArray = new Array(); var pha=0; var pHash; function cleanup () { ptr=0; mptr=0; lptr=0; menuArray = new Array(); itemArray = new Array(); levelArray = new Array(); maxLevel=3; menuDelay=5; } function addMenuItem( parentId, text, link, id) { itemArray[ptr++]=new menuItem(parentId, text, link, id); parentHashArray[pha++]="this." + id + "=\"" + parentId + "\""; //if (pha < 10 && pha > 0) //alert(parentHashArray[pha -1]); } function addLevel(num, mClass, lClass , color, bgcolor, mColor, mBgColor) { levelArray[lptr++]=new level(num, mClass , lClass, color, bgcolor , mColor, mBgColor); } function addMenu(name, level, left, top) { menuArray[mptr++]=new mMenu(name, level, left, top); } function menuItem (parentId, text, link, id){ this.parentId=parentId; this.text=text; this.link=link; this.id=id; } function level (num, lClass, color, bgcolor, mColor, mBgColor) { this.num = num; this.lClass=lClass; this.color=color; this.bgcolor=bgcolor; this.mColor=mColor; this.mBgColor=mBgColor; } function mMenu (id, level, left, top) { this.id=id; this.level=level; this.left=left; this.top=top; } //color, bgcolor, mColor, mBgColor function parentHash() { for (var j=0; j < parentHashArray.length; j++) { eval(parentHashArray[j]); } } function getParent(id) { if (id == null) return; return eval("pHash." + id); } function levelColorHash () { for (var j=0; j < levelArray.length; j++) { eval("this.level_" + levelArray[j].num + "=\"" + levelArray[j].color + "|" + levelArray[j].bgcolor + "|" + levelArray[j].mColor + "|" + levelArray[j].mBgColor + "\";"); } } function levelClassHash () { for (var j=0; j < levelArray.length; j++) { eval("this.level_" + levelArray[j].num + "=\"" + levelArray[j].lClass + "\";"); } } function menuLevelHash () { for (var j=0; j < menuArray.length; j++) { eval("this." + menuArray[j].id + "=" + menuArray[j].level + ";"); } } function menuLocationHash () { for (var j=0; j < menuArray.length; j++) { eval("this." + menuArray[j].id + "=\"" + "left:" + menuArray[j].left + "px;" + "top:" + menuArray[j].top + "px;\"" + ";"); } } function getColorHashLine(id) { if (id == null) return; if (id.length == 0) return; var lch = new levelColorHash(); var level= getLevel(id); return eval("lch.level_" + level + ".split(\"|\");"); } function getLevel(id) { if (id == null) return; var mlh = new menuLevelHash(); return (eval("mlh." + id)); } function createMainMenu() { var tablescript=""; for (var j=0; j < itemArray.length; j++) { if (parseInt(getLevel(itemArray[j].parentId)) == parseInt(1)) { var colorLine = getColorHashLine(itemArray[j].parentId); if (j == 0 ) { tablescript +=''; } tablescript +=''; } } tablescript +='
' + ' ' + itemArray[j].text + '
'; return tablescript; } function createSubMenus() { var levelMHash = new menuLevelHash(); var locationHash = new menuLocationHash(); var lColorHash = new levelColorHash(); var lClassHash = new levelClassHash(); var lh, lc, mc; var tablescript=""; var parent; var index; var endTable=false; var itemLevel; var name, itemName; var itemIndex; var started=false; var link, linkClass; //0 = color, 1 = bgcolor, 2 = mcolor 3 = mbgcolor index=0; for (var j=0; j < itemArray.length; j++) { if (itemArray[j].parentId != parent) { if (started) { //tablescript += '\n'; tablescript += ""; } parent=itemArray[j].parentId; index=1; itemLevel= eval("levelMHash." + parent); if (itemLevel == 1) continue; lh = eval("lColorHash.level_" + itemLevel + ".split(\"|\");"); name= parent + 'Menu'; tablescript += '\n' + '\n ' + itemArray[j].text + '\n' ; } tablescript += ""; pHash=new parentHash(); return tablescript; }//end createSubMenus