
var TxMenuBrowserInt=navigator.userAgent.toLowerCase();var TxMenuIsNavigatorInt=((TxMenuBrowserInt.indexOf('mozilla')!=-1)&&(TxMenuBrowserInt.indexOf('compatible')==-1));var TxMenuDirInt;var TxMenuArrowInt;var TxMenuArrowOffsetInt;var TxMenuFontInt;var TxMenuFontSizeInt;var TxMenuSpacingInt;var TxMenuRulesInt;var TxMenuRuleAttrInt;var TxMenuRuleSpacingInt;var TxMenuRuleOffsetInt;var TxMenuWidthInt;var NewsWidth;var NewsTop;var NewsLeft;function DisplayTextMenu(Choices,MenuPath,DynamicText,MenuTop,MenuLeft,Extended)
{var CurrPos=4;var MenuFont,MenuRuleAttr;if(typeof(TxMenuDir)!='undefined'){TxMenuDirInt=TxMenuDir;}
else{TxMenuDirInt='/Controls/TextMenuImages/';}
if(typeof(TxMenuArrow)!="undefined"){TxMenuArrowInt=TxMenuArrow;}
else{TxMenuArrowInt='Black';}
if((typeof(TxMenuArrowOffset)!="undefined")&&!isNaN(TxMenuArrowOffset))
{TxMenuArrowOffsetInt=TxMenuArrowOffset;}
else{TxMenuArrowOffsetInt=-1;}
if(typeof(TxMenuFont)!='undefined'){MenuFont=TxMenuFont;}
else
{MenuFont='font-family: Helvetica, Arial, san-serif; font-size: 12px; '+'font-weight: bold; text-decoration: none;';}
if((typeof(TxMenuFontSize)!="undefined")&&!isNaN(TxMenuFontSize)&&(TxMenuFontSize>0)){TxMenuFontSizeInt=TxMenuFontSize;}
else{TxMenuFontSizeInt=12;}
if((typeof(TxMenuSpacing)!="undefined")&&!isNaN(TxMenuSpacing)&&(TxMenuSpacing>0)){TxMenuSpacingInt=TxMenuSpacing;}
else
{if(TxMenuFontSizeInt<=12){TxMenuSpacingInt=11;}
else{TxMenuSpacingInt=8;}}
if((typeof(TxMenuRules)!="undefined")&&!isNaN(TxMenuRules)&&(TxMenuRules>0)){TxMenuRulesInt=TxMenuRules;}
else{TxMenuRulesInt=0;}
if(typeof(TxMenuRuleAttr)!='undefined'){MenuRuleAttr=TxMenuRuleAttr;}
else{MenuRuleAttr='border-collapse: collapse; border: 1px solid #808080;';}
if((typeof(TxMenuRuleSpacing)!="undefined")&&!isNaN(TxMenuRuleSpacing)&&(TxMenuRuleSpacing>=0)){TxMenuRuleSpacingInt=TxMenuRuleSpacing;}
else{TxMenuRuleSpacingInt=TxMenuFontSizeInt;}
if((typeof(TxMenuRuleOffset)!="undefined")&&!isNaN(TxMenuRuleOffset)&&(TxMenuRuleOffset>=0)){TxMenuRuleOffsetInt=TxMenuRuleOffset;}
else{TxMenuRuleOffsetInt=3;}
if((typeof(TxMenuWidth)!="undefined")&&!isNaN(TxMenuWidth)&&(TxMenuWidth>0)){TxMenuWidthInt=TxMenuWidth;}
else{TxMenuWidthInt=150;}
if(typeof(MenuPath)=='number'){MenuPath=''+MenuPath;}
else if(typeof(MenuPath)!='string'){MenuPath='';}
if((typeof(MenuTop)!="undefined")&&!isNaN(MenuTop)&&(MenuTop>0)){CurrPos+=MenuTop;}
if((typeof(MenuLeft)=="undefined")||isNaN(MenuLeft)||(MenuLeft<=0)){MenuLeft=20;}
if(typeof(DynamicText)!='string'){DynamicText='';}
if(typeof(Extended)!='boolean'){Extended=false;}
var StyleRE=new RegExp(':');if(MenuFont.match(StyleRE)){TxMenuFontInt='style="'+MenuFont+'"';}
else{TxMenuFontInt='class="'+MenuFont+'"';}
if(MenuRuleAttr.match(StyleRE))
{TxMenuRuleAttrInt='style="'+MenuRuleAttr+'"';}
else{TxMenuRuleAttrInt='class="'+MenuRuleAttr+'"';}
NewsWidth=TxMenuWidthInt-35;NewsLeft=MenuLeft;document.write('<div style="position: relative; top: 0px; left: 0px; '+'width: '+TxMenuWidthInt+'px;">');CurrPos+=TxMenuDrawInt(Choices,MenuPath,DynamicText,CurrPos,MenuLeft,Extended,1);if(TxMenuRulesInt>0)
{document.write('<div style="height: '+TxMenuRuleSpacingInt+'px; '+'width: '+(TxMenuWidthInt-(TxMenuRuleOffsetInt*2))+'px; '+'position: absolute; '+'top: '+(CurrPos-TxMenuRuleSpacingInt)+'px; '+'left: '+TxMenuRuleOffsetInt+'px;">'+'<hr '+TxMenuRuleAttrInt+' '+'width='+(TxMenuWidthInt-(TxMenuRuleOffsetInt*2))+' '+'align=left></div>');}
NewsTop=CurrPos+TxMenuFontSizeInt+3;document.write('</div>');return;}
function TxMenuDrawInt(Tree,MenuPath,DynamicText,CurrPos,CurrIndent,Extended,Level)
{var TreeDepth=Tree.length;var OrigPos=CurrPos;var CurrElem=0;var PathElems;var PathElem=-1
var TerminalLevel=false;var ItemHeight,ItemWidth;var ItemText;var ItemTextRE=/\|/g;var ArrowPos;if(Level>1){CurrElem=1;}
if(MenuPath.length>0)
{PathElems=MenuPath.split('.');if(Level<=PathElems.length)
{PathElem=parseInt(PathElems[Level-1]);if(Level<=1){PathElem--;}
if(Level==PathElems.length){TerminalLevel=true;}}
else{PathElem=0;}}
ItemWidth=TxMenuWidthInt-CurrIndent;while(CurrElem<TreeDepth)
{ItemText=Tree[CurrElem][0];if(ItemText.substr(0,6)=='image=')
{ItemHeight=ItemText.indexOf(',');if(ItemHeight>0)
{ItemText=ItemText.substring(ItemText.indexOf('=')+1,ItemHeight-1);}
else{ItemText=ItemText.substring(ItemText.indexOf('=')+1);}}
else if(ItemText.substr(0,5)=='size=')
{ItemHeight=ItemText.indexOf(',');if(ItemHeight>0){ItemText=ItemText.substring(ItemHeight+1);}
else{ItemText='';}}
if(ItemText.length<=0){CurrElem++;continue;}
ItemHeight=TxMenuHeightInt(ItemText,ItemWidth);ItemText=ItemText.replace(ItemTextRE,'<br>');if(Level<=TxMenuRulesInt)
{document.write('<div style="height: '+TxMenuRuleSpacingInt+'px; '+'width: '+(TxMenuWidthInt-(TxMenuRuleOffsetInt*2))+'px; '+'position: absolute; '+'top: '+(CurrPos-TxMenuRuleSpacingInt)+'px; '+'left: '+TxMenuRuleOffsetInt+'px;">'+'<hr '+TxMenuRuleAttrInt+' '+'width='+(TxMenuWidthInt-(TxMenuRuleOffsetInt*2))+' '+'align=left></div>');}
if((TerminalLevel&&(CurrElem==PathElem)&&(DynamicText==''))||(((Extended)?Tree[CurrElem][3].length:Tree[CurrElem][1].length)<=0))
{document.write('<div style="height: '+ItemHeight+'px; '+'width: '+ItemWidth+'px; position: absolute; '+'top: '+CurrPos+'px; '+'left: '+CurrIndent+'px;">'+'<span '+TxMenuFontInt+'>'+ItemText+'</span>'+'</div>');}
else
{if(TxMenuIsNavigatorInt)
{document.write('<a '+TxMenuFontInt+' '+'href="'+((Extended)?Tree[CurrElem][3]:Tree[CurrElem][1])+'">'+'<div style="height: '+ItemHeight+'px; '+'width: '+ItemWidth+'px; position: absolute; '+'top: '+CurrPos+'px; '+'left: '+CurrIndent+'px;">'+ItemText+'</div></a>');}
else
{document.write('<div style="height: '+ItemHeight+'px; '+'width: '+ItemWidth+'px; position: absolute; '+'top: '+CurrPos+'px; '+'left: '+CurrIndent+'px">'+'<a '+TxMenuFontInt+' '+'href="'+((Extended)?Tree[CurrElem][3]:Tree[CurrElem][1])+'">'+
ItemText+'</a></div>');}}
if(TerminalLevel&&(CurrElem==PathElem))
{if(DynamicText!='')
{CurrPos+=ItemHeight;ItemHeight=TxMenuHeightInt(DynamicText,ItemWidth);DynamicText=DynamicText.replace(ItemTextRE,'<br>');if(Level<=TxMenuRulesInt)
{document.write('<div style="height: '+TxMenuRuleSpacingInt+'px; '+'width: '+(TxMenuWidthInt-(TxMenuRuleOffsetInt*2))+'px; '+'position: absolute; '+'top: '+(CurrPos-TxMenuRuleSpacingInt)+'px; '+'left: '+TxMenuRuleOffsetInt+'px;">'+'<hr '+TxMenuRuleAttrInt+' '+'width='+(TxMenuWidthInt-(TxMenuRuleOffsetInt*2))+' '+'align=left></div>');}
document.write('<div style="height: '+ItemHeight+'px; '+'width: '+(ItemWidth-8)+'px; position: absolute; '+'top: '+CurrPos+'px; '+'left: '+(CurrIndent+8)+'px;">'+'<span '+TxMenuFontInt+'>'+DynamicText+'</span>'+'</div>');}
if(TxMenuArrowInt!='')
{ArrowPos=CurrPos+Math.floor(ItemHeight/2)
-((TxMenuFontSizeInt*2)/3)+TxMenuArrowOffsetInt;document.write('<div style="height: 9px; width: 5px; '+'position: absolute; top: '+ArrowPos+'px; left: 1px;">'+'<img src="'+TxMenuDirInt+'TextArrow_'+TxMenuArrowInt+'.gif" '+'height=9 width=5 alt="">'+'</div>');}}
CurrPos+=ItemHeight;if(Extended&&((PathElem<0)||(CurrElem==PathElem))&&(typeof(Tree[CurrElem][2])=='object'))
{var HeightAdj=TxMenuSpacingInt;var SubmenuParms=TxMenuParseSubmenuInt(Tree[CurrElem][2]);HeightAdj-=TxMenuSpacingInt;CurrPos-=HeightAdj;CurrPos+=TxMenuDrawInt(Tree[CurrElem][2],MenuPath,DynamicText,CurrPos,CurrIndent+SubmenuParms[2],Extended,Level+1);if(SubmenuParms[3].length>0){eval(SubmenuParms[3]);}
CurrPos+=HeightAdj;}
CurrElem++;}
return(CurrPos-OrigPos);}
function TxMenuHeightInt(ItemText,ItemWidth)
{var Items=ItemText.split('|');var CurrItem=0;var ItemHeight=0;while(CurrItem<Items.length)
{ItemHeight+=(Math.floor((Items[CurrItem].length*(TxMenuFontSizeInt*5))/(ItemWidth*12))+1)*(TxMenuFontSizeInt+2);CurrItem++;}
return(ItemHeight+TxMenuSpacingInt);}
function TxMenuParseSubmenuInt(Submenu)
{var MenuType=Submenu[0][0];var MenuSubtype='';if((typeof(MenuType)!='string')||(MenuType.length<=0))
{MenuType='text';}
else if(MenuType.indexOf(',')!=-1)
{MenuSubtype=MenuType.substr(MenuType.indexOf(',')+1);MenuType=MenuType.substring(0,MenuType.indexOf(',')-1);}
var Indent='8',Restore='';var ElementSelected=0;if((typeof(Submenu[0][3])=='string')&&(Submenu[0][3].length>0))
{var Parms;var Font='',FontSize='',MenuSpacing='';Parms=Submenu[0][3].replace(/=/g,'=\'');Parms=Parms.replace(/,/g,'\',');Parms+='\'';eval(Parms);if(Font.length>0)
{Restore+=('TxMenuFontInt = \''+TxMenuFontInt+'\', ');if(Font.match(/:/))
{var FamStart=Font.indexOf('font-family:');var FamEnd,Family;if(FamStart!=-1)
{Family=Font.substr(FamStart+12);if((FamEnd=Family.indexOf(';'))!=-1)
{Family=Family.substr(0,FamEnd);TxMenuFontInt='style="'+Font.substr(0,FamStart+12)+
Family.replace(/:/g,',')+Font.substr(FamStart+FamEnd+12)+'"';}
else
{TxMenuFontInt='style="'+Font.substr(0,FamStart+12)+
Family.replace(/:/g,',')+'"';}}
else{TxMenuFontInt='style="'+Font+'"';}}
else{TxMenuFontInt='class="'+Font+'"';}}
if(FontSize.length>0)
{Restore+=('TxMenuFontSizeInt = '+TxMenuFontSizeInt+', ');TxMenuFontSizeInt=parseInt(FontSize);}
if(MenuSpacing.length>0)
{Restore+=('TxMenuSpacingInt = '+TxMenuSpacingInt+', ');TxMenuSpacingInt=parseInt(MenuSpacing);}
if(Restore.length>0){Restore=Restore.substr(0,Restore.length-2);}}
return([MenuType,MenuSubtype,parseInt(Indent),Restore]);}
