JlynnMc10
02-14-2003, 05:52 AM
Where e=document.all[1] and ary = is the array of all the text for the menus
function _create(e,ary){
var str = new String();
var strNewP
var menuId = _menus.length; // save the ID for this menu
str = '<DIV ID="_div_'
+ menuId // give it a unique name
+ '" STYLE="visibility:hidden;position:absolute;top:0;left:0;width:'
+ e.attribs["width"]
+ ';height:10;background-color:black;">';
e.insertAdjacentHTML("AfterEnd",str); // paste it in below the root element
var thismenu = document.all.item("_div_" + menuId); // save a reference to the element object
_menus[menuId] = thismenu; // save a reference to the element object in a global array for later use
thismenu.menuId = menuId; // tell the element object where it is in the global array
thismenu.close = _close; // assign a close function to it
thismenu.menuParent = null; // initialize some variables to null
thismenu.menuChild = null;
thismenu.highlightBG = e.attribs["highlight"];
thismenu.normalBG = e.attribs["background"];
thismenu.menuOffset = e.attribs["menu-offset"];
thismenu.menuTopoffset = e.attribs["menu-topoffset"];
thismenu.waitDelay = e.attribs["wait"];
var prevBottom = 0; // initialize where the option elements should start drawing
// create a span element for every option
for(var i=0;i<ary.length;i++){
str = '<SPAN ID="_link_' // assign a unique name
+ menuId
+ '_'
+ i
+ '" STYLE="position:absolute;top:'
+ prevBottom // position it correctly
+ ';left:0;height:'
+ e.attribs["height"]
+ ';overflow:hidden;width:'
+ e.attribs["width"]
+ ';background:'
+ e.attribs["background"]
+ ';border-width:'
+ e.attribs["border-width"]
+ ';border-style:solid;border-color:'
+ e.attribs["border-color"]
+ ';';
if(e.attribs["showrow"]!=true && i != 0){
str +='border-top-width:0;';
}
str +='text-align:left;font-size:'
+ e.attribs["font-size"]
+ ';padding-left:4;">';
if(ary[i].icon!=null){
str +='<SPAN STYLE="font-family:webdings;color:'
+ e.attribs["icon-color"]
+ '">&#'
+ ary[i].icon
+ ';</SPAN> ';
}
//CHECK TO SEE IF ICONKEY IS SELECTED IF SO POPUP IN NEW WINDOW
strNewP =' ';
if(ary[i].url=="http://help.archaio.com"){
strNewP ='" Target="New"';
}
str +='<A HREF="'
+ ary[i].url
+ strNewP + ''
+ '" TITLE="'
+ ary[i].desc
+ '" STYLE="font-family:'
+ e.attribs["font-family"]
+ ';color:'
+ e.attribs["font-color"]
+ ';padding-left:3;">'
+ ary[i].name // fill in the content/name
+ '</A>';
if(ary[i].length > 0 && e.attribs["arrow"]){
str +='<SPAN STYLE="font-family:webdings;position:absolute;top:0;left:'
+ e.attribs["arrow-offset"]
+ ';width:'
+ (e.attribs["width"] - e.attribs["arrow-offset"])
+ ';overflow:hidden;color:'
+ e.attribs["icon-color"]
+ '">4</SPAN>';
}
str +='</SPAN>';
thismenu.insertAdjacentHTML("BeforeEnd",str); // insert it inside the menu element
thisoption = document.all.item('_link_' + menuId + '_' + i);
thisoption.menuId = menuId; // save some references and initialize some variables
thisoption.onmouseover = _optionmouseover;
thisoption.onmouseout = _optionmouseout;
prevBottom = thisoption.style.pixelTop + (e.attribs["height"] - e.attribs["border-width"]); // where should the next one draw?
if(ary[i].length > 0){ // uhoh, if there is a submenu here, better draw it!
thisoption.menuChild=_menus.length; // tell this option that it has a child
_create(e,ary[i]);
}
}
thismenu.style.pixelHeight = prevBottom; // set the height on the menu element
}
function _create(e,ary){
var str = new String();
var strNewP
var menuId = _menus.length; // save the ID for this menu
str = '<DIV ID="_div_'
+ menuId // give it a unique name
+ '" STYLE="visibility:hidden;position:absolute;top:0;left:0;width:'
+ e.attribs["width"]
+ ';height:10;background-color:black;">';
e.insertAdjacentHTML("AfterEnd",str); // paste it in below the root element
var thismenu = document.all.item("_div_" + menuId); // save a reference to the element object
_menus[menuId] = thismenu; // save a reference to the element object in a global array for later use
thismenu.menuId = menuId; // tell the element object where it is in the global array
thismenu.close = _close; // assign a close function to it
thismenu.menuParent = null; // initialize some variables to null
thismenu.menuChild = null;
thismenu.highlightBG = e.attribs["highlight"];
thismenu.normalBG = e.attribs["background"];
thismenu.menuOffset = e.attribs["menu-offset"];
thismenu.menuTopoffset = e.attribs["menu-topoffset"];
thismenu.waitDelay = e.attribs["wait"];
var prevBottom = 0; // initialize where the option elements should start drawing
// create a span element for every option
for(var i=0;i<ary.length;i++){
str = '<SPAN ID="_link_' // assign a unique name
+ menuId
+ '_'
+ i
+ '" STYLE="position:absolute;top:'
+ prevBottom // position it correctly
+ ';left:0;height:'
+ e.attribs["height"]
+ ';overflow:hidden;width:'
+ e.attribs["width"]
+ ';background:'
+ e.attribs["background"]
+ ';border-width:'
+ e.attribs["border-width"]
+ ';border-style:solid;border-color:'
+ e.attribs["border-color"]
+ ';';
if(e.attribs["showrow"]!=true && i != 0){
str +='border-top-width:0;';
}
str +='text-align:left;font-size:'
+ e.attribs["font-size"]
+ ';padding-left:4;">';
if(ary[i].icon!=null){
str +='<SPAN STYLE="font-family:webdings;color:'
+ e.attribs["icon-color"]
+ '">&#'
+ ary[i].icon
+ ';</SPAN> ';
}
//CHECK TO SEE IF ICONKEY IS SELECTED IF SO POPUP IN NEW WINDOW
strNewP =' ';
if(ary[i].url=="http://help.archaio.com"){
strNewP ='" Target="New"';
}
str +='<A HREF="'
+ ary[i].url
+ strNewP + ''
+ '" TITLE="'
+ ary[i].desc
+ '" STYLE="font-family:'
+ e.attribs["font-family"]
+ ';color:'
+ e.attribs["font-color"]
+ ';padding-left:3;">'
+ ary[i].name // fill in the content/name
+ '</A>';
if(ary[i].length > 0 && e.attribs["arrow"]){
str +='<SPAN STYLE="font-family:webdings;position:absolute;top:0;left:'
+ e.attribs["arrow-offset"]
+ ';width:'
+ (e.attribs["width"] - e.attribs["arrow-offset"])
+ ';overflow:hidden;color:'
+ e.attribs["icon-color"]
+ '">4</SPAN>';
}
str +='</SPAN>';
thismenu.insertAdjacentHTML("BeforeEnd",str); // insert it inside the menu element
thisoption = document.all.item('_link_' + menuId + '_' + i);
thisoption.menuId = menuId; // save some references and initialize some variables
thisoption.onmouseover = _optionmouseover;
thisoption.onmouseout = _optionmouseout;
prevBottom = thisoption.style.pixelTop + (e.attribs["height"] - e.attribs["border-width"]); // where should the next one draw?
if(ary[i].length > 0){ // uhoh, if there is a submenu here, better draw it!
thisoption.menuChild=_menus.length; // tell this option that it has a child
_create(e,ary[i]);
}
}
thismenu.style.pixelHeight = prevBottom; // set the height on the menu element
}