home *** CD-ROM | disk | FTP | other *** search
/ Thomson (Residential) / TGSTPv7203.iso / mac / Documentation / HTML / TG790_sv / wwhelp / wwhimpl / js / scripts / index.js < prev    next >
Text File  |  2007-06-22  |  44KB  |  1,529 lines

  1. // Copyright (c) 2000-2001 Quadralay Corporation.  All rights reserved.
  2. //
  3.  
  4. function  WWHIndex_Object()
  5. {
  6.   this.mbPanelInitialized = false;
  7.   this.mPanelAnchor       = null;
  8.   this.mPanelTabTitle     = WWHFrame.WWHJavaScript.mMessages.mTabsIndexLabel;
  9.   this.mInitIndex         = 0;
  10.   this.mOptions           = new WWHIndexOptions_Object();
  11.   this.mTopEntry          = new WWHIndexTopEntry_Object();
  12.   this.mMaxLevel          = 0;
  13.   this.mEntryCount        = 0;
  14.   this.mSeeAlsoArray      = new Array();
  15.   this.mSectionIndex      = null;
  16.   this.mSectionCache      = new WWHSectionCache_Object();
  17.   this.mIterator          = new WWHIndexIterator_Object();
  18.   this.mHTMLSegment       = new WWHStringBuffer_Object();
  19.   this.mEventString       = WWHPopup_EventString();
  20.   this.mClickedEntry      = null;
  21.  
  22.   this.fInitHeadHTML          = WWHIndex_InitHeadHTML;
  23.   this.fInitBodyHTML          = WWHIndex_InitBodyHTML;
  24.   this.fInitLoadBookIndex     = WWHIndex_InitLoadBookIndex;
  25.   this.fAddSeeAlsoEntry       = WWHIndex_AddSeeAlsoEntry;
  26.   this.fProcessSeeAlsoEntries = WWHIndex_ProcessSeeAlsoEntries;
  27.   this.fHeadHTML              = WWHIndex_HeadHTML;
  28.   this.fStartHTMLSegments     = WWHIndex_StartHTMLSegments;
  29.   this.fAdvanceHTMLSegment    = WWHIndex_AdvanceHTMLSegment;
  30.   this.fGetHTMLSegment        = WWHIndex_GetHTMLSegment;
  31.   this.fEndHTMLSegments       = WWHIndex_EndHTMLSegments;
  32.   this.fHoverTextTranslate    = WWHIndex_HoverTextTranslate;
  33.   this.fHoverTextFormat       = WWHIndex_HoverTextFormat;
  34.   this.fGetPopupAction        = WWHIndex_GetPopupAction;
  35.   this.fThresholdExceeded     = WWHIndex_ThresholdExceeded;
  36.   this.fGetSectionNavigation  = WWHIndex_GetSectionNavigation;
  37.   this.fChangeSection         = WWHIndex_ChangeSection;
  38.   this.fSelectionListHeadHTML = WWHIndex_SelectionListHeadHTML;
  39.   this.fSelectionListBodyHTML = WWHIndex_SelectionListBodyHTML;
  40.   this.fDisplayLink           = WWHIndex_DisplayLink;
  41.   this.fGetEntry              = WWHIndex_GetEntry;
  42.   this.fClickedEntry          = WWHIndex_ClickedEntry;
  43.   this.fClickedSeeAlsoEntry   = WWHIndex_ClickedSeeAlsoEntry;
  44.  
  45.   // Set options
  46.   //
  47.   WWHJavaScriptSettings_Index_DisplayOptions(this.mOptions);
  48. }
  49.  
  50. function  WWHIndex_InitHeadHTML()
  51. {
  52.   var  InitHeadHTML = "";
  53.  
  54.  
  55.   return InitHeadHTML;
  56. }
  57.  
  58. function  WWHIndex_InitBodyHTML()
  59. {
  60.   var  HTML = new WWHStringBuffer_Object();
  61.   var  BookList = WWHFrame.WWHHelp.mBooks.mBookList;
  62.   var  bFoundRequiredGroupOptions = false;
  63.   var  RequiredGroup = null;
  64.   var  MaxIndex;
  65.   var  Index;
  66.   var  bRequiredGroupShowBuckets;
  67.   var  Item;
  68.  
  69.  
  70.   // Display initializing message
  71.   //
  72.   HTML.fAppend("<h2>" + WWHFrame.WWHJavaScript.mMessages.mInitializingMessage + "</h2>\n");
  73.  
  74.   // Load index data
  75.   //
  76.   this.mInitIndex = 0;
  77.   for (MaxIndex = BookList.length, Index = 0 ; Index < MaxIndex ; Index++)
  78.   {
  79.     // Reference Index data
  80.     //
  81.     HTML.fAppend("<script language=\"JavaScript1.2\" src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + WWHStringUtilities_RestoreEscapedSpaces(BookList[Index].mDirectory) + "wwhdata/js/index.js\"></script>\n");
  82.  
  83.     // Load Index data for current book
  84.     //
  85.     HTML.fAppend("<script language=\"JavaScript1.2\" src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/scripts/index1s.js\"></script>\n");
  86.   }
  87.  
  88.   // Confirm required group options are defined
  89.   //
  90.   for (MaxIndex = this.mOptions.mGroupList.length, Index = 0 ; Index < MaxIndex ; Index++)
  91.   {
  92.     if (this.mOptions.mGroupList[Index].length == 0)  // Required Group
  93.     {
  94.       bFoundRequiredGroupOptions = true;
  95.     }
  96.   }
  97.  
  98.   // Create required group options if not found
  99.   //
  100.   if ( ! bFoundRequiredGroupOptions)
  101.   {
  102.     this.mOptions.fGroup("", true, false, "");
  103.   }
  104.  
  105.   // Create always display entries
  106.   //
  107.   for (MaxIndex = this.mOptions.mGroupList.length, Index = 0 ; Index < MaxIndex ; Index++)
  108.   {
  109.     if (this.mOptions.mGroupList[Index].length == 0)  // Required group
  110.     {
  111.       RequiredGroup = this.mTopEntry.fGetGroup(this.mOptions.mGroupList[Index]);
  112.     }
  113.     else if (this.mOptions.mGroupInfoHash[this.mOptions.mGroupList[Index]].mbAlwaysDisplay)  // Always display grouping
  114.     {
  115.       this.mTopEntry.fGetGroup(this.mOptions.mGroupList[Index]);
  116.     }
  117.   }
  118.  
  119.   // Determine if buckets are going to be hidden
  120.   //
  121.   bRequiredGroupShowBuckets = this.mOptions.mGroupInfoHash[""].mbShowBuckets;
  122.  
  123.   // Add require items to required group
  124.   //
  125.   for (Item in this.mOptions.mGroupMapping)
  126.   {
  127.     if (this.mOptions.mGroupMapping[Item].length == 0)  // Required item
  128.     {
  129.       RequiredGroup.fGetBucket(Item, bRequiredGroupShowBuckets);
  130.     }
  131.   }
  132.  
  133.   return HTML.fGetBuffer();
  134. }
  135.  
  136. function  WWHIndex_InitLoadBookIndex(ParamAddIndexEntriesFunc)
  137. {
  138.   // Load Index
  139.   //
  140.   ParamAddIndexEntriesFunc(this.mTopEntry);
  141.  
  142.   // Increment init book index
  143.   //
  144.   this.mInitIndex++;
  145.  
  146.   // Check if done
  147.   //
  148.   if (this.mInitIndex == WWHFrame.WWHHelp.mBooks.mBookList.length)
  149.   {
  150.     // Process see also entries to set up links between source and target
  151.     // Do this before the top level hashes are cleared by the sort children call
  152.     //
  153.     this.fProcessSeeAlsoEntries();
  154.  
  155.     // Sort top level entries
  156.     //
  157.     if (this.mTopEntry.mChildrenSortArray == null)
  158.     {
  159.       WWHIndexEntry_SortChildren(this.mTopEntry);
  160.     }
  161.  
  162.     // Panel is initialized
  163.     //
  164.     this.mbPanelInitialized = true;
  165.   }
  166. }
  167.  
  168. function  WWHIndex_AddSeeAlsoEntry(ParamEntry)
  169. {
  170.   this.mSeeAlsoArray[this.mSeeAlsoArray.length] = ParamEntry;
  171. }
  172.  
  173. function  WWHIndex_ProcessSeeAlsoEntries()
  174. {
  175.   var  MaxIndex;
  176.   var  Index;
  177.   var  FirstChar = "";
  178.   var  GroupTitle;
  179.   var  SeeAlsoTargetEntry;
  180.  
  181.  
  182.   for (MaxIndex = this.mSeeAlsoArray.length, Index = 0 ; Index < MaxIndex ; Index++)
  183.   {
  184.     SeeAlsoEntry = this.mSeeAlsoArray[Index];
  185.  
  186.     // Determine location of see also target
  187.     //
  188.     if (SeeAlsoEntry.mSeeAlso.length > 0)
  189.     {
  190.       FirstChar = SeeAlsoEntry.mSeeAlso.substring(0, 1);
  191.  
  192.       // toUpperCase is conditional to handle numbers
  193.       //
  194.       FirstChar = (typeof FirstChar.toUpperCase == "function") ? FirstChar.toUpperCase() : FirstChar;
  195.     }
  196.     GroupTitle = WWHFrame.WWHIndex.mOptions.mGroupMapping[FirstChar];
  197.     if (typeof GroupTitle == "undefined")
  198.     {
  199.       GroupTitle = "";  // Put in required grouping
  200.     }
  201.  
  202.     // Access target entry
  203.     //
  204.     if ((typeof this.mTopEntry.mChildren[GroupTitle] != "undefined") &&
  205.         (this.mTopEntry.mChildren[GroupTitle].mChildren != null) &&
  206.         (typeof this.mTopEntry.mChildren[GroupTitle].mChildren[FirstChar] != "undefined") &&
  207.         (this.mTopEntry.mChildren[GroupTitle].mChildren[FirstChar].mChildren != null) &&
  208.         (typeof this.mTopEntry.mChildren[GroupTitle].mChildren[FirstChar].mChildren[SeeAlsoEntry.mSeeAlso] != "undefined"))
  209.     {
  210.       SeeAlsoTargetEntry = this.mTopEntry.mChildren[GroupTitle].mChildren[FirstChar].mChildren[SeeAlsoEntry.mSeeAlso];
  211.     }
  212.     else
  213.     {
  214.       SeeAlsoTargetEntry = null;
  215.     }
  216.  
  217.     // Setup links between source and destination
  218.     //
  219.     if (SeeAlsoTargetEntry != null)
  220.     {
  221.       // See if target entry is already tagged
  222.       //
  223.       if (typeof SeeAlsoTargetEntry.mSeeAlsoTargetName == "undefined")
  224.       {
  225.         // Update target entry
  226.         //
  227.         SeeAlsoTargetEntry.mSeeAlsoTargetName = "s" + Index;
  228.       }
  229.  
  230.       // Update source entry
  231.       //
  232.       SeeAlsoEntry.mSeeAlsoTargetName = SeeAlsoTargetEntry.mSeeAlsoTargetName;
  233.       SeeAlsoEntry.mSeeAlsoTargetEntryKey = (GroupTitle.length > 0) ? GroupTitle : FirstChar;
  234.     }
  235.   }
  236. }
  237.  
  238. function  WWHIndex_HeadHTML()
  239. {
  240.   var  HTML = new WWHStringBuffer_Object();
  241.   var  MaxLevel;
  242.   var  Level;
  243.  
  244.  
  245.   // Generate style section
  246.   //
  247.   HTML.fAppend("<style type=\"text/css\">\n");
  248.   HTML.fAppend(" <!--\n");
  249.   HTML.fAppend("  a.navigation { text-decoration: none ;\n");
  250.   HTML.fAppend("                 color: " + WWHFrame.WWHJavaScript.mSettings.mIndex.mNavigationEnabledColor + " }\n");
  251.   HTML.fAppend("  p.navigation { margin-top: 1pt ;\n");
  252.   HTML.fAppend("                 margin-bottom: 1pt ;\n");
  253.   HTML.fAppend("                 color: " + WWHFrame.WWHJavaScript.mSettings.mIndex.mNavigationCurrentColor + " ;\n");
  254.   HTML.fAppend("                 " + WWHFrame.WWHJavaScript.mSettings.mIndex.mNavigationFontStyle + " }\n");
  255.   HTML.fAppend("  a            { text-decoration: none ;\n");
  256.   HTML.fAppend("                 color: " + WWHFrame.WWHJavaScript.mSettings.mIndex.mEnabledColor + " }\n");
  257.   HTML.fAppend("  a.AnchorOnly { text-decoration: none ;\n");
  258.   HTML.fAppend("                 color: " + WWHFrame.WWHJavaScript.mSettings.mIndex.mDisabledColor + " }\n");
  259.   HTML.fAppend("  p            { margin-top: 1pt ;\n");
  260.   HTML.fAppend("                 margin-bottom: 1pt ;\n");
  261.   HTML.fAppend("                 color: " + WWHFrame.WWHJavaScript.mSettings.mIndex.mDisabledColor + " ;\n");
  262.   HTML.fAppend("                 " + WWHFrame.WWHJavaScript.mSettings.mIndex.mFontStyle + " }\n");
  263.   for (MaxLevel = this.mMaxLevel + 1, Level = 0 ; Level <= MaxLevel ; Level++)
  264.   {
  265.     HTML.fAppend("  p.l" + Level + " { margin-left: " + (WWHFrame.WWHJavaScript.mSettings.mIndex.mIndent * Level) + "pt }\n");
  266.   }
  267.   HTML.fAppend(" -->\n");
  268.   HTML.fAppend("</style>\n");
  269.  
  270.   return HTML.fGetBuffer();
  271. }
  272.  
  273. function  WWHIndex_StartHTMLSegments()
  274. {
  275.   var  HTML = new WWHStringBuffer_Object();
  276.  
  277.  
  278.   if (this.fThresholdExceeded())
  279.   {
  280.     // Display sections of the index rather than the whole thing
  281.     //
  282.  
  283.     // Select first entry if section not already picked
  284.     //
  285.     if (this.mSectionIndex == null)
  286.     {
  287.       this.mSectionIndex = 0;
  288.     }
  289.  
  290.     // Calculate section navigation if not already cached
  291.     //
  292.     if (typeof this.mSectionCache[this.mSectionIndex] == "undefined")
  293.     {
  294.       this.mSectionCache[this.mSectionIndex] = this.fGetSectionNavigation(this.mSectionIndex);
  295.     }
  296.  
  297.     // Display section selection
  298.     //
  299.     HTML.fAppend(this.mSectionCache[this.mSectionIndex]);
  300.     HTML.fAppend("<p> </p>\n");
  301.   }
  302.   else
  303.   {
  304.     // Display whole index
  305.     //
  306.     this.mSectionIndex = null;
  307.   }
  308.  
  309.   // Setup iterator for display
  310.   //
  311.   this.mIterator.fReset(this.mSectionIndex, this.fThresholdExceeded());
  312.  
  313.   // Define accessor functions to reduce file size
  314.   //
  315.   HTML.fAppend("<script type=\"text/javascript\" language=\"JavaScript1.2\">\n");
  316.   HTML.fAppend(" <!--\n");
  317.   HTML.fAppend("  function  fC(ParamEntryInfo)\n");
  318.   HTML.fAppend("  {\n");
  319.   HTML.fAppend("    WWHFrame.WWHIndex.fClickedEntry(ParamEntryInfo);\n");
  320.   HTML.fAppend("  }\n");
  321.   HTML.fAppend("\n");
  322.   HTML.fAppend("  function  fA(ParamEntryInfo)\n");
  323.   HTML.fAppend("  {\n");
  324.   HTML.fAppend("    WWHFrame.WWHIndex.fClickedSeeAlsoEntry(ParamEntryInfo);\n");
  325.   HTML.fAppend("  }\n");
  326.   HTML.fAppend("\n");
  327.   HTML.fAppend("  function  fS(ParamEntryID,\n");
  328.   HTML.fAppend("               ParamEvent)\n");
  329.   HTML.fAppend("  {\n");
  330.   HTML.fAppend("    WWHFrame.WWHJavaScript.mPanels.mPopup.fShow(ParamEntryID, ParamEvent);\n");
  331.   HTML.fAppend("  }\n");
  332.   HTML.fAppend("\n");
  333.   HTML.fAppend("  function  fH()\n");
  334.   HTML.fAppend("  {\n");
  335.   HTML.fAppend("    WWHFrame.WWHJavaScript.mPanels.mPopup.fHide();\n");
  336.   HTML.fAppend("  }\n");
  337.   HTML.fAppend("  function  fN(ParamSectionIndex)\n");
  338.   HTML.fAppend("  {\n");
  339.   HTML.fAppend("    WWHFrame.WWHIndex.fChangeSection(ParamSectionIndex);\n");
  340.   HTML.fAppend("  }\n");
  341.   HTML.fAppend(" // -->\n");
  342.   HTML.fAppend("</script>\n");
  343.  
  344.   return HTML.fGetBuffer();
  345. }
  346.  
  347. function  WWHIndex_AdvanceHTMLSegment()
  348. {
  349.   var  MaxHTMLSegmentSize = WWHFrame.WWHJavaScript.mMaxHTMLSegmentSize;
  350.   var  Entry;
  351.   var  MaxIndex;
  352.   var  Index;
  353.   var  BaseEntryInfo = "";
  354.   var  EntryInfo;
  355.   var  EntryAnchorName;
  356.   var  EntryPrefix;
  357.   var  EntrySuffix;
  358.  
  359.  
  360.   // Add index in top entry to entry info if IteratorScope != TopEntry
  361.   //
  362.   if (this.mSectionIndex != null)
  363.   {
  364.     BaseEntryInfo += this.mSectionIndex;
  365.   }
  366.  
  367.   this.mHTMLSegment.fReset();
  368.   while ((this.mHTMLSegment.fSize() < MaxHTMLSegmentSize) &&
  369.          (this.mIterator.fAdvance()))
  370.   {
  371.     Entry = this.mIterator.mEntry;
  372.  
  373.     // Check to see if this entry should be displayed
  374.     //
  375.     if ((Entry.mbBucket) &&
  376.         ( ! Entry.mbShow))
  377.     {
  378.       // Don't display hidden buckets
  379.       //
  380.  
  381.       // Do display break between other entries and first required entry
  382.       //
  383.       if (Entry.mbFirstRequiredEntry)
  384.       {
  385.         this.mHTMLSegment.fAppend("<p> </p>\n");
  386.       } 
  387.     }
  388.     else
  389.     {
  390.       // Insert breaks between sections
  391.       //
  392.       if ((Entry.mbGroup) ||
  393.           (Entry.mbBucket))
  394.       {
  395.         this.mHTMLSegment.fAppend("<p> </p>\n");
  396.       }
  397.  
  398.       // See if entry needs a named anchor target
  399.       //
  400.       if (typeof Entry.mSeeAlsoTargetName == "string")
  401.       {
  402.         EntryAnchorName = " name=\"" + Entry.mSeeAlsoTargetName + "\"";
  403.       }
  404.       else
  405.       {
  406.         EntryAnchorName = "";
  407.       }
  408.  
  409.       // Determine entry type
  410.       //
  411.       if (Entry.mbGroup)
  412.       {
  413.         EntryPrefix = "<b>";
  414.         EntrySuffix = "</b>";
  415.       }
  416.       else if (Entry.mbBucket)
  417.       {
  418.         EntryPrefix = "<b>";
  419.         EntrySuffix = "</b>";
  420.       }
  421.       else if (typeof Entry.mSeeAlso == "string")
  422.       {
  423.         if (typeof Entry.mSeeAlsoTargetName == "string")
  424.         {
  425.           // Use position stack for link info
  426.           //
  427.           EntryInfo = BaseEntryInfo;
  428.           for (MaxIndex = this.mIterator.mPositionStack.length, Index = 0 ; Index < MaxIndex ; Index++)
  429.           {
  430.             if (EntryInfo.length > 0)
  431.             {
  432.               EntryInfo += ":";
  433.             }
  434.             EntryInfo += this.mIterator.mPositionStack[Index];
  435.           }
  436.  
  437.           EntryPrefix = "<i><a href=\"javascript:fA('" + EntryInfo + "');\"" + this.fGetPopupAction(EntryInfo) + ">";
  438.           EntrySuffix = "</a></i>";
  439.         }
  440.         else
  441.         {
  442.           EntryPrefix = "<i>";
  443.           EntrySuffix = "</i>";
  444.         }
  445.       }
  446.       else if (Entry.mBookLinks != null)
  447.       {
  448.         // Use position stack for link info
  449.         //
  450.         EntryInfo = BaseEntryInfo;
  451.         for (MaxIndex = this.mIterator.mPositionStack.length, Index = 0 ; Index < MaxIndex ; Index++)
  452.         {
  453.           if (EntryInfo.length > 0)
  454.           {
  455.             EntryInfo += ":";
  456.           }
  457.           EntryInfo += this.mIterator.mPositionStack[Index];
  458.         }
  459.  
  460.         EntryPrefix = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td>- </td><td height=\"22\"><a" + EntryAnchorName + " href=\"javascript:fC('" + EntryInfo + "');\" class=\"enf1\">";
  461.         EntrySuffix = "</a></td></tr></table></td></tr></table>";
  462.       }
  463.       else if (EntryAnchorName.length > 0)
  464.       {
  465.         EntryPrefix = "- <a class=\"AnchorOnly\"" + EntryAnchorName + ">";
  466.         EntrySuffix = "</a>";
  467.       }
  468.       else
  469.       {
  470.         EntryPrefix = "";
  471.         EntrySuffix = "";
  472.       }
  473.  
  474.       this.mHTMLSegment.fAppend("<p class=l" + (this.mIterator.mPositionStack.length - this.mIterator.mStackOffset) + ">" + EntryPrefix + Entry.mText + EntrySuffix + "</p>\n");
  475.     }
  476.   }
  477.  
  478.   return (this.mHTMLSegment.fSize() > 0);
  479. }
  480.  
  481. function  WWHIndex_GetHTMLSegment()
  482. {
  483.   return this.mHTMLSegment.fGetBuffer();
  484. }
  485.  
  486. function  WWHIndex_EndHTMLSegments()
  487. {
  488.   var  NavigationHTML = "";
  489.  
  490.  
  491.   if ((this.mOptions.mThreshold <= 0) ||
  492.       (this.mEntryCount < this.mOptions.mThreshold))
  493.   {
  494.     ;  // Nothing to do
  495.   }
  496.   else  // Display sections of the Index rather than the whole thing
  497.   {
  498.     // Display section selection
  499.     //
  500. // HACK BEN
  501. //    NavigationHTML += "<p> </p>\n";
  502. //    NavigationHTML += this.mSectionCache[this.mSectionIndex];
  503.   }
  504.  
  505.   return NavigationHTML;
  506. }
  507.  
  508. function  WWHIndex_HoverTextTranslate(ParamEntryInfo)
  509. {
  510.   var  Entry;
  511.  
  512.  
  513.   // Locate specified entry
  514.   //
  515.   Entry = this.fGetEntry(ParamEntryInfo);
  516.  
  517.   return Entry.mText;
  518. }
  519.  
  520. function  WWHIndex_HoverTextFormat(ParamWidth,
  521.                                    ParamTextID,
  522.                                    ParamText)
  523. {
  524.   var  FormattedText   = "";
  525.   var  ForegroundColor = WWHFrame.WWHJavaScript.mSettings.mHoverText.mForegroundColor;
  526.   var  BackgroundColor = WWHFrame.WWHJavaScript.mSettings.mHoverText.mBackgroundColor;  
  527.   var  BorderColor     = WWHFrame.WWHJavaScript.mSettings.mHoverText.mBorderColor;
  528.   var  ImageDir        = WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/common/images";
  529.   var  ReqSpacer1w2h   = "<img src=\"" + ImageDir + "/spc1w2h.gif\" width=1 height=2>";
  530.   var  ReqSpacer2w1h   = "<img src=\"" + ImageDir + "/spc2w1h.gif\" width=2 height=1>";
  531.   var  ReqSpacer1w7h   = "<img src=\"" + ImageDir + "/spc1w7h.gif\" width=1 height=7>";
  532.   var  ReqSpacer5w1h   = "<img src=\"" + ImageDir + "/spc5w1h.gif\" width=5 height=1>";
  533.   var  Spacer1w2h      = ReqSpacer1w2h;
  534.   var  Spacer2w1h      = ReqSpacer2w1h;
  535.   var  Spacer1w7h      = ReqSpacer1w7h;
  536.   var  Spacer5w1h      = ReqSpacer5w1h;
  537.  
  538.  
  539.   // Netscape 6.x (Mozilla) renders table cells with graphics
  540.   // incorrectly inside of <div> tags that are rewritten on the fly
  541.   //
  542.   if (WWHFrame.WWHBrowserInfo.mBrowser == 4)  // Shorthand for Netscape 6.x (Mozilla)
  543.   {
  544.     Spacer1w2h = "";
  545.     Spacer2w1h = "";
  546.     Spacer1w7h = "";
  547.     Spacer5w1h = "";
  548.   }
  549.  
  550.   FormattedText += "<table width=\"" + ParamWidth + "\" border=0 cellspacing=0 cellpadding=0 bgcolor=\"" + BackgroundColor + "\">";
  551.   FormattedText += " <tr>";
  552.   FormattedText += "  <td height=2 colspan=5 bgcolor=\"" + BorderColor + "\">" + Spacer1w2h + "</td>";
  553.   FormattedText += " </tr>";
  554.  
  555.   FormattedText += " <tr>";
  556.   FormattedText += "  <td height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  557.   FormattedText += "  <td height=7 colspan=3>" + Spacer1w7h + "</td>";
  558.   FormattedText += "  <td height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  559.   FormattedText += " </tr>";
  560.  
  561.   FormattedText += " <tr>";
  562.   FormattedText += "  <td bgcolor=\"" + BorderColor + "\">" + ReqSpacer2w1h + "</td>";
  563.   FormattedText += "  <td>" + ReqSpacer5w1h + "</td>";
  564.   FormattedText += "  <td width=\"100%\" id=\"" + ParamTextID + "\" style=\"color: " + ForegroundColor + " ; " + WWHFrame.WWHJavaScript.mSettings.mHoverText.mFontStyle + "\">" + ParamText + "</td>";
  565.   FormattedText += "  <td>" + ReqSpacer5w1h + "</td>";
  566.   FormattedText += "  <td bgcolor=\"" + BorderColor + "\">" + ReqSpacer2w1h + "</td>";
  567.   FormattedText += " </tr>";
  568.  
  569.   FormattedText += " <tr>";
  570.   FormattedText += "  <td height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  571.   FormattedText += "  <td height=7 colspan=3>" + Spacer1w7h + "</td>";
  572.   FormattedText += "  <td height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  573.   FormattedText += " </tr>";
  574.  
  575.   FormattedText += " <tr>";
  576.   FormattedText += "  <td height=2 colspan=5 bgcolor=\"" + BorderColor + "\">" + Spacer1w2h + "</td>";
  577.   FormattedText += " </tr>";
  578.   FormattedText += "</table>";
  579.  
  580.   return FormattedText;
  581. }
  582.  
  583. function  WWHIndex_GetPopupAction(ParamEntryInfo)
  584. {
  585.   var  PopupAction = "";
  586.  
  587.  
  588.   if (WWHFrame.WWHJavaScript.mSettings.mHoverText.mbEnabled)
  589.   {
  590.     PopupAction += " onMouseOver=\"fS('" + ParamEntryInfo + "', " + this.mEventString + ");\"";
  591.     PopupAction += " onMouseOut=\"fH();\"";
  592.   }
  593.  
  594.   return PopupAction;
  595. }
  596.  
  597. function  WWHIndex_ThresholdExceeded()
  598. {
  599.   var  bThresholdExceeded;
  600.  
  601.  
  602.   if ((this.mOptions.mThreshold > 0) &&
  603.       (this.mEntryCount > this.mOptions.mThreshold))
  604.   {
  605.     bThresholdExceeded = true;
  606.   }
  607.   else
  608.   {
  609.     bThresholdExceeded = false;
  610.   }
  611.  
  612.   return bThresholdExceeded;
  613. }
  614.  
  615. function  WWHIndex_GetSectionNavigation(ParamSection)
  616. {
  617.   var  SectionNavHTML = "";
  618.   var  SectionArray;
  619.   var  MaxIndex;
  620.   var  Index;
  621.  
  622.  
  623.   SectionNavHTML += "<p class=\"navigation\">";
  624.  
  625.   // Calculate section selection
  626.   //
  627.   SectionArray = this.mTopEntry.mChildrenSortArray;
  628.   for (MaxIndex = SectionArray.length, Index = 0 ; Index < MaxIndex ; Index++)
  629.   {
  630.     // Add spacers if necessary
  631.     //
  632.     if (Index > 0)
  633.     {
  634.       SectionNavHTML += this.mOptions.mSeperator;
  635.     }
  636.  
  637.     // Display section with or without link as necessary
  638.     //
  639.     if (Index == this.mSectionIndex)  // Currently being displayed
  640.     {
  641.       SectionNavHTML += SectionArray[Index].mText;
  642.     }
  643.     else if ((SectionArray[Index].mChildren == null) &&         // Always display group
  644.              (SectionArray[Index].mChildrenSortArray == null))  // SortArray null before sort, hash null after
  645.     {
  646.       SectionNavHTML += "<font color=\"" + WWHFrame.WWHJavaScript.mSettings.mIndex.mNavigationDisabledColor + "\">" + SectionArray[Index].mText + "</font>";
  647.     }
  648.     else
  649.     {
  650.       SectionNavHTML += "<a class=\"navigation\" href=\"javascript:fN(" + Index + ");\">" + SectionArray[Index].mText + "</a>";
  651.     }
  652.   }
  653.  
  654.   SectionNavHTML += "</p>";
  655.  
  656.   return SectionNavHTML;
  657. }
  658.  
  659. function  WWHIndex_ChangeSection(ParamSectionIndex)
  660. {
  661.   // Set section
  662.   //
  663.   this.mSectionIndex = ParamSectionIndex;
  664.  
  665.   // Reload panel
  666.   //
  667.   WWHFrame.WWHJavaScript.mPanels.fClearScrollPosition();
  668.   WWHFrame.WWHJavaScript.mPanels.fDisplayPanel();
  669. }
  670.  
  671. function  WWHIndex_SelectionListHeadHTML()
  672. {
  673.   var  HTML = new WWHStringBuffer_Object();
  674.   var  Level;
  675.  
  676.  
  677.   HTML.fAppend("<style type=\"text/css\">\n");
  678.   HTML.fAppend(" <!--\n");
  679.   HTML.fAppend("  a { text-decoration: none ;\n");
  680.   HTML.fAppend("      color: " + WWHFrame.WWHJavaScript.mSettings.mIndex.mEnabledColor + " }\n");
  681.   HTML.fAppend("  p { margin-top: 1pt ;\n");
  682.   HTML.fAppend("      margin-bottom: 1pt ;\n");
  683.   HTML.fAppend("      color: " + WWHFrame.WWHJavaScript.mSettings.mIndex.mDisabledColor + " ;\n");
  684.   HTML.fAppend("      " + WWHFrame.WWHJavaScript.mSettings.mIndex.mFontStyle + " }\n");
  685.   for (Level = 1 ; Level < 3 ; Level++)
  686.   {
  687.     HTML.fAppend("  p.l" + Level + " { margin-left: " + (WWHFrame.WWHJavaScript.mSettings.mIndex.mIndent * Level) + "pt }\n");
  688.   }
  689.   HTML.fAppend("  h2 { " + WWHFrame.WWHJavaScript.mSettings.mIndex.mFontStyle + " }\n");
  690.   HTML.fAppend(" -->\n");
  691.   HTML.fAppend("</style>\n");
  692.  
  693.   return HTML.fGetBuffer();
  694. }
  695.  
  696. function  WWHIndex_SelectionListBodyHTML()
  697. {
  698.   var  HTML = new WWHStringBuffer_Object();
  699.   var  BookList = WWHFrame.WWHHelp.mBooks.mBookList;
  700.   var  MaxBookIndex;
  701.   var  BookIndex;
  702.   var  BookListEntry;
  703.   var  LinkArray;
  704.   var  MaxLinkIndex;
  705.   var  LinkIndex;
  706.   var  Parts;
  707.   var  PrevLinkFileIndex;
  708.   var  LinkFileIndex;
  709.   var  LinkAnchor;
  710.   var  DocumentURL;
  711.  
  712.  
  713.   // Display multiple entry message
  714.   //
  715.   HTML.fAppend("<h2>");
  716.   HTML.fAppend(WWHFrame.WWHJavaScript.mMessages.mIndexSelectMessage1 + " ");
  717.   HTML.fAppend(WWHFrame.WWHJavaScript.mMessages.mIndexSelectMessage2);
  718.   HTML.fAppend("</h2>\n");
  719.  
  720.   // Display text of entry clicked
  721.   //
  722.   HTML.fAppend("<p><b>" + this.mClickedEntry.mText + "</b></p>\n");
  723.  
  724.   // Display each book's link for this entry
  725.   //
  726.   for (MaxBookIndex = BookList.length, BookIndex = 0 ; BookIndex < MaxBookIndex ; BookIndex++)
  727.   {
  728.     if (typeof this.mClickedEntry.mBookLinks[BookIndex] != "undefined")
  729.     {
  730.       BookListEntry = BookList[BookIndex];
  731.  
  732.       // Write the book's title
  733.       //
  734.       HTML.fAppend("<p> </p>\n");
  735.       HTML.fAppend("<p class=l1><nobr><b>" + BookListEntry.mTitle + "</b>");
  736.  
  737.       // Sort link array to group files with anchors
  738.       //
  739.       // Use for loop to copy entries to workaround bug/problem in IE 5.0 on Windows
  740.       //
  741.       LinkArray = new Array();
  742.       for (MaxLinkIndex = this.mClickedEntry.mBookLinks[BookIndex].length, LinkIndex = 0 ; LinkIndex < MaxLinkIndex ; LinkIndex++)
  743.       {
  744.         LinkArray[LinkIndex] = this.mClickedEntry.mBookLinks[BookIndex][LinkIndex];
  745.       }
  746.       LinkArray = LinkArray.sort();
  747.  
  748.       // Now display file links
  749.       //
  750.       PrevLinkFileIndex = null;
  751.       for (MaxLinkIndex = LinkArray.length, LinkIndex = 0 ; LinkIndex < MaxLinkIndex ; LinkIndex++)
  752.       {
  753.         // Determine link file index and anchor
  754.         //
  755.         Parts = LinkArray[LinkIndex].split("#");
  756.         LinkFileIndex = parseInt(Parts[0]);
  757.         if (Parts.length > 1)
  758.         {
  759.           LinkAnchor = "#" + Parts[1];
  760.         }
  761.         else
  762.         {
  763.           LinkAnchor = "";
  764.         }
  765.  
  766.         // Determine if all links for a single document have been processed
  767.         //
  768.         if ((PrevLinkFileIndex == null) ||
  769.             (LinkFileIndex != PrevLinkFileIndex))
  770.         {
  771.           HTML.fAppend("</nobr></p>\n");
  772.  
  773.           // Build up absolute link URL
  774.           //
  775.           DocumentURL = WWHFrame.WWHHelp.mBaseURL + BookListEntry.mDirectory + BookListEntry.mFiles.fFileIndexToHREF(LinkFileIndex) + LinkAnchor;
  776.           DocumentURL = WWHStringUtilities_RestoreEscapedSpaces(DocumentURL);
  777.           DocumentURL = WWHStringUtilities_EscapeURLForJavaScriptAnchor(DocumentURL);
  778.  
  779.           HTML.fAppend("<p class=l2><nobr>");
  780.           HTML.fAppend("<a href=\"javascript:WWHFrame.WWHIndex.fDisplayLink('" + DocumentURL + "');\">");
  781.           HTML.fAppend(BookListEntry.mFiles.fFileIndexToTitle(LinkFileIndex) + "</a>");
  782.         }
  783.         else
  784.         {
  785.           // Build up absolute link URL
  786.           //
  787.           DocumentURL = WWHFrame.WWHHelp.mBaseURL + BookListEntry.mDirectory + BookListEntry.mFiles.fFileIndexToHREF(LinkFileIndex) + LinkAnchor;
  788.           DocumentURL = WWHStringUtilities_RestoreEscapedSpaces(DocumentURL);
  789.           DocumentURL = WWHStringUtilities_EscapeURLForJavaScriptAnchor(DocumentURL);
  790.  
  791.           HTML.fAppend(", ");
  792.           HTML.fAppend("<a href=\"javascript:WWHFrame.WWHIndex.fDisplayLink('" + DocumentURL + "');\">");
  793.           HTML.fAppend((LinkIndex + 1) + "</a>");
  794.         }
  795.  
  796.         PrevLinkFileIndex = LinkFileIndex;
  797.       }
  798.  
  799.       HTML.fAppend("</nobr></p>\n");
  800.     }
  801.   }
  802.  
  803.   return HTML.fGetBuffer();
  804. }
  805.  
  806. function  WWHIndex_DisplayLink(ParamURL)
  807. {
  808.   WWHFrame.WWHHelp.fSetDocumentHREF(ParamURL, false);
  809. }
  810.  
  811. function  WWHIndex_GetEntry(ParamEntryInfo)
  812. {
  813.   var  Entry = null;
  814.   var  EntryInfoParts;
  815.   var  MaxIndex;
  816.   var  Index;
  817.  
  818.  
  819.   // Locate specified entry
  820.   //
  821.   Entry = this.mTopEntry;
  822.   EntryInfoParts = ParamEntryInfo.split(":");
  823.   for (MaxIndex = EntryInfoParts.length, Index = 0 ; Index < MaxIndex ; Index++)
  824.   {
  825.     Entry = Entry.mChildrenSortArray[EntryInfoParts[Index]];
  826.   }
  827.  
  828.   return Entry;
  829. }
  830.  
  831. function  WWHIndex_ClickedEntry(ParamEntryInfo)
  832. {
  833.   var  Entry;
  834.   var  BookCount;
  835.   var  BookIndex;
  836.   var  BookListEntry;
  837.   var  Parts;
  838.   var  LinkFileIndex;
  839.   var  LinkAnchor;
  840.   var  DocumentURL;
  841.  
  842.  
  843.   // Locate specified entry
  844.   //
  845.   Entry = this.fGetEntry(ParamEntryInfo);
  846.  
  847.   // Display target document or selection list
  848.   //
  849.   BookCount = 0;
  850.   for (BookIndex in Entry.mBookLinks)
  851.   {
  852.     BookCount++;
  853.   }
  854.  
  855.   // See if this is a single entry
  856.   //
  857.   if ((BookCount == 1) &&
  858.       (Entry.mBookLinks[BookIndex].length == 1))
  859.   {
  860.     BookListEntry = WWHFrame.WWHHelp.mBooks.mBookList[BookIndex];
  861.  
  862.     // Determine link file index and anchor
  863.     //
  864.     Parts = Entry.mBookLinks[BookIndex][0].split("#");
  865.     LinkFileIndex = parseInt(Parts[0]);
  866.     if (Parts.length > 1)
  867.     {
  868.       LinkAnchor = "#" + Parts[1];
  869.     }
  870.     else
  871.     {
  872.       LinkAnchor = "";
  873.     }
  874.  
  875.     // Set Document
  876.     //
  877.     DocumentURL = WWHFrame.WWHHelp.mBaseURL + BookListEntry.mDirectory + BookListEntry.mFiles.fFileIndexToHREF(LinkFileIndex) + LinkAnchor;
  878.   }
  879.   else
  880.   {
  881.     // Display selection list
  882.     //
  883.     this.mClickedEntry = Entry;
  884.     DocumentURL = WWHFrame.WWHHelp.mBaseURL + "wwhelp/wwhimpl/js/html/indexsel.htm";
  885.   }
  886.  
  887.   this.fDisplayLink(DocumentURL);
  888. }
  889.  
  890. function  WWHIndex_ClickedSeeAlsoEntry(ParamEntryInfo)
  891. {
  892.   var  Entry;
  893.   var  TargetSectionIndex;
  894.   var  MaxIndex;
  895.   var  Index;
  896.  
  897.  
  898.   // Locate specified entry
  899.   //
  900.   Entry = this.fGetEntry(ParamEntryInfo);
  901.  
  902.   // Confirm entry has target information
  903.   //
  904.   if ((typeof Entry.mSeeAlsoTargetName == "string") &&
  905.       (typeof Entry.mSeeAlsoTargetEntryKey == "string"))
  906.   {
  907.     TargetSectionIndex = null;
  908.  
  909.     // Determine if we need to jump to another page
  910.     //
  911.     if (this.fThresholdExceeded())
  912.     {
  913.       MaxIndex = this.mTopEntry.mChildrenSortArray.length;
  914.       Index = 0;
  915.       while ((TargetSectionIndex == null) &&
  916.              (Index < MaxIndex))
  917.       {
  918.         if (this.mTopEntry.mChildrenSortArray[Index].mText == Entry.mSeeAlsoTargetEntryKey)
  919.         {
  920.           TargetSectionIndex = Index;
  921.         }
  922.  
  923.         Index++;
  924.       }
  925.     }
  926.  
  927.     // Set target entry
  928.     //
  929.     this.mPanelAnchor = Entry.mSeeAlsoTargetName;
  930.  
  931.     if (((TargetSectionIndex != null) &&
  932.          (this.mSectionIndex != null)) &&
  933.         (TargetSectionIndex != this.mSectionIndex))
  934.     {
  935.       // Need to switch to proper section
  936.       //
  937.       this.fChangeSection(TargetSectionIndex);
  938.     }
  939.     else
  940.     {
  941.       // We're on the right page, so just jump to the correct entry
  942.       //
  943.       WWHFrame.WWHJavaScript.mPanels.fJumpToAnchor();
  944.     }
  945.   }
  946. }
  947.  
  948. function  WWHIndexIterator_Object()
  949. {
  950.   this.mIteratorScope      = null;
  951.   this.mEntry              = null;
  952.   this.mParentStack        = new Array();
  953.   this.mPositionStack      = new Array();
  954.   this.mbThresholdExceeded = false;
  955.   this.mStackOffset        = 1;
  956.  
  957.   this.fReset   = WWHIndexIterator_Reset;
  958.   this.fAdvance = WWHIndexIterator_Advance;
  959. }
  960.  
  961. function  WWHIndexIterator_Reset(ParamIndex,
  962.                                  bParamThresholdExceeded)
  963. {
  964.   if (ParamIndex == null)  // Iterate buckets as well!
  965.   {
  966.     this.mIteratorScope = WWHFrame.WWHIndex.mTopEntry;
  967.   }
  968.   else
  969.   {
  970.     this.mIteratorScope = WWHFrame.WWHIndex.mTopEntry.mChildrenSortArray[ParamIndex];
  971.   }
  972.   this.mEntry                = this.mIteratorScope;
  973.   this.mParentStack.length   = 0;
  974.   this.mPositionStack.length = 0;
  975.   this.mbThresholdExceeded   = bParamThresholdExceeded;
  976.   this.mStackOffset          = 1;
  977. }
  978.  
  979. function  WWHIndexIterator_Advance()
  980. {
  981.   // Advance to the next visible entry
  982.   //
  983.   if (this.mEntry != null)
  984.   {
  985.     // Check for children
  986.     //
  987.     if (this.mEntry.mChildren != null)
  988.     {
  989.       // Determine sort order if necessary
  990.       //
  991.       if (this.mEntry.mChildrenSortArray == null)
  992.       {
  993.         WWHIndexEntry_SortChildren(this.mEntry);
  994.       }
  995.     }
  996.  
  997.     // Process children
  998.     //
  999.     if (this.mEntry.mChildrenSortArray != null)
  1000.     {
  1001.       // Modify stack offset as needed
  1002.       //
  1003.       if (( ! this.mbThresholdExceeded) &&
  1004.           (this.mEntry.mbBucket) &&
  1005.           ( ! this.mEntry.mbShow))
  1006.       {
  1007.         this.mStackOffset += 1;
  1008.       }
  1009.  
  1010.       this.mParentStack[this.mParentStack.length] = this.mEntry;
  1011.       this.mPositionStack[this.mPositionStack.length] = 0;
  1012.       this.mEntry = this.mEntry.mChildrenSortArray[0];
  1013.     }
  1014.     // If we've reached the iterator scope, we're done
  1015.     //
  1016.     else if (this.mEntry == this.mIteratorScope)
  1017.     {
  1018.       this.mEntry = null;
  1019.     }
  1020.     else
  1021.     {
  1022.       var  ParentEntry;
  1023.       var  StackTop;
  1024.  
  1025.  
  1026.       ParentEntry = this.mParentStack[this.mParentStack.length - 1];
  1027.       this.mEntry = null;
  1028.  
  1029.       // Find next child of parent entry
  1030.       //
  1031.       while (ParentEntry != null)
  1032.       {
  1033.         // Increment position
  1034.         //
  1035.         StackTop = this.mPositionStack.length - 1;
  1036.         this.mPositionStack[StackTop]++;
  1037.  
  1038.         // Confirm this is a valid entry
  1039.         //
  1040.         if (this.mPositionStack[StackTop] < ParentEntry.mChildrenSortArray.length)
  1041.         {
  1042.           // Return the parent's next child
  1043.           //
  1044.           this.mEntry = ParentEntry.mChildrenSortArray[this.mPositionStack[StackTop]];
  1045.  
  1046.           // Signal break from loop
  1047.           //
  1048.           ParentEntry = null;
  1049.         }
  1050.         else
  1051.         {
  1052.           // Last child of parent, try up a level
  1053.           //
  1054.           if (ParentEntry == this.mIteratorScope)
  1055.           {
  1056.             ParentEntry = null;
  1057.           }
  1058.           else
  1059.           {
  1060.             // Restore stack offset as needed
  1061.             //
  1062.             if (( ! this.mbThresholdExceeded) &&
  1063.                 (ParentEntry.mbBucket) &&
  1064.                 ( ! ParentEntry.mbShow))
  1065.             {
  1066.               this.mStackOffset -= 1;
  1067.             }
  1068.  
  1069.             ParentEntry = ParentEntry.mParent;
  1070.             this.mParentStack.length--;
  1071.             this.mPositionStack.length--;
  1072.  
  1073.             ParentEntry = this.mParentStack[this.mParentStack.length - 1];
  1074.           }
  1075.         }
  1076.       }
  1077.     }
  1078.   }
  1079.  
  1080.   return (this.mEntry != null);
  1081. }
  1082.  
  1083. function  WWHIndexTopEntry_Object()
  1084. {
  1085.   this.mLevel             = -1;
  1086.   this.mChildren          = null;
  1087.   this.mChildrenSortArray = null;
  1088.  
  1089.   this.fGetGroup = WWHIndexTopEntry_GetGroup;
  1090.   this.fAddEntry = WWHIndexTopEntry_AddEntry;
  1091.   this.fA        = WWHIndexTopEntry_AddEntry;
  1092. }
  1093.  
  1094. function  WWHIndexTopEntry_GetGroup(ParamGroupTitle)
  1095. {
  1096.   var  GroupEntry;
  1097.  
  1098.  
  1099.   // See if this object has any children
  1100.   //
  1101.   if (this.mChildren == null)
  1102.   {
  1103.     this.mChildren = new WWHIndexEntryHash_Object();
  1104.   }
  1105.  
  1106.   // Access entry, creating it if it doesn't exist
  1107.   //
  1108.   GroupEntry = this.mChildren[ParamGroupTitle];
  1109.   if (typeof GroupEntry == "undefined")
  1110.   {
  1111.     GroupEntry = new WWHIndexEntry_Object(0, 0, WWHStringUtilities_EscapeHTML(ParamGroupTitle), null, null);
  1112.     GroupEntry.mbGroup = true;
  1113.     this.mChildren[ParamGroupTitle] = GroupEntry;
  1114.   }
  1115.  
  1116.   return GroupEntry;
  1117. }
  1118.  
  1119. function  WWHIndexTopEntry_AddEntry(ParamText,
  1120.                                     ParamLinks,
  1121.                                     ParamSortKey,
  1122.                                     ParamSeeAlso)
  1123. {
  1124.   var  FirstChar = "";
  1125.   var  GroupTitle;
  1126.   var  GroupEntry;
  1127.   var  BucketEntry;
  1128.   var  NewEntry;
  1129.  
  1130.  
  1131.   // Grab first character
  1132.   //
  1133.   if ((typeof ParamSortKey == "string") &&
  1134.       (ParamSortKey.length > 0))
  1135.   {
  1136.     FirstChar = ParamSortKey.substring(0, 1);
  1137.  
  1138.     // Check for encoded characters
  1139.     //
  1140.     if (FirstChar == "&")
  1141.     {
  1142.       FirstChar = WWHStringUtilities_UnescapeHTML(ParamSortKey);
  1143.  
  1144.       FirstChar = FirstChar.substring(0, 1);
  1145.     }
  1146.  
  1147.     // toUpperCase is conditional to handle numbers
  1148.     //
  1149.     FirstChar = (typeof FirstChar.toUpperCase == "function") ? FirstChar.toUpperCase() : FirstChar;
  1150.   }
  1151.   else if (ParamText.length > 0)
  1152.   {
  1153.     FirstChar = ParamText.substring(0, 1);
  1154.  
  1155.     // Check for encoded characters
  1156.     //
  1157.     if (FirstChar == "&")
  1158.     {
  1159.       FirstChar = WWHStringUtilities_UnescapeHTML(ParamText);
  1160.  
  1161.       FirstChar = FirstChar.substring(0, 1);
  1162.     }
  1163.  
  1164.     // toUpperCase is conditional to handle numbers
  1165.     //
  1166.     FirstChar = (typeof FirstChar.toUpperCase == "function") ? FirstChar.toUpperCase() : FirstChar;
  1167.   }
  1168.  
  1169.   // Check for a group
  1170.   //
  1171.   GroupTitle = WWHFrame.WWHIndex.mOptions.mGroupMapping[FirstChar];
  1172.   if (typeof GroupTitle == "undefined")
  1173.   {
  1174.     GroupTitle = "";  // Put in required grouping
  1175.   }
  1176.  
  1177.   // Access group
  1178.   //
  1179.   GroupEntry = this.fGetGroup(GroupTitle);
  1180.  
  1181.   // Access bucket
  1182.   //
  1183.   BucketEntry = GroupEntry.fGetBucket(FirstChar, WWHFrame.WWHIndex.mOptions.mGroupInfoHash[GroupTitle].mbShowBuckets);
  1184.  
  1185.   // Add entry
  1186.   //
  1187.   NewEntry = BucketEntry.fAddEntry(ParamText, ParamLinks, ParamSortKey, ParamSeeAlso);
  1188.  
  1189.   return NewEntry;
  1190. }
  1191.  
  1192. function  WWHIndexEntry_Object(ParamBookIndex,
  1193.                                ParamLevel,
  1194.                                ParamText,
  1195.                                ParamLinks,
  1196.                                ParamSeeAlso)
  1197. {
  1198.   this.mText              = ParamText;
  1199.   this.mBookLinks         = null;
  1200.   this.mLevel             = ParamLevel;
  1201.   this.mChildren          = null;
  1202.   this.mChildrenSortArray = null;
  1203.  
  1204.   if (typeof ParamSeeAlso == "string")
  1205.   {
  1206.     this.mSeeAlso = ParamSeeAlso;
  1207.   }
  1208.  
  1209.   this.fGetBucket = WWHIndexEntry_GetBucket;
  1210.   this.fAddEntry  = WWHIndexEntry_AddEntry;
  1211.   this.fA         = WWHIndexEntry_AddEntry;
  1212.  
  1213.   // Bump MaxLevel if exceeded
  1214.   //
  1215.   if (WWHFrame.WWHIndex.mMaxLevel < this.mLevel)
  1216.   {
  1217.     WWHFrame.WWHIndex.mMaxLevel = this.mLevel;
  1218.   }
  1219.  
  1220.   // Bump entry count
  1221.   //
  1222.   WWHFrame.WWHIndex.mEntryCount++;
  1223.  
  1224.   // Add links
  1225.   //
  1226.   if ((typeof ParamLinks != "undefined") &&
  1227.       (ParamLinks != null))
  1228.   {
  1229.     this.mBookLinks = new WWHIndexEntryBookHash_Object();
  1230.     this.mBookLinks[ParamBookIndex] = ParamLinks;
  1231.   }
  1232. }
  1233.  
  1234. function  WWHIndexEntry_GetBucket(ParamText,
  1235.                                   bParamShow)
  1236. {
  1237.   var  BucketEntry;
  1238.  
  1239.  
  1240.   // See if this object has any children
  1241.   //
  1242.   if (this.mChildren == null)
  1243.   {
  1244.     this.mChildren = new WWHIndexEntryHash_Object();
  1245.   }
  1246.  
  1247.   // Access entry, creating it if it doesn't exist
  1248.   //
  1249.   BucketEntry = this.mChildren[ParamText];
  1250.   if (typeof BucketEntry == "undefined")
  1251.   {
  1252.     var  Level;
  1253.  
  1254.  
  1255.     // Keep level the same if buckets not visible
  1256.     //
  1257.     if (bParamShow)
  1258.     {
  1259.       Level = this.mLevel + 1;
  1260.     }
  1261.     else
  1262.     {
  1263.       Level = this.mLevel;
  1264.     }
  1265.  
  1266.     BucketEntry = new WWHIndexEntry_Object(0, Level, WWHStringUtilities_EscapeHTML(ParamText), null, null);
  1267.     BucketEntry.mbBucket      = true;
  1268.     BucketEntry.mbShow        = bParamShow;
  1269.     this.mChildren[ParamText] = BucketEntry;
  1270.   }
  1271.  
  1272.   return BucketEntry;
  1273. }
  1274.  
  1275. function  WWHIndexEntry_AddEntry(ParamText,
  1276.                                  ParamLinks,
  1277.                                  ParamSortKey,
  1278.                                  ParamSeeAlso)
  1279. {
  1280.   var  HashKey;
  1281.   var  ChildEntry;
  1282.   var  BookIndex = WWHFrame.WWHIndex.mInitIndex;
  1283.   var  Links     = null;
  1284.  
  1285.  
  1286.   // Set links if entries exist
  1287.   //
  1288.   if ((typeof ParamLinks != "undefined") &&
  1289.       (ParamLinks != null) &&
  1290.       (ParamLinks.length > 0))
  1291.   {
  1292.     Links = ParamLinks;
  1293.   }
  1294.  
  1295.   // See if this object has any children
  1296.   //
  1297.   if (this.mChildren == null)
  1298.   {
  1299.     this.mChildren = new WWHIndexEntryHash_Object();
  1300.   }
  1301.  
  1302.   // Access entry, creating it if it doesn't exist
  1303.   //
  1304.   HashKey = ((typeof ParamSortKey == "string") ? ParamSortKey : "") + ParamText;
  1305.   ChildEntry = this.mChildren[HashKey];
  1306.   if (typeof ChildEntry == "undefined")
  1307.   {
  1308.     ChildEntry = new WWHIndexEntry_Object(BookIndex, this.mLevel + 1, ParamText, Links, ParamSeeAlso);
  1309.     this.mChildren[HashKey] = ChildEntry;
  1310.  
  1311.     // Add entry to see also collection if it is a see also entry
  1312.     //
  1313.     if (typeof ParamSeeAlso == "string")
  1314.     {
  1315.       WWHFrame.WWHIndex.fAddSeeAlsoEntry(ChildEntry);
  1316.     }
  1317.   }
  1318.   else  // Child entry exists, update with new information
  1319.   {
  1320.     // Add book links
  1321.     //
  1322.     if (Links != null)
  1323.     {
  1324.       if (ChildEntry.mBookLinks == null)
  1325.       {
  1326.         ChildEntry.mBookLinks = new WWHIndexEntryBookHash_Object();
  1327.       }
  1328.  
  1329.       if (typeof ChildEntry.mBookLinks[BookIndex] == "undefined")
  1330.       {
  1331.         ChildEntry.mBookLinks[BookIndex] = Links;
  1332.       }
  1333.       else  // Append new links
  1334.       {
  1335.         var  BookLinks = ChildEntry.mBookLinks[BookIndex];
  1336.         var  MaxIndex;
  1337.         var  Index;
  1338.  
  1339.  
  1340.         for (MaxIndex = Links.length, Index = 0 ; Index < MaxIndex ; Index++)
  1341.         {
  1342.           BookLinks[BookLinks.length] = Links[Index];
  1343.         }
  1344.       }
  1345.     }
  1346.   }
  1347.  
  1348.   return ChildEntry;
  1349. }
  1350.  
  1351. function  WWHIndexEntry_SortChildren(ParamEntry)
  1352. {
  1353.   var  SortedArray;
  1354.  
  1355.  
  1356.   // Sort top entry according to group order
  1357.   //
  1358.   if (ParamEntry == WWHFrame.WWHIndex.mTopEntry)
  1359.   {
  1360.     var  GroupList = WWHFrame.WWHIndex.mOptions.mGroupList;
  1361.     var  MaxGroupIndex;
  1362.     var  GroupIndex;
  1363.     var  GroupEntry;
  1364.  
  1365.  
  1366.     // Accumulate entries in sort order
  1367.     //
  1368.     SortedArray = new Array();
  1369.     for (MaxGroupIndex = GroupList.length, GroupIndex = 0 ; GroupIndex < MaxGroupIndex ; GroupIndex++)
  1370.     {
  1371.       GroupEntry = ParamEntry.mChildren[GroupList[GroupIndex]];
  1372.       if (typeof GroupEntry != "undefined")
  1373.       {
  1374.         if (GroupList[GroupIndex].length == 0)  // Required group list found
  1375.         {
  1376.           // Sort required group entries
  1377.           //
  1378.           WWHIndexEntry_SortChildren(GroupEntry);
  1379.  
  1380.           // Add children to sorted array
  1381.           //
  1382.           for (MaxIndex = GroupEntry.mChildrenSortArray.length, Index = 0 ; Index < MaxIndex ; Index++)
  1383.           {
  1384.             SortedArray[SortedArray.length] = GroupEntry.mChildrenSortArray[Index];
  1385.  
  1386.             // Mark first required group entry
  1387.             //
  1388.             if (Index == 0)
  1389.             {
  1390.               SortedArray[SortedArray.length - 1].mbFirstRequiredEntry = true;
  1391.             }
  1392.           }
  1393.         }
  1394.         else
  1395.         {
  1396.           SortedArray[SortedArray.length] = GroupEntry;
  1397.         }
  1398.       }
  1399.     }
  1400.   }
  1401.   else
  1402.   {
  1403.     var  UnsortedArray;
  1404.     var  HashKey;
  1405.     var  SortKey;
  1406.     var  MaxIndex;
  1407.     var  Index;
  1408.  
  1409.  
  1410.     // Accumulate hash keys
  1411.     //
  1412.     UnsortedArray = new Array();
  1413.     for (HashKey in ParamEntry.mChildren)
  1414.     {
  1415.       // toUpperCase is conditional to handle numbers
  1416.       //
  1417.       SortKey = ((typeof HashKey.toUpperCase == "function") ? HashKey.toUpperCase() : HashKey) + "\n" + HashKey;
  1418.       UnsortedArray[UnsortedArray.length] = SortKey;
  1419.     }
  1420.  
  1421.     // Sort array
  1422.     //
  1423.     SortedArray = UnsortedArray.sort();
  1424.  
  1425.     // Replace sort keys with entries
  1426.     //
  1427.     for (MaxIndex = SortedArray.length, Index = 0 ; Index < MaxIndex ; Index++)
  1428.     {
  1429.       SortKey = SortedArray[Index];
  1430.       HashKey = SortKey.substring(SortKey.indexOf("\n") + 1, SortKey.length)
  1431.  
  1432.       SortedArray[Index] = ParamEntry.mChildren[HashKey];
  1433.     }
  1434.   }
  1435.  
  1436.   // Set children sort array
  1437.   // Clear hash table as it is no longer needed
  1438.   //
  1439.   ParamEntry.mChildrenSortArray = SortedArray;
  1440.   ParamEntry.mChildren = null;
  1441. }
  1442.  
  1443. function  WWHIndexEntryHash_Object()
  1444. {
  1445. }
  1446.  
  1447. function  WWHIndexEntryBookHash_Object()
  1448. {
  1449. }
  1450.  
  1451. function  WWHSectionCache_Object()
  1452. {
  1453. }
  1454.  
  1455. function  WWHIndexOptions_Object()
  1456. {
  1457.   this.mThreshold     = 0;
  1458.   this.mGroupList     = new Array();
  1459.   this.mGroupInfoHash = new WWHIndexOptionsGroupInfoHash_Object();
  1460.   this.mGroupMapping  = new WWHIndexOptionsGroupMapping_Object();
  1461.  
  1462.   this.fSetThreshold = WWHIndexOptions_SetThreshold;
  1463.   this.fSetSeperator = WWHIndexOptions_SetSeperator;
  1464.   this.fGroup        = WWHIndexOptions_Group;
  1465. }
  1466.  
  1467. function  WWHIndexOptions_SetThreshold(ParamThreshold)
  1468. {
  1469.   this.mThreshold = ParamThreshold;
  1470. }
  1471.  
  1472. function  WWHIndexOptions_SetSeperator(ParamSeperator)
  1473. {
  1474.   this.mSeperator = ParamSeperator;
  1475. }
  1476.  
  1477. function  WWHIndexOptions_Group(ParamGroupTitle,
  1478.                                 bParamAlwaysDisplay,
  1479.                                 bParamShowBuckets,
  1480.                                 ParamGroupEntries)
  1481. {
  1482.   var  GroupEntries;
  1483.   var  MaxIndex;
  1484.   var  Index;
  1485.  
  1486.  
  1487.   // Record display order
  1488.   //
  1489.   this.mGroupList[this.mGroupList.length] = ParamGroupTitle;
  1490.  
  1491.   // Record group info
  1492.   //
  1493.   if (ParamGroupTitle != "")
  1494.   {
  1495.     this.mGroupInfoHash[ParamGroupTitle] = new WWHIndexOptionsGroupInfo_Object(bParamAlwaysDisplay, bParamShowBuckets);
  1496.   }
  1497.   else  // Handle required group
  1498.   {
  1499.     this.mGroupInfoHash[ParamGroupTitle] = new WWHIndexOptionsGroupInfo_Object(true, bParamShowBuckets);
  1500.   }
  1501.  
  1502.   // Record entries for each group
  1503.   //
  1504.   GroupEntries = ParamGroupEntries.split("");
  1505.   for (MaxIndex = GroupEntries.length, Index = 0 ; Index < MaxIndex ; Index++)
  1506.   {
  1507.     if ((ParamGroupTitle.length == 0) ||                                  // Required items always have precendence
  1508.         (typeof this.mGroupMapping[GroupEntries[Index]] == "undefined"))  // Otherwise, prevent reseting entries
  1509.     {
  1510.       this.mGroupMapping[GroupEntries[Index]] = ParamGroupTitle;
  1511.     }
  1512.   }
  1513. }
  1514.  
  1515. function  WWHIndexOptionsGroupInfoHash_Object()
  1516. {
  1517. }
  1518.  
  1519. function  WWHIndexOptionsGroupInfo_Object(bParamAlwaysDisplay,
  1520.                                           bParamShowBuckets)
  1521. {
  1522.   this.mbAlwaysDisplay = bParamAlwaysDisplay;
  1523.   this.mbShowBuckets   = bParamShowBuckets;
  1524. }
  1525.  
  1526. function  WWHIndexOptionsGroupMapping_Object()
  1527. {
  1528. }
  1529.