// Copyright (c) 2005-2005 Quadralay Corporation.  All rights reserved.
//

function  WWHFavorites_Object()
{
  this.mbPanelInitialized = false;
  this.mPanelAnchor       = null;
  this.mPanelTabTitle     = WWHFrame.WWHJavaScript.mMessages.mTabsFavoritesLabel;
  this.mPanelTabIndex     = -1;
  this.mPanelFilename     = ((WWHFrame.WWHBrowser.mBrowser == 1) ? "panelfnf.htm" : "panelfsf.htm");
  this.mEventString       = WWHPopup_EventString();
  this.mFavorites         = new Array();
  this.mCurrent           = new WWHFavoritesEntry_Object(-1, -1, "");
  this.mDisplayIndex      = 0;
  this.mHTMLSegment       = new WWHStringBuffer_Object();

  this.fInitHeadHTML           = WWHFavorites_InitHeadHTML;
  this.fInitBodyHTML           = WWHFavorites_InitBodyHTML;
  this.fNavigationHeadHTML     = WWHFavorites_NavigationHeadHTML;
  this.fNavigationBodyHTML     = WWHFavorites_NavigationBodyHTML;
  this.fHeadHTML               = WWHFavorites_HeadHTML;
  this.fStartHTMLSegments      = WWHFavorites_StartHTMLSegments;
  this.fAdvanceHTMLSegment     = WWHFavorites_AdvanceHTMLSegment;
  this.fGetHTMLSegment         = WWHFavorites_GetHTMLSegment;
  this.fEndHTMLSegments        = WWHFavorites_EndHTMLSegments;
  this.fPanelNavigationLoaded  = WWHFavorites_PanelNavigationLoaded;
  this.fPanelViewLoaded        = WWHFavorites_PanelViewLoaded;
  this.fHoverTextTranslate     = WWHFavorites_HoverTextTranslate;
  this.fHoverTextFormat        = WWHFavorites_HoverTextFormat;
  this.fGetPopupAction         = WWHFavorites_GetPopupAction;
  this.fReadCookie             = WWHFavorites_ReadCookie;
  this.fWriteCookie            = WWHFavorites_WriteCookie;
  this.fClearCurrent           = WWHFavorites_ClearCurrent;
  this.fSetCurrent             = WWHFavorites_SetCurrent;
  this.fRecorded               = WWHFavorites_Recorded;
  this.fAdd                    = WWHFavorites_Add;
  this.fRemove                 = WWHFavorites_Remove;
  this.fClickedAdd             = WWHFavorites_ClickedAdd;
  this.fClickedRemove          = WWHFavorites_ClickedRemove;
  this.fClickedEntry           = WWHFavorites_ClickedEntry;
}

function  WWHFavorites_InitHeadHTML()
{
  return "";
}

function  WWHFavorites_InitBodyHTML()
{
  this.mHTMLSegment.fReset();

  // Display initializing message
  //
  this.mHTMLSegment.fAppend("<h2>" + WWHFrame.WWHJavaScript.mMessages.mInitializingMessage + "</h2>\n");

  // Read cookie
  //
  this.fReadCookie();

  // Initialized!
  //
  this.mbPanelInitialized = true;

  return this.mHTMLSegment.fGetBuffer();
}

function  WWHFavorites_NavigationHeadHTML()
{
  var  Settings = WWHFrame.WWHJavaScript.mSettings.mFavorites;

  this.mHTMLSegment.fReset()

  // Generate style section
  //
  this.mHTMLSegment.fAppend("<style type=\"text/css\">\n");
  this.mHTMLSegment.fAppend(" <!--\n");
  this.mHTMLSegment.fAppend("  div\n");
  this.mHTMLSegment.fAppend("  {\n");
  this.mHTMLSegment.fAppend("    margin-top: 1pt;\n");
  this.mHTMLSegment.fAppend("    margin-bottom: 1pt;\n");
  this.mHTMLSegment.fAppend("    " + Settings.mFontStyle + ";\n");
  this.mHTMLSegment.fAppend("  }\n");
  this.mHTMLSegment.fAppend(" -->\n");
  this.mHTMLSegment.fAppend("</style>\n");

  return this.mHTMLSegment.fGetBuffer();
}

function  WWHFavorites_NavigationBodyHTML()
{
  var  VarOnSubmitAttribute;
  var  VarButtonLabel;

  this.mHTMLSegment.fReset();

  // Current valid and/or known?
  //
  if ((this.mCurrent.mBookIndex >= 0) &&
      (this.mCurrent.mFileIndex >= 0))
  {
    // Recorded?
    //
    if (this.fRecorded(this.mCurrent.mBookIndex,
                       this.mCurrent.mFileIndex))
    {
      VarOnSubmitAttribute = " onsubmit=\"WWHFrame.WWHFavorites.fClickedRemove();\"";
      VarButtonLabel = WWHFrame.WWHJavaScript.mMessages.mFavoritesRemoveButtonLabel;
    }
    else
    {
      VarOnSubmitAttribute = " onsubmit=\"WWHFrame.WWHFavorites.fClickedAdd();\"";
      VarButtonLabel = WWHFrame.WWHJavaScript.mMessages.mFavoritesAddButtonLabel;
    }

    this.mHTMLSegment.fAppend("<form name=\"WWHFavoritesForm\"" + VarOnSubmitAttribute + ">\n");
    this.mHTMLSegment.fAppend(" <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"4px\">\n");
    this.mHTMLSegment.fAppend("  <tr>\n");
    this.mHTMLSegment.fAppend("   <td width=\"100%\">\n");
    this.mHTMLSegment.fAppend("    <table width=\"100%\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\">\n");
    this.mHTMLSegment.fAppend("     <tr>\n");
    this.mHTMLSegment.fAppend("      <td width=\"100%\">\n");
    this.mHTMLSegment.fAppend("<div>");
    this.mHTMLSegment.fAppend((this.mCurrent.mTitle.length > 0) ? this.mCurrent.mTitle : "&#160;");
    this.mHTMLSegment.fAppend("</div>");
    this.mHTMLSegment.fAppend("      </td>\n");
    this.mHTMLSegment.fAppend("     </tr>\n");
    this.mHTMLSegment.fAppend("    </table>\n");
    this.mHTMLSegment.fAppend("   </td>\n");
    this.mHTMLSegment.fAppend("   <td>\n");
    this.mHTMLSegment.fAppend("    <input type=\"submit\" value=\"" + VarButtonLabel + "\" />\n");
    this.mHTMLSegment.fAppend("   </td>\n");
    this.mHTMLSegment.fAppend("  </tr>\n");
    this.mHTMLSegment.fAppend(" </table>\n");
    this.mHTMLSegment.fAppend("</form>\n");
  }

  return this.mHTMLSegment.fGetBuffer();
}

function  WWHFavorites_HeadHTML()
{
  var  Settings = WWHFrame.WWHJavaScript.mSettings.mFavorites;

  this.mHTMLSegment.fReset()

  // Generate style section
  //
  this.mHTMLSegment.fAppend("<style type=\"text/css\">\n");
  this.mHTMLSegment.fAppend(" <!--\n");
  this.mHTMLSegment.fAppend("  a:active\n");
  this.mHTMLSegment.fAppend("  {\n");
  this.mHTMLSegment.fAppend("    text-decoration: none;\n");
  this.mHTMLSegment.fAppend("    background-color: " + Settings.mHighlightColor + ";\n");
  this.mHTMLSegment.fAppend("  }\n");
  this.mHTMLSegment.fAppend("  a:hover\n");
  this.mHTMLSegment.fAppend("  {\n");
  this.mHTMLSegment.fAppend("    text-decoration: underline;\n");
  this.mHTMLSegment.fAppend("    color: " + Settings.mEnabledColor + ";\n");
  this.mHTMLSegment.fAppend("  }\n");
  this.mHTMLSegment.fAppend("  a\n");
  this.mHTMLSegment.fAppend("  {\n");
  this.mHTMLSegment.fAppend("    text-decoration: none;\n");
  this.mHTMLSegment.fAppend("    color: " + Settings.mEnabledColor + ";\n");
  this.mHTMLSegment.fAppend("  }\n");
  this.mHTMLSegment.fAppend("  div\n");
  this.mHTMLSegment.fAppend("  {\n");
  this.mHTMLSegment.fAppend("    margin-top: 1pt;\n");
  this.mHTMLSegment.fAppend("    margin-bottom: 1pt;\n");
  this.mHTMLSegment.fAppend("    " + Settings.mFontStyle + ";\n");
  this.mHTMLSegment.fAppend("  }\n");
  this.mHTMLSegment.fAppend(" -->\n");
  this.mHTMLSegment.fAppend("</style>\n");

  // Define accessor functions to reduce file size
  //
  this.mHTMLSegment.fAppend("<script type=\"text/javascript\" language=\"JavaScript1.2\">\n");
  this.mHTMLSegment.fAppend(" <!--\n");
  this.mHTMLSegment.fAppend("  function  fC(ParamEntryID)\n");
  this.mHTMLSegment.fAppend("  {\n");
  this.mHTMLSegment.fAppend("    WWHFrame.WWHFavorites.fClickedEntry(ParamEntryID);\n");
  this.mHTMLSegment.fAppend("  }\n");
  this.mHTMLSegment.fAppend("\n");
  this.mHTMLSegment.fAppend("  function  fS(ParamEntryID,\n");
  this.mHTMLSegment.fAppend("               ParamEvent)\n");
  this.mHTMLSegment.fAppend("  {\n");
  this.mHTMLSegment.fAppend("    WWHFrame.WWHJavaScript.mPanels.mPopup.fShow(ParamEntryID, ParamEvent);\n");
  this.mHTMLSegment.fAppend("  }\n");
  this.mHTMLSegment.fAppend("\n");
  this.mHTMLSegment.fAppend("  function  fH()\n");
  this.mHTMLSegment.fAppend("  {\n");
  this.mHTMLSegment.fAppend("    WWHFrame.WWHJavaScript.mPanels.mPopup.fHide();\n");
  this.mHTMLSegment.fAppend("  }\n");
  this.mHTMLSegment.fAppend(" // -->\n");
  this.mHTMLSegment.fAppend("</script>\n");

  return this.mHTMLSegment.fGetBuffer();
}

function  WWHFavorites_StartHTMLSegments()
{
  this.mDisplayIndex = 0;

  return "";
}

function  WWHFavorites_AdvanceHTMLSegment()
{
  var  VarAccessible = WWHFrame.WWHHelp.mbAccessible;
  var  VarSettings = WWHFrame.WWHJavaScript.mSettings.mFavorites;
  var  VarAccessibilityTitle;
  var  VarMaxIndex;
  var  VarFavoritesEntry;

  this.mHTMLSegment.fReset();

  // Display favorites
  //
  VarAccessibilityTitle = "";
  while (this.mDisplayIndex < this.mFavorites.length)
  {
    VarFavoritesEntry = this.mFavorites[this.mDisplayIndex];

    if (VarAccessible)
    {
      VarAccessibilityTitle = " title=\"" + WWHStringUtilities_EscapeHTML(VarFavoritesEntry.mTitle) + "\"";
    }

    this.mHTMLSegment.fAppend("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"2\">");
    this.mHTMLSegment.fAppend("<tr>");
    this.mHTMLSegment.fAppend("<td width=\"17\" valign=\"middle\">");
    this.mHTMLSegment.fAppend("<a href=\"javascript:fC(" + this.mDisplayIndex + ");\">");
    this.mHTMLSegment.fAppend("<img border=\"0\" src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/common/images/doc.gif\" width=\"17\" height=\"17\" alt=\"\">");
    this.mHTMLSegment.fAppend("</a>");
    this.mHTMLSegment.fAppend("</td>");
    this.mHTMLSegment.fAppend("<td width=\"100%\" align=\"left\" valign=\"middle\">");
    this.mHTMLSegment.fAppend("<div>");
    this.mHTMLSegment.fAppend("<a href=\"javascript:fC(" + this.mDisplayIndex + ");\"" + this.fGetPopupAction(this.mDisplayIndex) + VarAccessibilityTitle + ">");
    this.mHTMLSegment.fAppend(VarFavoritesEntry.mTitle);
    this.mHTMLSegment.fAppend("</a>");
    this.mHTMLSegment.fAppend("</div>");
    this.mHTMLSegment.fAppend("</td>");
    this.mHTMLSegment.fAppend("</tr>");
    this.mHTMLSegment.fAppend("</table>\n");

    this.mDisplayIndex++;
  }

  return (this.mHTMLSegment.fSize() > 0);
}

function  WWHFavorites_GetHTMLSegment()
{
  return this.mHTMLSegment.fGetBuffer();
}

function  WWHFavorites_EndHTMLSegments()
{
  return "";
}

function  WWHFavorites_PanelNavigationLoaded()
{
  // Set focus
  //
  WWHFrame.WWHHelp.fFocus("WWHPanelNavigationFrame");
}

function  WWHFavorites_PanelViewLoaded()
{
}

function  WWHFavorites_HoverTextTranslate(ParamEntryID)
{
  var  RetResult = "";
  var  VarFavoritesEntry;

  // Locate specified entry
  //
  if ((ParamEntryID >= 0) &&
      (ParamEntryID < this.mFavorites.length))
  {
    VarFavoritesEntry = this.mFavorites[ParamEntryID];
    RetResult = VarFavoritesEntry.mTitle;
  }

  return RetResult;
}

function  WWHFavorites_HoverTextFormat(ParamWidth,
                                       ParamTextID,
                                       ParamText)
{
  var  FormattedText   = "";
  var  ForegroundColor = WWHFrame.WWHJavaScript.mSettings.mHoverText.mForegroundColor;
  var  BackgroundColor = WWHFrame.WWHJavaScript.mSettings.mHoverText.mBackgroundColor;
  var  BorderColor     = WWHFrame.WWHJavaScript.mSettings.mHoverText.mBorderColor;
  var  ImageDir        = WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/common/images";
  var  ReqSpacer1w2h   = "<img src=\"" + ImageDir + "/spc1w2h.gif\" width=1 height=2 alt=\"\">";
  var  ReqSpacer2w1h   = "<img src=\"" + ImageDir + "/spc2w1h.gif\" width=2 height=1 alt=\"\">";
  var  ReqSpacer1w7h   = "<img src=\"" + ImageDir + "/spc1w7h.gif\" width=1 height=7 alt=\"\">";
  var  ReqSpacer5w1h   = "<img src=\"" + ImageDir + "/spc5w1h.gif\" width=5 height=1 alt=\"\">";
  var  Spacer1w2h      = ReqSpacer1w2h;
  var  Spacer2w1h      = ReqSpacer2w1h;
  var  Spacer1w7h      = ReqSpacer1w7h;
  var  Spacer5w1h      = ReqSpacer5w1h;
  var  StyleAtttribute;


  // Set style attribute to insure small image height
  //
  StyleAttribute = " style=\"font-size: 1px; line-height: 1px;\"";

  FormattedText += "<table width=\"" + ParamWidth + "\" border=0 cellspacing=0 cellpadding=0 bgcolor=\"" + BackgroundColor + "\">";
  FormattedText += " <tr>";
  FormattedText += "  <td" + StyleAttribute + " height=2 colspan=5 bgcolor=\"" + BorderColor + "\">" + Spacer1w2h + "</td>";
  FormattedText += " </tr>";

  FormattedText += " <tr>";
  FormattedText += "  <td" + StyleAttribute + " height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  FormattedText += "  <td" + StyleAttribute + " height=7 colspan=3>" + Spacer1w7h + "</td>";
  FormattedText += "  <td" + StyleAttribute + " height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  FormattedText += " </tr>";

  FormattedText += " <tr>";
  FormattedText += "  <td bgcolor=\"" + BorderColor + "\">" + ReqSpacer2w1h + "</td>";
  FormattedText += "  <td>" + ReqSpacer5w1h + "</td>";
  FormattedText += "  <td width=\"100%\" id=\"" + ParamTextID + "\" style=\"color: " + ForegroundColor + " ; " + WWHFrame.WWHJavaScript.mSettings.mHoverText.mFontStyle + "\">" + ParamText + "</td>";
  FormattedText += "  <td>" + ReqSpacer5w1h + "</td>";
  FormattedText += "  <td bgcolor=\"" + BorderColor + "\">" + ReqSpacer2w1h + "</td>";
  FormattedText += " </tr>";

  FormattedText += " <tr>";
  FormattedText += "  <td" + StyleAttribute + " height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  FormattedText += "  <td" + StyleAttribute + " height=7 colspan=3>" + Spacer1w7h + "</td>";
  FormattedText += "  <td" + StyleAttribute + " height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  FormattedText += " </tr>";

  FormattedText += " <tr>";
  FormattedText += "  <td" + StyleAttribute + " height=2 colspan=5 bgcolor=\"" + BorderColor + "\">" + Spacer1w2h + "</td>";
  FormattedText += " </tr>";
  FormattedText += "</table>";

  return FormattedText;
}

function  WWHFavorites_GetPopupAction(ParamEntryID)
{
  var  PopupAction = "";


  if (WWHFrame.WWHJavaScript.mSettings.mHoverText.mbEnabled)
  {
    PopupAction += " onmouseover=\"fS(" + ParamEntryID + ", " + this.mEventString + ");\"";
    PopupAction += " onmouseout=\"fH();\"";
  }

  return PopupAction;
}

function  WWHFavorites_ReadCookie()
{
  var  VarFavoritesCookie;
  var  VarBooks = WWHFrame.WWHHelp.mBooks;
  var  VarBookContextsAndFavorites;
  var  VarBookContexts;
  var  VarCookieIndexToCurrentIndex;
  var  VarMaxIndex;
  var  VarIndex;
  var  VarCurrentIndex;
  var  VarFavoritesCookieEntries;
  var  VarFavoritesCookieEntry;
  var  VarBookIndex;
  var  VarFileIndex;
  var  VarTitle;
  var  VarFavoritesEntry;

  // Reset favorites
  //
  this.mFavorites.length = 0;

  // Get cookie
  //
  VarFavoritesCookie = WWHFrame.WWHBrowser.fGetCookie(WWHFrame.WWHHelp.mFavoritesCookie);
  if (VarFavoritesCookie != null)
  {
    // Extract book contexts and favorites
    //
    VarBookContextsAndFavorites = VarFavoritesCookie.split("\n");
    if (VarBookContextsAndFavorites.length == 2)
    {
      // Map the current context/book index values to those
      // recorded when the cookie was written.
      //
      VarCookieIndexToCurrentIndex = new Object();
      VarBookContexts = VarBookContextsAndFavorites[0].split(",");
      for (VarMaxIndex = VarBookContexts.length, VarIndex = 0 ; VarIndex < VarMaxIndex ; VarIndex++)
      {
        VarCurrentIndex = VarBooks.fGetContextIndex(VarBookContexts[VarIndex]);
        if (VarCurrentIndex >= 0)
        {
          VarCookieIndexToCurrentIndex[VarIndex] = VarCurrentIndex;
        }
      }

      // Extract favorites cookie entries
      //
      VarFavoritesCookieEntries = VarBookContextsAndFavorites[1].split(",");
      for (VarMaxIndex = VarFavoritesCookieEntries.length, VarIndex = 0 ; VarIndex < VarMaxIndex ; VarIndex++)
      {
        VarFavoritesCookieEntry = VarFavoritesCookieEntries[VarIndex].split(":");
        VarBookIndex = parseInt(VarFavoritesCookieEntry[0]);
        VarFileIndex = parseInt(VarFavoritesCookieEntry[1]);

        // Map book index
        //
        if (typeof(VarCookieIndexToCurrentIndex[VarBookIndex]) == "number")
        {
          // Context valid
          //
          VarBookIndex = VarCookieIndexToCurrentIndex[VarBookIndex];
          if (VarFileIndex < VarBooks.fGetBook(VarBookIndex).mFiles.fEntries())
          {
            // File index valid
            // Add favorite
            //
            VarFavoritesEntry = new WWHFavoritesEntry_Object(VarBookIndex,
                                                             VarFileIndex,
                                                             VarBooks.fBookIndexFileIndexToTitle(VarBookIndex, VarFileIndex));
            this.mFavorites[this.mFavorites.length] = VarFavoritesEntry;
          }
        }
      }
    }
  }
}

function  WWHFavorites_WriteCookie()
{
  var  VarBookList = WWHFrame.WWHHelp.mBooks.mBookList;
  var  VarBookContextsAsString;
  var  VarFavoritesAsString;
  var  VarMaxIndex;
  var  VarIndex;
  var  VarFavoritesEntry;
  var  VarFavoritesAsCookie;

  // Record book contexts as string
  //
  VarBookContextsAsString = "";
  for (VarMaxIndex = VarBookList.length, VarIndex = 0 ; VarIndex < VarMaxIndex ; VarIndex++)
  {
    if (VarBookContextsAsString.length > 0)
    {
      VarBookContextsAsString += ",";
    }

    VarBookContextsAsString += VarBookList[VarIndex].mContext;
  }

  // Record favorites as string
  //
  VarFavoritesAsString = "";
  for (VarMaxIndex = this.mFavorites.length, VarIndex = 0 ; VarIndex < VarMaxIndex ; VarIndex++)
  {
    VarFavoritesEntry = this.mFavorites[VarIndex];

    if (VarFavoritesAsString.length > 0)
    {
      VarFavoritesAsString += ",";
    }

    VarFavoritesAsString += VarFavoritesEntry.mBookIndex + ":" + VarFavoritesEntry.mFileIndex;
  }

  // Set cookie
  //
  VarFavoritesAsCookie = VarBookContextsAsString + "\n" + VarFavoritesAsString;
  WWHFrame.WWHBrowser.fSetCookie(WWHFrame.WWHHelp.mFavoritesCookie,
                                 VarFavoritesAsCookie,
                                 WWHFrame.WWHHelp.mSettings.mCookiesDaysToExpire);
}

function  WWHFavorites_ClearCurrent()
{
  this.mCurrent.mBookIndex = -1;
  this.mCurrent.mFileIndex = -1;
  this.mCurrent.mTitle = "";
}

function  WWHFavorites_SetCurrent(ParamBookIndex,
                                  ParamFileIndex)
{
  var  VarBooks = WWHFrame.WWHHelp.mBooks;

  if ((ParamBookIndex >= 0) &&
      (ParamFileIndex >= 0) &&
      (ParamBookIndex < VarBooks.mBookList.length) &&
      (ParamFileIndex < VarBooks.fGetBook(ParamBookIndex).mFiles.fEntries()))
  {
    this.mCurrent.mBookIndex = ParamBookIndex;
    this.mCurrent.mFileIndex = ParamFileIndex;
    this.mCurrent.mTitle = VarBooks.fBookIndexFileIndexToTitle(ParamBookIndex, ParamFileIndex);
  }
  else
  {
    this.fClearCurrent();
  }
}

function  WWHFavorites_Recorded(ParamBookIndex,
                                ParamFileIndex)
{
  var  VarRecorded = false;
  var  VarMaxIndex;
  var  VarIndex;
  var  VarFavoritesEntry;

  for (VarMaxIndex = this.mFavorites.length, VarIndex = 0 ; VarIndex < VarMaxIndex ; VarIndex++)
  {
    VarFavoritesEntry = this.mFavorites[VarIndex];

    if ((VarFavoritesEntry.mBookIndex == ParamBookIndex) &&
        (VarFavoritesEntry.mFileIndex == ParamFileIndex))
    {
      VarRecorded = true;
      break;
    }
  }

  return VarRecorded;
}

function  WWHFavorites_Add(ParamBookIndex,
                           ParamFileIndex)
{
  var  VarBooks = WWHFrame.WWHHelp.mBooks;

  // Current is valid?
  //
  if ((ParamBookIndex >= 0) &&
      (ParamFileIndex >= 0))
  {
    // Recorded?
    //
    if ( ! this.fRecorded(ParamBookIndex,
                          ParamFileIndex))
    {
      if ((ParamBookIndex >= 0) &&
          (ParamFileIndex >= 0) &&
          (ParamBookIndex < VarBooks.mBookList.length) &&
          (ParamFileIndex < VarBooks.fGetBook(ParamBookIndex).mFiles.fEntries()))
      {
        this.mFavorites[this.mFavorites.length] = new WWHFavoritesEntry_Object(ParamBookIndex,
                                                                               ParamFileIndex,
                                                                               VarBooks.fBookIndexFileIndexToTitle(ParamBookIndex, ParamFileIndex));
      }
    }
  }
}

function  WWHFavorites_Remove(ParamBookIndex,
                              ParamFileIndex)
{
  var  VarOffset;
  var  VarMaxIndex;
  var  VarIndex;
  var  VarFavoritesEntry;

  // Current is valid?
  //
  if ((ParamBookIndex >= 0) &&
      (ParamFileIndex >= 0))
  {
    // Resize array minus specified favorite
    //
    VarOffset = 0;
    for (VarMaxIndex = this.mFavorites.length, VarIndex = 0 ; VarIndex < VarMaxIndex ; VarIndex++)
    {
      VarFavoritesEntry = this.mFavorites[VarIndex];

      if ((VarFavoritesEntry.mBookIndex == ParamBookIndex) &&
          (VarFavoritesEntry.mFileIndex == ParamFileIndex))
      {
        VarOffset += 1;
      }
      else
      {
        this.mFavorites[VarIndex - VarOffset] = this.mFavorites[VarIndex];
      }
    }

    this.mFavorites.length = this.mFavorites.length - VarOffset;
  }
}

function  WWHFavorites_ClickedAdd()
{
  // Remove favorite
  //
  this.fAdd(this.mCurrent.mBookIndex,
            this.mCurrent.mFileIndex);

  // Update cookie
  //
  this.fWriteCookie();
}

function  WWHFavorites_ClickedRemove()
{
  // Remove favorite
  //
  this.fRemove(this.mCurrent.mBookIndex,
               this.mCurrent.mFileIndex);

  // Update cookie
  //
  this.fWriteCookie();
}

function  WWHFavorites_ClickedEntry(ParamEntryID)
{
  var  VarFavoritesEntry;
  var  VarURL;


  // Close down any popups we had going to prevent JavaScript errors
  //
  WWHFrame.WWHJavaScript.mPanels.mPopup.fHide();

  // Access favorites entry
  //
  VarFavoritesEntry = this.mFavorites[ParamEntryID];

  // Display favorite
  //
  VarURL = WWHFrame.WWHHelp.fGetBookIndexFileIndexURL(VarFavoritesEntry.mBookIndex,
                                                      VarFavoritesEntry.mFileIndex);
  WWHFrame.WWHHelp.fSetDocumentHREF(VarURL, false);
}

function WWHFavoritesEntry_Object(ParamBookIndex,
                                  ParamFileIndex,
                                  ParamTitle)
{
  this.mBookIndex = ParamBookIndex;
  this.mFileIndex = ParamFileIndex;
  this.mTitle     = ParamTitle;
}
// Copyright (c) 2000-2003 Quadralay Corporation.  All rights reserved.
//

function  WWHHandler_Object()
{
  this.mbInitialized = false;
  this.mImages       = new Array();

  this.fInit              = WWHHandler_Init;
  this.fFinalize          = WWHHandler_Finalize;
  this.fGetFrameReference = WWHHandler_GetFrameReference;
  this.fGetFrameName      = WWHHandler_GetFrameName;
  this.fIsReady           = WWHHandler_IsReady;
  this.fUpdate            = WWHHandler_Update;
  this.fSyncTOC           = WWHHandler_SyncTOC;
  this.fFavoritesCurrent  = WWHHandler_FavoritesCurrent;
  this.fProcessAccessKey  = WWHHandler_ProcessAccessKey;
  this.fGetCurrentTab     = WWHHandler_GetCurrentTab;
  this.fSetCurrentTab     = WWHHandler_SetCurrentTab;
}

function  WWHHandler_Init()
{
  WWHFrame.WWHJavaScript.fInit();
}

function  WWHHandler_Finalize()
{
  var  VarImageDirectory = WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/images";

  // Preload graphics
  //
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/btn_bg.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/btn_bgx.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/btn_e.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/btn_ex.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/btn_n.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/btn_ne.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/btn_nex.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/btn_nw.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/btn_nwx.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/btn_nx.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/btn_s.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/btn_se.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/btn_sex.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/btn_sw.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/btn_swx.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/btn_sx.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/btn_w.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/btn_wx.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/navbg.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/spc_e.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/spc_n.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/spc_s.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/spc_sx.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/spc_tabl.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/spc_tabm.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/spc_tabr.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/spc_top.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/spc_topx.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/spc_w.gif";
  this.mImages[this.mImages.length] = new Image(); this.mImages[this.mImages.length - 1].src = VarImageDirectory + "/viewbg.gif";

  // Display tab and panel
  //
  if (WWHFrame.WWHHelp.mInitialTabName != null)
  {
    WWHFrame.WWHJavaScript.fStartChangeTab(WWHFrame.WWHJavaScript.mInitialTab);
  }
  else
  {
    WWHFrame.WWHJavaScript.fClickedChangeTab(WWHFrame.WWHJavaScript.mInitialTab);
  }
}

function  WWHHandler_GetFrameReference(ParamFrameName)
{
  var  VarFrameReference;


  switch (ParamFrameName)
  {
    case "WWHTabsFrame":
      // WWHFrame.WWHNavigationFrame.WWHTabsFrame
      //
      VarFrameReference = WWHFrame.WWHHelp.fGetFrameReference("WWHNavigationFrame") + ".frames[0]";
      break;

    case "WWHPanelFrame":
      // WWHFrame.WWHNavigationFrame.WWHPanelFrame
      //
      VarFrameReference = WWHFrame.WWHHelp.fGetFrameReference("WWHNavigationFrame") + ".frames[1]";
      break;

    case "WWHPanelNavigationFrame":
      // WWHFrame.WWHNavigationFrame.WWHPanelFrame.WWHPanelNavigationFrame
      //
      VarFrameReference = WWHFrame.WWHHelp.fGetFrameReference("WWHPanelFrame") + ".frames[0]";
      break;

    case "WWHPanelViewFrame":
      // WWHFrame.WWHNavigationFrame.WWHPanelFrame.WWHPanelViewFrame
      //
      if (WWHFrame.WWHJavaScript.mPanels.fGetCurrentPanelObject().mPanelFilename == "panelvie.htm")
      {
        VarFrameReference = WWHFrame.WWHHelp.fGetFrameReference("WWHPanelFrame");
      }
      else
      {
        VarFrameReference = WWHFrame.WWHHelp.fGetFrameReference("WWHPanelFrame") + ".frames[1]";
      }
      break;
  }

  return VarFrameReference;
}

function  WWHHandler_GetFrameName(ParamFrameName)
{
  var  VarName = null;


  // Determine name for this frame
  //
  switch (ParamFrameName)
  {
    case "WWHTabsFrame":
      VarName = "";

      if (WWHFrame.WWHJavaScript.mSettings.mTOC.mbShow)
      {
        if (VarName.length > 0)
        {
          VarName += WWHFrame.WWHHelp.mMessages.mAccessibilityListSeparator + " ";
        }
        VarName += WWHFrame.WWHJavaScript.mMessages.mTabsTOCLabel;
      }

      if (WWHFrame.WWHJavaScript.mSettings.mIndex.mbShow)
      {
        if (VarName.length > 0)
        {
          VarName += WWHFrame.WWHHelp.mMessages.mAccessibilityListSeparator + " ";
        }
        VarName += WWHFrame.WWHJavaScript.mMessages.mTabsIndexLabel;
      }

      if (WWHFrame.WWHJavaScript.mSettings.mSearch.mbShow)
      {
        if (VarName.length > 0)
        {
          VarName += WWHFrame.WWHHelp.mMessages.mAccessibilityListSeparator + " ";
        }
        VarName += WWHFrame.WWHJavaScript.mMessages.mTabsSearchLabel;
      }

      VarName = WWHStringUtilities_FormatMessage(WWHFrame.WWHJavaScript.mMessages.mAccessibilityTabsFrameName, VarName);
      VarName = WWHStringUtilities_EscapeHTML(VarName);
      break;

    case "WWHPanelFrame":
      // Nothing to do
      //
      break;

    case "WWHPanelNavigationFrame":
      VarName = WWHStringUtilities_FormatMessage(WWHFrame.WWHJavaScript.mMessages.mAccessibilityNavigationFrameName,
                                                 WWHFrame.WWHJavaScript.mPanels.fGetCurrentPanelObject().mPanelTabTitle);
      VarName = WWHStringUtilities_EscapeHTML(VarName);
      break;

    case "WWHPanelViewFrame":
      VarName = WWHFrame.WWHJavaScript.mPanels.fGetCurrentPanelObject().mPanelTabTitle;
      break;
  }

  return VarName;
}

function  WWHHandler_IsReady()
{
  var  bVarIsReady = true;


  if ((WWHFrame.WWHJavaScript.mbChangingTabs) ||
      (WWHFrame.WWHJavaScript.mPanels.mbChangingPanels) ||
      (WWHFrame.WWHJavaScript.mPanels.mbLoading))
  {
    bVarIsReady = false;
  }

  return bVarIsReady;
}

function  WWHHandler_Update(ParamBookIndex,
                            ParamFileIndex)
{
}

function  WWHHandler_SyncTOC(ParamBookIndex,
                             ParamFileIndex,
                             ParamAnchor,
                             bParamReportError)
{
  WWHFrame.WWHJavaScript.fSyncTOC(ParamBookIndex,
                                  ParamFileIndex,
                                  ParamAnchor,
                                  bParamReportError);
}

function  WWHHandler_FavoritesCurrent(ParamBookIndex,
                                      ParamFileIndex)
{
  WWHFrame.WWHJavaScript.fFavoritesCurrent(ParamBookIndex,
                                           ParamFileIndex);
}

function  WWHHandler_ProcessAccessKey(ParamAccessKey)
{
  switch (ParamAccessKey)
  {
    case 1:
      this.fSetCurrentTab("contents");
      break;

    case 2:
      this.fSetCurrentTab("index");
      break;

    case 3:
      this.fSetCurrentTab("search");
      break;
  }
}

function  WWHHandler_GetCurrentTab()
{
  var  VarCurrentTab;


  // Initialize return value
  //
  VarCurrentTab = "";

  if (WWHFrame.WWHJavaScript.mPanels.mCurrentPanel == WWHFrame.WWHOutline.mPanelTabIndex)
  {
    VarCurrentTab = "contents";
  }
  else if (WWHFrame.WWHJavaScript.mPanels.mCurrentPanel == WWHFrame.WWHIndex.mPanelTabIndex)
  {
    VarCurrentTab = "index";
  }
  else if (WWHFrame.WWHJavaScript.mPanels.mCurrentPanel == WWHFrame.WWHSearch.mPanelTabIndex)
  {
    VarCurrentTab = "search";
  }
  else if (WWHFrame.WWHJavaScript.mPanels.mCurrentPanel == WWHFrame.WWHFavorites.mPanelTabIndex)
  {
    VarCurrentTab = "favorites";
  }

  return VarCurrentTab;
}

function  WWHHandler_SetCurrentTab(ParamTabName)
{
  switch (ParamTabName)
  {
    case "contents":
      // Contents exists?
      //
      if (WWHFrame.WWHOutline.mPanelTabIndex != -1)
      {
        // SyncTOC if possible
        //
        if (WWHFrame.WWHControls.fCanSyncTOC())
        {
          WWHFrame.WWHControls.fClickedSyncTOC();
        }
        else
        {
          // Focus if visible, otherwise switch panels
          //
          if (WWHFrame.WWHJavaScript.mPanels.mCurrentPanel == WWHFrame.WWHOutline.mPanelTabIndex)
          {
            WWHFrame.WWHJavaScript.mPanels.fGetCurrentPanelObject().fPanelViewLoaded();
          }
          else
          {
            WWHFrame.WWHJavaScript.fClickedChangeTab(WWHFrame.WWHOutline.mPanelTabIndex);
          }
        }
      }
      break;

    case "index":
      // Index exists?
      //
      if (WWHFrame.WWHIndex.mPanelTabIndex != -1)
      {
        // Focus if visible, otherwise switch panels
        //
        if (WWHFrame.WWHJavaScript.mPanels.mCurrentPanel == WWHFrame.WWHIndex.mPanelTabIndex)
        {
          WWHFrame.WWHJavaScript.mPanels.fGetCurrentPanelObject().fPanelNavigationLoaded();
        }
        else
        {
          WWHFrame.WWHJavaScript.fClickedChangeTab(WWHFrame.WWHIndex.mPanelTabIndex);
        }
      }
      break;

    case "search":
      // Search exists?
      //
      if (WWHFrame.WWHSearch.mPanelTabIndex != -1)
      {
        // Focus if visible, otherwise switch panels
        //
        if (WWHFrame.WWHJavaScript.mPanels.mCurrentPanel == WWHFrame.WWHSearch.mPanelTabIndex)
        {
          WWHFrame.WWHJavaScript.mPanels.fGetCurrentPanelObject().fPanelNavigationLoaded();
        }
        else
        {
          WWHFrame.WWHJavaScript.fClickedChangeTab(WWHFrame.WWHSearch.mPanelTabIndex);
        }
      }
      break;

    case "favorites":
      // Favorites exists?
      //
      if (WWHFrame.WWHFavorites.mPanelTabIndex != -1)
      {
        // Focus if visible, otherwise switch panels
        //
        if (WWHFrame.WWHJavaScript.mPanels.mCurrentPanel == WWHFrame.WWHFavorites.mPanelTabIndex)
        {
          WWHFrame.WWHJavaScript.mPanels.fGetCurrentPanelObject().fPanelNavigationLoaded();
        }
        else
        {
          WWHFrame.WWHJavaScript.fClickedChangeTab(WWHFrame.WWHFavorites.mPanelTabIndex);
        }
      }
      break;
  }
}
// Copyright (c) 2000-2003 Quadralay Corporation.  All rights reserved.
//

function  WWHIndex_Object()
{
  this.mbPanelInitialized  = false;
  this.mPanelAnchor        = null;
  this.mPanelTabTitle      = WWHFrame.WWHJavaScript.mMessages.mTabsIndexLabel;
  this.mPanelTabIndex      = -1;
  this.mPanelFilename      = ((WWHFrame.WWHBrowser.mBrowser == 1) ? "panelfni.htm" : "panelfsi.htm");
  this.mInitIndex          = 0;
  this.mOptions            = new WWHIndexOptions_Object();
  this.mTopEntry           = new WWHIndexEntry_Object(false, -1, null);
  this.mMaxLevel           = 0;
  this.mEntryCount         = 0;
  this.mSeeAlsoArray       = new Array();
  this.mSectionIndex       = 0;
  this.mbThresholdExceeded = null;
  this.mSectionCache       = new WWHSectionCache_Object();
  this.mIterator           = new WWHIndexIterator_Object();
  this.mHTMLSegment        = new WWHStringBuffer_Object();
  this.mEventString        = WWHPopup_EventString();
  this.mClickedEntry       = null;

  this.fInitHeadHTML          = WWHIndex_InitHeadHTML;
  this.fInitBodyHTML          = WWHIndex_InitBodyHTML;
  this.fInitLoadBookIndex     = WWHIndex_InitLoadBookIndex;
  this.fAddSeeAlsoEntry       = WWHIndex_AddSeeAlsoEntry;
  this.fProcessSeeAlsoEntries = WWHIndex_ProcessSeeAlsoEntries;
  this.fNavigationHeadHTML    = WWHIndex_NavigationHeadHTML;
  this.fNavigationBodyHTML    = WWHIndex_NavigationBodyHTML;
  this.fHeadHTML              = WWHIndex_HeadHTML;
  this.fStartHTMLSegments     = WWHIndex_StartHTMLSegments;
  this.fAdvanceHTMLSegment    = WWHIndex_AdvanceHTMLSegment;
  this.fGetHTMLSegment        = WWHIndex_GetHTMLSegment;
  this.fEndHTMLSegments       = WWHIndex_EndHTMLSegments;
  this.fPanelNavigationLoaded = WWHIndex_PanelNavigationLoaded;
  this.fPanelViewLoaded       = WWHIndex_PanelViewLoaded;
  this.fHoverTextTranslate    = WWHIndex_HoverTextTranslate;
  this.fHoverTextFormat       = WWHIndex_HoverTextFormat;
  this.fGetPopupAction        = WWHIndex_GetPopupAction;
  this.fThresholdExceeded     = WWHIndex_ThresholdExceeded;
  this.fGetSectionNavigation  = WWHIndex_GetSectionNavigation;
  this.fDisplaySection        = WWHIndex_DisplaySection;
  this.fSelectionListHeadHTML = WWHIndex_SelectionListHeadHTML;
  this.fSelectionListBodyHTML = WWHIndex_SelectionListBodyHTML;
  this.fSelectionListLoaded   = WWHIndex_SelectionListLoaded;
  this.fDisplayLink           = WWHIndex_DisplayLink;
  this.fGetEntry              = WWHIndex_GetEntry;
  this.fClickedEntry          = WWHIndex_ClickedEntry;
  this.fClickedSeeAlsoEntry   = WWHIndex_ClickedSeeAlsoEntry;

  // Set options
  //
  WWHJavaScriptSettings_Index_DisplayOptions(this.mOptions);
}

function  WWHIndex_InitHeadHTML()
{
  var  InitHeadHTML = "";


  return InitHeadHTML;
}

function  WWHIndex_InitBodyHTML()
{
  var  VarHTML = new WWHStringBuffer_Object();
  var  VarBookList = WWHFrame.WWHHelp.mBooks.mBookList;
  var  VarParameters;


  // Workaround Safari reload bug
  //
  VarParameters = "";
  if (WWHFrame.WWHBrowser.mBrowser == 5)  // Shorthhand for Safari
  {
    VarParameters = "?" + (new Date() * 1);
  }

  // Display initializing message
  //
  VarHTML.fAppend("<h2>" + WWHFrame.WWHJavaScript.mMessages.mInitializingMessage + "</h2>\n");

  // Load index data
  //
  this.mInitIndex = 0;
  VarHTML.fAppend("<script language=\"JavaScript1.2\" src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhbdata/js/index.js" + VarParameters + "\"></script>\n");

  return VarHTML.fGetBuffer();
}

function  WWHIndex_InitLoadBookIndex(ParamAddIndexEntriesFunc)
{
  var  VarMaxIndex;
  var  VarIndex;


  // Load Index
  //
  ParamAddIndexEntriesFunc(this.mTopEntry);

  // Increment init book index
  //
  this.mInitIndex++;

  // Check if done
  //
  if (this.mInitIndex == WWHFrame.WWHHelp.mBooks.mBookList.length)
  {
    // Process see also entries to set up links between source and target
    // Do this before the top level hashes are cleared by the sort children call
    //
    this.fProcessSeeAlsoEntries();

    // Sort top level entries
    //
    if (this.mTopEntry.mChildrenSortArray == null)
    {
      WWHIndexEntry_SortChildren(this.mTopEntry);
    }

    // Assign section indices
    //
    for (VarMaxIndex = this.mTopEntry.mChildrenSortArray.length, VarIndex = 0 ; VarIndex < VarMaxIndex ; VarIndex++)
    {
      this.mTopEntry.mChildrenSortArray[VarIndex].mSectionIndex = VarIndex;
    }

    // Panel is initialized
    //
    this.mbPanelInitialized = true;
  }
}

function  WWHIndex_AddSeeAlsoEntry(ParamEntry)
{
  this.mSeeAlsoArray[this.mSeeAlsoArray.length] = ParamEntry;
}

function  WWHIndex_ProcessSeeAlsoEntries()
{
  var  VarMaxIndex;
  var  VarIndex;
  var  VarEntry;
  var  VarSeeAlsoGroupEntry;
  var  VarSeeAlsoEntry;


  // Set see also references
  //
  for (VarMaxIndex = this.mSeeAlsoArray.length, VarIndex = 0 ; VarIndex < VarMaxIndex ; VarIndex++)
  {
    // Access entry
    //
    VarEntry = this.mSeeAlsoArray[VarIndex];

    // Access group entry
    //
    VarSeeAlsoGroupEntry = this.mTopEntry.mChildren[VarEntry.mSeeAlsoGroupKey + "~"];
    if ((typeof(VarSeeAlsoGroupEntry) != "undefined") &&
        (VarSeeAlsoGroupEntry != null) &&
        (VarSeeAlsoGroupEntry.mChildren != null))
    {
      // Access see also entry
      //
      VarSeeAlsoEntry = VarSeeAlsoGroupEntry.mChildren[VarEntry.mSeeAlsoKey + "~"];
      if ((typeof(VarSeeAlsoEntry) != "undefined") &&
          (VarSeeAlsoEntry != null))
      {
        // Setup links between source and destination
        //

        // See if target entry is already tagged
        //
        if (typeof(VarSeeAlsoEntry.mSeeAlsoTargetName) == "undefined")
        {
          // Update target entry
          //
          VarSeeAlsoEntry.mSeeAlsoTargetName = "s" + VarIndex;
        }

        // Update source entry
        //
        VarEntry.mSeeAlsoTargetName = VarSeeAlsoEntry.mSeeAlsoTargetName;
        VarEntry.mSeeAlsoTargetGroupID = VarSeeAlsoGroupEntry.mGroupID;
      }
    }
  }

  // Clear see also array
  //
  this.mSeeAlsoArray = null;
}

function  WWHIndex_NavigationHeadHTML()
{
  var  HTML = new WWHStringBuffer_Object();


  // Generate style section
  //
  HTML.fAppend("<style type=\"text/css\">\n");
  HTML.fAppend(" <!--\n");
  HTML.fAppend("  a.selected\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    text-decoration: none;\n");
  HTML.fAppend("    color: " + WWHFrame.WWHJavaScript.mSettings.mIndex.mNavigationCurrentColor + ";\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("  a.enabled\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    text-decoration: none;\n");
  HTML.fAppend("    color: " + WWHFrame.WWHJavaScript.mSettings.mIndex.mNavigationEnabledColor + ";\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("  p.navigation\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    margin-top: 1pt;\n");
  HTML.fAppend("    margin-bottom: 1pt;\n");
  HTML.fAppend("    color: " + WWHFrame.WWHJavaScript.mSettings.mIndex.mNavigationDisabledColor + ";\n");
  HTML.fAppend("    " + WWHFrame.WWHJavaScript.mSettings.mIndex.mNavigationFontStyle + ";\n");
  HTML.fAppend("  }\n");
  HTML.fAppend(" -->\n");
  HTML.fAppend("</style>\n");

  return HTML.fGetBuffer();
}

function  WWHIndex_NavigationBodyHTML()
{
  var  HTML = new WWHStringBuffer_Object();
  var  VarCacheKey;


  // Define accessor functions to reduce file size
  //
  HTML.fAppend("<script type=\"text/javascript\" language=\"JavaScript1.2\">\n");
  HTML.fAppend(" <!--\n");
  HTML.fAppend("  function  fD(ParamSectionIndex)\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    WWHFrame.WWHIndex.fDisplaySection(ParamSectionIndex);\n");
  HTML.fAppend("  }\n");
  HTML.fAppend(" // -->\n");
  HTML.fAppend("</script>\n");

  // Display navigation shortcuts
  //
  if (this.fThresholdExceeded())
  {
    VarCacheKey = this.mSectionIndex;
  }
  else
  {
    VarCacheKey = -1;
  }

  // Calculate section navigation if not already cached
  //
  if (typeof(this.mSectionCache[VarCacheKey]) == "undefined")
  {
    this.mSectionCache[VarCacheKey] = this.fGetSectionNavigation();
  }

  // Display section selection
  //
  HTML.fAppend(this.mSectionCache[VarCacheKey]);
  HTML.fAppend("<p>&nbsp;</p>\n");

  return HTML.fGetBuffer();
}

function  WWHIndex_HeadHTML()
{
  var  HTML = new WWHStringBuffer_Object();
  var  MaxLevel;
  var  Level;

  // Generate style section
  //
  HTML.fAppend("<style type=\"text/css\">\n");
  HTML.fAppend(" <!--\n");
  HTML.fAppend("  a.Section\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    text-decoration: none;\n");
  HTML.fAppend("    font-weight: bold;\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("  a:active\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    text-decoration: none;\n");
  HTML.fAppend("    background-color: " + WWHFrame.WWHJavaScript.mSettings.mIndex.mHighlightColor + ";\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("  a:hover\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    text-decoration: underline;\n");
  HTML.fAppend("    color: " + WWHFrame.WWHJavaScript.mSettings.mIndex.mEnabledColor + ";\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("  a\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    text-decoration: none;\n");
  HTML.fAppend("    color: " + WWHFrame.WWHJavaScript.mSettings.mIndex.mEnabledColor + ";\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("  a.AnchorOnly\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    text-decoration: none;\n");
  HTML.fAppend("    color: " + WWHFrame.WWHJavaScript.mSettings.mIndex.mDisabledColor + ";\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("  p\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    margin-top: 1pt;\n");
  HTML.fAppend("    margin-bottom: 1pt;\n");
  HTML.fAppend("    margin-right: 0pt;\n");
  HTML.fAppend("    color: " + WWHFrame.WWHJavaScript.mSettings.mIndex.mDisabledColor + ";\n");
  HTML.fAppend("    " + WWHFrame.WWHJavaScript.mSettings.mIndex.mFontStyle + ";\n");
  HTML.fAppend("  }\n");

  for (MaxLevel = this.mMaxLevel + 1, Level = 0 ; Level <= MaxLevel ; Level++)
  {
    HTML.fAppend("  p.l" + Level + "\n");
    HTML.fAppend("  {\n");
    HTML.fAppend("    margin-left: " + (WWHFrame.WWHJavaScript.mSettings.mIndex.mIndent * Level) + "pt;\n");
    HTML.fAppend("  }\n");
  }
  HTML.fAppend(" -->\n");
  HTML.fAppend("</style>\n");

  return HTML.fGetBuffer();
}

function  WWHIndex_StartHTMLSegments()
{
  var  HTML = new WWHStringBuffer_Object();


  // Setup iterator for display
  //
  if (this.fThresholdExceeded())
  {
    this.mIterator.fReset(this.mSectionIndex);
  }
  else
  {
    this.mIterator.fReset(-1);
  }

  // Define accessor functions to reduce file size
  //
  HTML.fAppend("<script type=\"text/javascript\" language=\"JavaScript1.2\">\n");
  HTML.fAppend(" <!--\n");
  HTML.fAppend("  function  fC(ParamEntryInfo)\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    WWHFrame.WWHIndex.fClickedEntry(ParamEntryInfo);\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("\n");
  HTML.fAppend("  function  fA(ParamEntryInfo)\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    WWHFrame.WWHIndex.fClickedSeeAlsoEntry(ParamEntryInfo);\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("\n");
  HTML.fAppend("  function  fN()\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    return false;\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("\n");
  HTML.fAppend("  function  fS(ParamEntryID,\n");
  HTML.fAppend("               ParamEvent)\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    WWHFrame.WWHJavaScript.mPanels.mPopup.fShow(ParamEntryID, ParamEvent);\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("\n");
  HTML.fAppend("  function  fH()\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    WWHFrame.WWHJavaScript.mPanels.mPopup.fHide();\n");
  HTML.fAppend("  }\n");
  HTML.fAppend(" // -->\n");
  HTML.fAppend("</script>\n");

  return HTML.fGetBuffer();
}

function  WWHIndex_AdvanceHTMLSegment()
{
  var  MaxHTMLSegmentSize = WWHFrame.WWHJavaScript.mMaxHTMLSegmentSize;
  var  mbAccessible = WWHFrame.WWHHelp.mbAccessible;
  var  BaseEntryInfo = "";
  var  Entry;
  var  EntryAnchorName;
  var  VarAccessibilityTitle = "";
  var  MaxIndex;
  var  Index;
  var  VarParentEntry;
  var  EntryPrefix;
  var  EntrySuffix;
  var  EntryInfo;


  // Add index in top entry to entry info if IteratorScope != TopEntry
  //
  if (this.fThresholdExceeded())
  {
    BaseEntryInfo += this.mSectionIndex;
  }

  this.mHTMLSegment.fReset();
  while ((this.mHTMLSegment.fSize() < MaxHTMLSegmentSize) &&
         (this.mIterator.fAdvance()))
  {
    Entry = this.mIterator.mEntry;

    // Insert breaks between sections
    //
    if (Entry.mbGroup)
    {
      // Emit spacing, if necessary
      //
      if (this.mHTMLSegment.fSize() == 0)
      {
        // No spacing
        //
      }
      else
      {
        // Emit a space
        //
        this.mHTMLSegment.fAppend("<p>&nbsp;</p>\n");
      }
    }

    // Display the entry
    //

    // See if entry needs a named anchor target
    //
    if (typeof(Entry.mSeeAlsoTargetName) == "string")
    {
      EntryAnchorName = " name=\"sa" + Entry.mSeeAlsoTargetName + "\"";
    }
    else
    {
      EntryAnchorName = "";
    }

    // Determine accessibility title
    //
    if (mbAccessible)
    {
      VarAccessibilityTitle = "";
      for (MaxIndex = this.mIterator.mParentStack.length, Index = 0 ; Index < MaxIndex ; Index++)
      {
        VarParentEntry = this.mIterator.mParentStack[Index];

        if ((VarParentEntry == this.mTopEntry) ||
            (VarParentEntry.mbGroup))
        {
          // Nothing to do
          //
        }
        else
        {
          VarAccessibilityTitle += VarParentEntry.mText + WWHFrame.WWHHelp.mMessages.mAccessibilityListSeparator + " ";
        }
      }

      VarAccessibilityTitle += Entry.mText;

      VarAccessibilityTitle = WWHStringUtilities_EscapeHTML(VarAccessibilityTitle);

      VarAccessibilityTitle = " title=\"" + VarAccessibilityTitle + "\"";
    }

    // Determine entry type
    //
    if (Entry.mbGroup)
    {
      EntryPrefix = "<b><a class=\"Section\" name=\"section" + Entry.mSectionIndex + "\">";
      EntrySuffix = "</a></b>";
    }
    else if (typeof(Entry.mSeeAlsoKey) == "string")
    {
      if (typeof(Entry.mSeeAlsoTargetName) == "string")
      {
        // Use position stack for link info
        //
        EntryInfo = BaseEntryInfo;
        for (MaxIndex = this.mIterator.mPositionStack.length, Index = 0 ; Index < MaxIndex ; Index++)
        {
          if (EntryInfo.length > 0)
          {
            EntryInfo += ":";
          }
          EntryInfo += this.mIterator.mPositionStack[Index];
        }

        EntryPrefix = "<i><a href=\"javascript:fA('" + EntryInfo + "');\"" + this.fGetPopupAction(EntryInfo) + VarAccessibilityTitle + ">";
        EntrySuffix = "</a></i>";
      }
      else
      {
        EntryPrefix = "<i>";
        EntrySuffix = "</i>";
      }
    }
    else if (Entry.mBookLinks != null)
    {
      // Use position stack for link info
      //
      EntryInfo = BaseEntryInfo;
      for (MaxIndex = this.mIterator.mPositionStack.length, Index = 0 ; Index < MaxIndex ; Index++)
      {
        if (EntryInfo.length > 0)
        {
          EntryInfo += ":";
        }
        EntryInfo += this.mIterator.mPositionStack[Index];
      }

      EntryPrefix = "<a" + EntryAnchorName + " href=\"javascript:fC('" + EntryInfo + "');\"" + this.fGetPopupAction(EntryInfo) + VarAccessibilityTitle + ">";
      EntrySuffix = "</a>";
    }
    else if (EntryAnchorName.length > 0)
    {
      EntryPrefix = "<a class=\"AnchorOnly\"" + EntryAnchorName + VarAccessibilityTitle + " href=\"javascript:fN();\">";
      EntrySuffix = "</a>";
    }
    else
    {
      EntryPrefix = "";
      EntrySuffix = "";
    }

    this.mHTMLSegment.fAppend("<p class=l" + (this.mIterator.mPositionStack.length - 1) + "><nobr>" + EntryPrefix + Entry.mText + EntrySuffix + "</nobr></p>\n");
  }

  return (this.mHTMLSegment.fSize() > 0);
}

function  WWHIndex_GetHTMLSegment()
{
  return this.mHTMLSegment.fGetBuffer();
}

function  WWHIndex_EndHTMLSegments()
{
  return "";
}

function  WWHIndex_PanelNavigationLoaded()
{
  // Restore focus
  //
  WWHFrame.WWHHelp.fFocus("WWHPanelNavigationFrame", "in" + this.mSectionIndex);
}

function  WWHIndex_PanelViewLoaded()
{
}

function  WWHIndex_HoverTextTranslate(ParamEntryInfo)
{
  var  Entry;


  // Locate specified entry
  //
  Entry = this.fGetEntry(ParamEntryInfo);

  return Entry.mText;
}

function  WWHIndex_HoverTextFormat(ParamWidth,
                                   ParamTextID,
                                   ParamText)
{
  var  FormattedText   = "";
  var  ForegroundColor = WWHFrame.WWHJavaScript.mSettings.mHoverText.mForegroundColor;
  var  BackgroundColor = WWHFrame.WWHJavaScript.mSettings.mHoverText.mBackgroundColor;
  var  BorderColor     = WWHFrame.WWHJavaScript.mSettings.mHoverText.mBorderColor;
  var  ImageDir        = WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/common/images";
  var  ReqSpacer1w2h   = "<img src=\"" + ImageDir + "/spc1w2h.gif\" width=1 height=2 alt=\"\">";
  var  ReqSpacer2w1h   = "<img src=\"" + ImageDir + "/spc2w1h.gif\" width=2 height=1 alt=\"\">";
  var  ReqSpacer1w7h   = "<img src=\"" + ImageDir + "/spc1w7h.gif\" width=1 height=7 alt=\"\">";
  var  ReqSpacer5w1h   = "<img src=\"" + ImageDir + "/spc5w1h.gif\" width=5 height=1 alt=\"\">";
  var  Spacer1w2h      = ReqSpacer1w2h;
  var  Spacer2w1h      = ReqSpacer2w1h;
  var  Spacer1w7h      = ReqSpacer1w7h;
  var  Spacer5w1h      = ReqSpacer5w1h;
  var  StyleAtttribute;


  // Set style attribute to insure small image height
  //
  StyleAttribute = " style=\"font-size: 1px; line-height: 1px;\"";

  FormattedText += "<table width=\"" + ParamWidth + "\" border=0 cellspacing=0 cellpadding=0 bgcolor=\"" + BackgroundColor + "\">";
  FormattedText += " <tr>";
  FormattedText += "  <td" + StyleAttribute + " height=2 colspan=5 bgcolor=\"" + BorderColor + "\">" + Spacer1w2h + "</td>";
  FormattedText += " </tr>";

  FormattedText += " <tr>";
  FormattedText += "  <td" + StyleAttribute + " height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  FormattedText += "  <td" + StyleAttribute + " height=7 colspan=3>" + Spacer1w7h + "</td>";
  FormattedText += "  <td" + StyleAttribute + " height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  FormattedText += " </tr>";

  FormattedText += " <tr>";
  FormattedText += "  <td bgcolor=\"" + BorderColor + "\">" + ReqSpacer2w1h + "</td>";
  FormattedText += "  <td>" + ReqSpacer5w1h + "</td>";
  FormattedText += "  <td width=\"100%\" id=\"" + ParamTextID + "\" style=\"color: " + ForegroundColor + " ; " + WWHFrame.WWHJavaScript.mSettings.mHoverText.mFontStyle + "\">" + ParamText + "</td>";
  FormattedText += "  <td>" + ReqSpacer5w1h + "</td>";
  FormattedText += "  <td bgcolor=\"" + BorderColor + "\">" + ReqSpacer2w1h + "</td>";
  FormattedText += " </tr>";

  FormattedText += " <tr>";
  FormattedText += "  <td" + StyleAttribute + " height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  FormattedText += "  <td" + StyleAttribute + " height=7 colspan=3>" + Spacer1w7h + "</td>";
  FormattedText += "  <td" + StyleAttribute + " height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  FormattedText += " </tr>";

  FormattedText += " <tr>";
  FormattedText += "  <td" + StyleAttribute + " height=2 colspan=5 bgcolor=\"" + BorderColor + "\">" + Spacer1w2h + "</td>";
  FormattedText += " </tr>";
  FormattedText += "</table>";

  return FormattedText;
}

function  WWHIndex_GetPopupAction(ParamEntryInfo)
{
  var  PopupAction = "";


  if (WWHFrame.WWHJavaScript.mSettings.mHoverText.mbEnabled)
  {
    PopupAction += " onmouseover=\"fS('" + ParamEntryInfo + "', " + this.mEventString + ");\"";
    PopupAction += " onmouseout=\"fH();\"";
  }

  return PopupAction;
}

function  WWHIndex_ThresholdExceeded()
{
  if (this.mbThresholdExceeded == null)
  {
    if ((WWHFrame.WWHHelp.mbAccessible) ||
        ((this.mOptions.mThreshold > 0) &&
         (this.mEntryCount > this.mOptions.mThreshold)))
    {
      this.mbThresholdExceeded = true;
    }
    else
    {
      this.mbThresholdExceeded = false;
    }
  }

  return this.mbThresholdExceeded;
}

function  WWHIndex_GetSectionNavigation()
{
  var  SectionNavHTML = "";
  var  SectionArray;
  var  MaxIndex;
  var  Index;


  SectionNavHTML += "<p class=\"navigation\">";

  // Calculate section selection
  //
  SectionArray = this.mTopEntry.mChildrenSortArray;
  for (MaxIndex = SectionArray.length, Index = 0 ; Index < MaxIndex ; Index++)
  {
    // Add spacers if necessary
    //
    if (Index > 0)
    {
      SectionNavHTML += this.mOptions.mSeperator;
    }

    // Display section with or without link as necessary
    //
    if ((this.fThresholdExceeded()) &&
        (Index == this.mSectionIndex))  // Currently being displayed
    {
      SectionNavHTML += "<a class=\"selected\" name=\"in" + Index + "\" href=\"javascript:void(0);\">" + SectionArray[Index].mText + "</a>";
    }
    else if ((SectionArray[Index].mChildren == null) &&         // Always display group
             (SectionArray[Index].mChildrenSortArray == null))  // SortArray null before sort, hash null after
    {
      SectionNavHTML += SectionArray[Index].mText;
    }
    else
    {
      SectionNavHTML += "<a class=\"enabled\" name=\"in" + Index + "\" href=\"javascript:fD(" + Index + ");\">" + SectionArray[Index].mText + "</a>";
    }
  }

  SectionNavHTML += "</p>";

  return SectionNavHTML;
}

function  WWHIndex_DisplaySection(ParamSectionIndex)
{
  // Set section
  //
  this.mSectionIndex = ParamSectionIndex;

  if (this.fThresholdExceeded())
  {
    // Reload panel
    //
    WWHFrame.WWHJavaScript.mPanels.fClearScrollPosition();
    WWHFrame.WWHJavaScript.mPanels.fReloadPanel();
  }
  else
  {
    // Focus current section
    //
    WWHFrame.WWHHelp.fFocus("WWHPanelNavigationFrame", "in" + this.mSectionIndex);

    // Whole index already visible, just jump to the specified entry
    //
    this.mPanelAnchor = "section" + this.mSectionIndex;

    // Workaround for IE/FireFox problems
    //
    if (WWHFrame.WWHBrowser.mbSupportsFocus)
    {
      WWHFrame.WWHBrowser.mbSupportsFocus = false;

      WWHFrame.WWHJavaScript.mPanels.fJumpToAnchor();

      WWHFrame.WWHBrowser.mbSupportsFocus = true;
    }

    WWHFrame.WWHJavaScript.mPanels.fJumpToAnchor();
  }
}

function  WWHIndex_SelectionListHeadHTML()
{
  var  HTML = new WWHStringBuffer_Object();
  var  Level;


  HTML.fAppend("<style type=\"text/css\">\n");
  HTML.fAppend(" <!--\n");
  HTML.fAppend("  a\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    text-decoration: none;\n");
  HTML.fAppend("    color: " + WWHFrame.WWHJavaScript.mSettings.mIndex.mEnabledColor + ";\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("  p\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    margin-top: 1pt;\n");
  HTML.fAppend("    margin-bottom: 1pt;\n");
  HTML.fAppend("    margin-right: 0pt;\n");
  HTML.fAppend("    color: " + WWHFrame.WWHJavaScript.mSettings.mIndex.mDisabledColor + ";\n");
  HTML.fAppend("    " + WWHFrame.WWHJavaScript.mSettings.mIndex.mFontStyle + ";\n");
  HTML.fAppend("  }\n");
  for (Level = 1 ; Level < 3 ; Level++)
  {
    HTML.fAppend("  p.l" + Level + "\n");
    HTML.fAppend("  {\n");
    HTML.fAppend("    margin-left: " + (WWHFrame.WWHJavaScript.mSettings.mIndex.mIndent * Level) + "pt;\n");
    HTML.fAppend("  }\n");
  }
  HTML.fAppend("  h2\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    " + WWHFrame.WWHJavaScript.mSettings.mIndex.mFontStyle + ";\n");
  HTML.fAppend("  }\n");
  HTML.fAppend(" -->\n");
  HTML.fAppend("</style>\n");

  return HTML.fGetBuffer();
}

function  WWHIndex_SelectionListBodyHTML()
{
  var  HTML = new WWHStringBuffer_Object();
  var  BookList = WWHFrame.WWHHelp.mBooks.mBookList;
  var  EntryClass;
  var  MaxBookIndex;
  var  BookIndex;
  var  BookListEntry;
  var  LinkArray;
  var  MaxLinkIndex;
  var  LinkIndex;
  var  Parts;
  var  PrevLinkFileIndex;
  var  LinkFileIndex;
  var  LinkAnchor;
  var  VarAccessibilityTitle;
  var  NumberedLinkCounter;
  var  DocumentURL;


  if (this.mClickedEntry != null)
  {
    // Display multiple entry message
    //
    HTML.fAppend("<h2>");
    HTML.fAppend(WWHFrame.WWHJavaScript.mMessages.mIndexSelectMessage1 + " ");
    HTML.fAppend(WWHFrame.WWHJavaScript.mMessages.mIndexSelectMessage2);
    HTML.fAppend("</h2>\n");

    // Display text of entry clicked
    //
    HTML.fAppend("<p><b>" + this.mClickedEntry.mText + "</b></p>\n");

    // Determine level at which to display entries
    //
    if (BookList.length == 1)
    {
      EntryClass = "l1";
    }
    else
    {
      EntryClass = "l2";
    }

    // Display each book's link for this entry
    //
    for (MaxBookIndex = BookList.length, BookIndex = 0 ; BookIndex < MaxBookIndex ; BookIndex++)
    {
      if (typeof(this.mClickedEntry.mBookLinks[BookIndex]) != "undefined")
      {
        BookListEntry = BookList[BookIndex];

        // Write the book's title, if necessary
        //
        if (BookList.length > 1)
        {
          HTML.fAppend("<p>&nbsp;</p>\n");
          HTML.fAppend("<p class=\"l1\"><nobr><b>" + BookListEntry.mTitle + "</b>");
        }

        // Sort link array to group files with anchors
        //
        // Use for loop to copy entries to workaround bug/problem in IE 5.0 on Windows
        //
        LinkArray = new Array();
        for (MaxLinkIndex = this.mClickedEntry.mBookLinks[BookIndex].length, LinkIndex = 0 ; LinkIndex < MaxLinkIndex ; LinkIndex++)
        {
          LinkArray[LinkIndex] = this.mClickedEntry.mBookLinks[BookIndex][LinkIndex];
        }
        LinkArray = LinkArray.sort();

        // Now display file links
        //
        PrevLinkFileIndex = null;
        for (MaxLinkIndex = LinkArray.length, LinkIndex = 0 ; LinkIndex < MaxLinkIndex ; LinkIndex++)
        {
          // Determine link file index and anchor
          //
          Parts = LinkArray[LinkIndex].split("#");
          LinkFileIndex = parseInt(Parts[0]);
          LinkAnchor = null;
          if (Parts.length > 1)
          {
            if (Parts[1].length > 0)
            {
              LinkAnchor = Parts[1];
            }
          }

          // Determine if all links for a single document have been processed
          //
          if ((PrevLinkFileIndex == null) ||
              (LinkFileIndex != PrevLinkFileIndex))
          {
            NumberedLinkCounter = 1;

            // Determine title for accessibility
            //
            if (WWHFrame.WWHHelp.mbAccessible)
            {
              VarAccessibilityTitle = WWHStringUtilities_FormatMessage(WWHFrame.WWHJavaScript.mMessages.mAccessibilityIndexEntry,
                                                                       BookListEntry.mFiles.fFileIndexToTitle(LinkFileIndex),
                                                                       BookListEntry.mTitle);
              VarAccessibilityTitle = WWHStringUtilities_EscapeHTML(VarAccessibilityTitle);
              VarAccessibilityTitle = " title=\"" + VarAccessibilityTitle + "\"";
            }

            HTML.fAppend("</nobr></p>\n");

            // Build up absolute link URL
            //
            DocumentURL = WWHFrame.WWHHelp.fGetBookIndexFileIndexURL(BookIndex, LinkFileIndex, LinkAnchor);
            DocumentURL = WWHStringUtilities_EscapeURLForJavaScriptAnchor(DocumentURL);

            // Handle "double-indirection" issue
            //
            DocumentURL = WWHStringUtilities_SearchReplace(DocumentURL, "%", "%25");

            HTML.fAppend("<p class=\"" + EntryClass + "\"><nobr>");
            HTML.fAppend("<a name=\"indexselect\" href=\"javascript:WWHFrame.WWHIndex.fDisplayLink('" + DocumentURL + "');\"" + VarAccessibilityTitle + ">");
            HTML.fAppend(BookListEntry.mFiles.fFileIndexToTitle(LinkFileIndex) + "</a>");
          }
          else
          {
            NumberedLinkCounter += 1;

            // Determine title for accessibility
            //
            if (WWHFrame.WWHHelp.mbAccessible)
            {
              VarAccessibilityTitle = WWHStringUtilities_FormatMessage(WWHFrame.WWHJavaScript.mMessages.mAccessibilityIndexSecondEntry,
                                                                       BookListEntry.mFiles.fFileIndexToTitle(LinkFileIndex),
                                                                       BookListEntry.mTitle,
                                                                       NumberedLinkCounter);
              VarAccessibilityTitle = WWHStringUtilities_EscapeHTML(VarAccessibilityTitle);
              VarAccessibilityTitle = " title=\"" + VarAccessibilityTitle + "\"";
            }

            // Build up absolute link URL
            //
            DocumentURL = WWHFrame.WWHHelp.fGetBookIndexFileIndexURL(BookIndex, LinkFileIndex, LinkAnchor);
            DocumentURL = WWHStringUtilities_EscapeURLForJavaScriptAnchor(DocumentURL);

            // Handle "double-indirection" issue
            //
            DocumentURL = WWHStringUtilities_SearchReplace(DocumentURL, "%", "%25");

            HTML.fAppend(",&nbsp;");
            HTML.fAppend("<a href=\"javascript:WWHFrame.WWHIndex.fDisplayLink('" + DocumentURL + "');\"" + VarAccessibilityTitle + ">");
            HTML.fAppend(NumberedLinkCounter + "</a>");
          }

          PrevLinkFileIndex = LinkFileIndex;
        }

        HTML.fAppend("</nobr></p>\n");
      }
    }
  }

  return HTML.fGetBuffer();
}

function  WWHIndex_SelectionListLoaded()
{
  // Move focus to document selection list
  //
  WWHFrame.WWHHelp.fFocus("WWHDocumentFrame", "indexselect");
}

function  WWHIndex_DisplayLink(ParamURL)
{
  WWHFrame.WWHHelp.fSetDocumentHREF(ParamURL, false);
}

function  WWHIndex_GetEntry(ParamEntryInfo)
{
  var  Entry = null;
  var  EntryInfoParts;
  var  MaxIndex;
  var  Index;


  // Locate specified entry
  //
  Entry = this.mTopEntry;
  EntryInfoParts = ParamEntryInfo.split(":");
  for (MaxIndex = EntryInfoParts.length, Index = 0 ; Index < MaxIndex ; Index++)
  {
    Entry = Entry.mChildrenSortArray[EntryInfoParts[Index]];
  }

  return Entry;
}

function  WWHIndex_ClickedEntry(ParamEntryInfo)
{
  var  Entry;
  var  BookCount;
  var  BookIndex;
  var  BookListEntry;
  var  Parts;
  var  LinkFileIndex;
  var  LinkAnchor;
  var  DocumentURL;


  // Locate specified entry
  //
  Entry = this.fGetEntry(ParamEntryInfo);

  // Display target document or selection list
  //
  BookCount = 0;
  for (BookIndex in Entry.mBookLinks)
  {
    BookCount++;
  }

  // See if this is a single entry
  //
  if ((BookCount == 1) &&
      (Entry.mBookLinks[BookIndex].length == 1))
  {
    BookListEntry = WWHFrame.WWHHelp.mBooks.mBookList[BookIndex];

    // Determine link file index and anchor
    //
    Parts = Entry.mBookLinks[BookIndex][0].split("#");
    LinkFileIndex = parseInt(Parts[0]);
    LinkAnchor = null;
    if (Parts.length > 1)
    {
      if (Parts[1].length > 0)
      {
        LinkAnchor = Parts[1];
      }
    }

    // Set Document
    //
    DocumentURL = WWHFrame.WWHHelp.fGetBookIndexFileIndexURL(BookIndex, LinkFileIndex, LinkAnchor);
  }
  else
  {
    // Display selection list
    //
    this.mClickedEntry = Entry;
    DocumentURL = WWHFrame.WWHHelp.mBaseURL + "wwhelp/wwhimpl/js/html/indexsel.htm";
  }

  this.fDisplayLink(DocumentURL);
}

function  WWHIndex_ClickedSeeAlsoEntry(ParamEntryInfo)
{
  var  Entry;
  var  TargetSectionIndex;
  var  MaxIndex;
  var  Index;


  // Locate specified entry
  //
  Entry = this.fGetEntry(ParamEntryInfo);

  // Confirm entry has target information
  //
  if ((typeof(Entry.mSeeAlsoTargetName) == "string") &&
      (typeof(Entry.mSeeAlsoTargetGroupID) == "number"))
  {
    // Determine if we need to jump to another page
    //
    TargetSectionIndex = -1;
    for (MaxIndex = this.mTopEntry.mChildrenSortArray.length, Index = 0 ; Index < MaxIndex ; Index++)
    {
      if (this.mTopEntry.mChildrenSortArray[Index].mGroupID == Entry.mSeeAlsoTargetGroupID)
      {
        TargetSectionIndex = Index;

        // Exit for loop
        //
        Index = MaxIndex;
      }
    }

    // Confirm the target entry was located
    //
    if (TargetSectionIndex != -1)
    {
      // Set target entry
      //
      this.mPanelAnchor = "sa" + Entry.mSeeAlsoTargetName;

      // Change navigation bar?
      //
      if ((this.fThresholdExceeded()) &&
          (TargetSectionIndex != this.mSectionIndex))
      {
        // Need to switch to proper section
        //
        this.fDisplaySection(TargetSectionIndex);
      }
      else
      {
        // Focus current section
        //
        WWHFrame.WWHHelp.fFocus("WWHPanelNavigationFrame", "in" + this.mSectionIndex);

        // We're on the right page, so just jump to the correct entry
        //
        WWHFrame.WWHJavaScript.mPanels.fJumpToAnchor();
      }
    }
  }
}

function  WWHIndexIterator_Object()
{
  this.mIteratorScope      = null;
  this.mEntry              = null;
  this.mParentStack        = new Array();
  this.mPositionStack      = new Array();

  this.fReset   = WWHIndexIterator_Reset;
  this.fAdvance = WWHIndexIterator_Advance;
}

function  WWHIndexIterator_Reset(ParamIndex)
{
  if (ParamIndex == -1)  // Iterate buckets as well!
  {
    this.mIteratorScope = WWHFrame.WWHIndex.mTopEntry;
  }
  else if ((WWHFrame.WWHIndex.mTopEntry.mChildrenSortArray != null) &&
           (WWHFrame.WWHIndex.mTopEntry.mChildrenSortArray.length > 0))
  {
    this.mIteratorScope = WWHFrame.WWHIndex.mTopEntry.mChildrenSortArray[ParamIndex];
  }
  else
  {
    this.mIteratorScope = null;
  }
  this.mEntry                = this.mIteratorScope;
  this.mParentStack.length   = 0;
  this.mPositionStack.length = 0;
}

function  WWHIndexIterator_Advance()
{
  var  ParentEntry;
  var  StackTop;


  // Advance to the next visible entry
  //
  if (this.mEntry != null)
  {
    // Check for children
    //
    if (this.mEntry.mChildren != null)
    {
      // Determine sort order if necessary
      //
      if (this.mEntry.mChildrenSortArray == null)
      {
        WWHIndexEntry_SortChildren(this.mEntry);
      }
    }

    // Process children
    //
    if ((this.mEntry.mChildrenSortArray != null) &&
        (this.mEntry.mChildrenSortArray.length > 0))
    {
      this.mParentStack[this.mParentStack.length] = this.mEntry;
      this.mPositionStack[this.mPositionStack.length] = 0;
      this.mEntry = this.mEntry.mChildrenSortArray[0];
    }
    // If we've reached the iterator scope, we're done
    //
    else if (this.mEntry == this.mIteratorScope)
    {
      this.mEntry = null;
    }
    else
    {
      ParentEntry = this.mParentStack[this.mParentStack.length - 1];
      this.mEntry = null;

      // Find next child of parent entry
      //
      while (ParentEntry != null)
      {
        // Increment position
        //
        StackTop = this.mPositionStack.length - 1;
        this.mPositionStack[StackTop]++;

        // Confirm this is a valid entry
        //
        if (this.mPositionStack[StackTop] < ParentEntry.mChildrenSortArray.length)
        {
          // Return the parent's next child
          //
          this.mEntry = ParentEntry.mChildrenSortArray[this.mPositionStack[StackTop]];

          // Signal break from loop
          //
          ParentEntry = null;
        }
        else
        {
          // Last child of parent, try up a level
          //
          if (ParentEntry == this.mIteratorScope)
          {
            ParentEntry = null;
          }
          else
          {
            this.mParentStack.length--;
            this.mPositionStack.length--;

            ParentEntry = this.mParentStack[this.mParentStack.length - 1];
          }
        }
      }
    }
  }

  return (this.mEntry != null);
}

function  WWHIndexEntry_Object(bParamGroupHeading,
                               ParamBookIndex,
                               ParamText,
                               ParamLinks,
                               ParamSeeAlsoKey,
                               ParamSeeAlsoGroupKey)
{
  if (bParamGroupHeading)
  {
    this.mbGroup  = true;
    this.mGroupID = WWHFrame.WWHIndex.mEntryCount;
  }
  else
  {
    this.mbGroup = false;
  }

  this.mText              = ParamText;
  this.mBookLinks         = null;
  this.mChildren          = null;
  this.mChildrenSortArray = null;

  if (typeof(ParamSeeAlsoKey) == "string")
  {
    this.mSeeAlsoKey = ParamSeeAlsoKey;
  }
  if (typeof(ParamSeeAlsoGroupKey) == "string")
  {
    this.mSeeAlsoGroupKey = ParamSeeAlsoGroupKey;
  }

  this.fAddEntry  = WWHIndexEntry_AddEntry;
  this.fA         = WWHIndexEntry_AddEntry;

  // Bump entry count if not the top level node
  //
  if (ParamBookIndex != -1)
  {
    WWHFrame.WWHIndex.mEntryCount++;
  }

  // Add links
  //
  if ((typeof(ParamLinks) != "undefined") &&
      (ParamLinks != null))
  {
    this.mBookLinks = new WWHIndexEntryBookHash_Object();
    this.mBookLinks[ParamBookIndex] = ParamLinks;
  }
}

function  WWHIndexEntry_GetKey(ParamGroupTag,
                               ParamText,
                               ParamSort)
{
  var  VarKey = null;


  if ((typeof(ParamText) != "undefined") &&
      (ParamText != null) &&
      (ParamText.length > 0))
  {
    if ((typeof(ParamGroupTag) != "undefined") &&
        (ParamGroupTag != null) &&
        (ParamGroupTag.length > 0))
    {
      if (VarKey == null)
      {
        VarKey = "";
      }

      VarKey += ParamGroupTag;
    }

    if ((typeof(ParamSort) != "undefined") &&
        (ParamSort != null) &&
        (ParamSort.length > 0) &&
        (ParamSort != ParamText))
    {
      if (VarKey == null)
      {
        VarKey = "";
      }

      VarKey += ":" + ParamSort;
    }

    if (VarKey == null)
    {
      VarKey = "";
    }

    VarKey += ":" + ParamText;
  }

  return VarKey;
}

function  WWHIndexEntry_AddEntry(ParamText,
                                 ParamLinks,
                                 ParamSort,
                                 ParamGroupTag,
                                 ParamSeeAlso,
                                 ParamSeeAlsoSort,
                                 ParamSeeAlsoGroup,
                                 ParamSeeAlsoGroupSort,
                                 ParamSeeAlsoGroupTag)
{
  var  bVarGroupHeading;
  var  Links;
  var  VarKey;
  var  VarSeeAlsoKey;
  var  VarSeeAlsoGroupKey;
  var  BookIndex;
  var  ChildEntry;
  var  BookLinks;
  var  MaxIndex;
  var  Index;


  // See if this is a group heading
  //
  if ((typeof(ParamGroupTag) != "undefined") &&
      (ParamGroupTag != null) &&
      (ParamGroupTag.length > 0))
  {
    bVarGroupHeading = true;
  }

  // Set links if entries exist
  //
  if ((typeof(ParamLinks) != "undefined") &&
      (ParamLinks != null) &&
      (ParamLinks.length > 0))
  {
    Links = ParamLinks;
  }
  else
  {
    Links = null;
  }

  // See if this object has any children
  //
  if (this.mChildren == null)
  {
    this.mChildren = new WWHIndexEntryHash_Object();
  }

  // Define keys
  //
  VarKey             = WWHIndexEntry_GetKey(ParamGroupTag, ParamText, ParamSort);
  VarSeeAlsoKey      = WWHIndexEntry_GetKey(null, ParamSeeAlso, ParamSeeAlsoSort);
  VarSeeAlsoGroupKey = WWHIndexEntry_GetKey(ParamSeeAlsoGroupTag, ParamSeeAlsoGroup, ParamSeeAlsoGroupSort);

  // Access entry, creating it if it doesn't exist
  //
  BookIndex = WWHFrame.WWHIndex.mInitIndex;
  ChildEntry = this.mChildren[VarKey + "~"];
  if (typeof(ChildEntry) == "undefined")
  {
    ChildEntry = new WWHIndexEntry_Object(bVarGroupHeading, BookIndex, ParamText,
                                          Links, VarSeeAlsoKey, VarSeeAlsoGroupKey);
    this.mChildren[VarKey + "~"] = ChildEntry;

    // Add entry to see also collection if it is a see also entry
    //
    if (typeof(VarSeeAlsoKey) == "string")
    {
      WWHFrame.WWHIndex.fAddSeeAlsoEntry(ChildEntry);
    }
  }
  else  // Child entry exists, update with new information
  {
    // Add book links
    //
    if (Links != null)
    {
      if (ChildEntry.mBookLinks == null)
      {
        ChildEntry.mBookLinks = new WWHIndexEntryBookHash_Object();
      }

      if (typeof(ChildEntry.mBookLinks[BookIndex]) == "undefined")
      {
        ChildEntry.mBookLinks[BookIndex] = Links;
      }
      else
      {
        // Append new links
        //
        BookLinks = ChildEntry.mBookLinks[BookIndex];
        for (MaxIndex = Links.length, Index = 0 ; Index < MaxIndex ; Index++)
        {
          BookLinks[BookLinks.length] = Links[Index];
        }
      }
    }
  }

  return ChildEntry;
}

function  WWHIndexEntry_SortChildren(ParamEntry)
{
  var  UnsortedArray;
  var  KeyHash = new Object();
  var  SortedArray;
  var  VarKey;
  var  VarKeyTrimmed;
  var  VarKeyUpperCase;
  var  VarSortKey;
  var  MaxIndex;
  var  Index;


  // Accumulate hash keys
  //
  UnsortedArray = new Array();
  for (VarKey in ParamEntry.mChildren)
  {
    VarKeyTrimmed = VarKey.substring(1, VarKey.length - 1);
    VarKeyUpperCase = VarKeyTrimmed.toUpperCase();
    VarSortKey = VarKeyUpperCase + ":" + VarKey;

    UnsortedArray[UnsortedArray.length] = VarSortKey;
    KeyHash[VarSortKey] = VarKey;
  }

  // Insure array exists
  //
  if (UnsortedArray.length > 0)
  {
    // Sort array
    //
    SortedArray = UnsortedArray.sort();

    // Replace sort keys with entries
    //
    for (MaxIndex = SortedArray.length, Index = 0 ; Index < MaxIndex ; Index++)
    {
      VarSortKey = SortedArray[Index];
      if ((typeof(KeyHash[VarSortKey]) != "undefined") &&
          (KeyHash[VarSortKey] != null))
      {
        VarKey = KeyHash[VarSortKey];
        SortedArray[Index] = ParamEntry.mChildren[VarKey];
      }
    }
  }
  else
  {
    // No children, possible error occurred?
    //
    SortedArray = new Array();
  }

  // Set children sort array
  // Clear hash table as it is no longer needed
  //
  ParamEntry.mChildrenSortArray = SortedArray;
  ParamEntry.mChildren = null;
}

function  WWHIndexEntryHash_Object()
{
}

function  WWHIndexEntryBookHash_Object()
{
}

function  WWHSectionCache_Object()
{
}

function  WWHIndexOptions_Object()
{
  this.mThreshold     = 0;

  this.fSetThreshold = WWHIndexOptions_SetThreshold;
  this.fSetSeperator = WWHIndexOptions_SetSeperator;
}

function  WWHIndexOptions_SetThreshold(ParamThreshold)
{
  this.mThreshold = ParamThreshold;
}

function  WWHIndexOptions_SetSeperator(ParamSeperator)
{
  this.mSeperator = ParamSeperator;
}
// Copyright (c) 2000-2003 Quadralay Corporation.  All rights reserved.
//

function  WWHJavaScript_Object()
{
  this.mSettings           = new WWHJavaScriptSettings_Object();
  this.mMessages           = new WWHJavaScriptMessages_Object();
  this.mInitialTab         = -1;
  this.mbClickedChangeTab  = false;
  this.mbChangingTabs      = false;
  this.mCurrentTab         = -1;
  this.mPanels             = null;
  this.mTabs               = null;
  this.mMaxHTMLSegmentSize = 8192;  // Best tested value is 8192

  this.fInit                      = WWHJavaScript_Init;
  this.fClickedChangeTab          = WWHJavaScript_ClickedChangeTab;
  this.fClickedChangeTabWithDelay = WWHJavaScript_ClickedChangeTabWithDelay;
  this.fStartChangeTab            = WWHJavaScript_StartChangeTab;
  this.fEndChangeTab              = WWHJavaScript_EndChangeTab;
  this.fSyncTOC                   = WWHJavaScript_SyncTOC;
  this.fFavoritesCurrent          = WWHJavaScript_FavoritesCurrent;

  // Load up messages
  //
  this.mMessages.fSetByLocale(WWHFrame.WWHBrowser.mLocale);

  // Disable hover text for accessibility or if popups are not supported
  //
  if (( ! WWHFrame.WWHBrowser.mbSupportsPopups) ||
      (WWHFrame.WWHHelp.mbAccessible))
  {
    this.mSettings.mHoverText.mbEnabled = false;
  }
}

function  WWHJavaScript_Init()
{
  // Create panels and tabs objects
  //
  this.mPanels = new WWHPanels_Object();
  this.mTabs   = new WWHTabs_Object(this.mPanels.mPanelEntries.length);

  // Determine initial tab setting
  //
  switch (WWHFrame.WWHHelp.mInitialTabName)
  {
    case "contents":
      this.mInitialTab = WWHFrame.WWHOutline.mPanelTabIndex;
      break;

    case "index":
      this.mInitialTab = WWHFrame.WWHIndex.mPanelTabIndex;
      break;

    case "search":
      this.mInitialTab = WWHFrame.WWHSearch.mPanelTabIndex;
      break;

    case "favorites":
      this.mInitialTab = WWHFrame.WWHFavorites.mPanelTabIndex;
      break;
  }
  if (this.mInitialTab < 0)
  {
    this.mInitialTab = 0;
  }

  // Complete initialization process
  //
  if ( ! WWHFrame.WWHHandler.mbInitialized)
  {
    WWHFrame.WWHHandler.mbInitialized = true;
    WWHFrame.WWHHelp.fHandlerInitialized();
  }
}

function  WWHJavaScript_ClickedChangeTab(ParamIndex)
{
  if ( ! this.mbClickedChangeTab)
  {
    // Change tabs
    //
    this.mbClickedChangeTab = true;
    this.fStartChangeTab(ParamIndex);
  }
}

function  WWHJavaScript_ClickedChangeTabWithDelay(ParamIndex)
{
  setTimeout("WWHFrame.WWHJavaScript.fClickedChangeTab(" + ParamIndex + ");", 1);
}

function  WWHJavaScript_StartChangeTab(ParamIndex)
{
  if (( ! this.mbChangingTabs) &&
      (this.mCurrentTab != ParamIndex))
  {
    // Signal that we are changing tabs
    //
    this.mbChangingTabs = true;

    // Update tab index
    //
    this.mCurrentTab = ParamIndex;

    // Update tab frame
    //
    this.mTabs.fReload();
  }
}

function  WWHJavaScript_EndChangeTab()
{
  if (this.mbClickedChangeTab)
  {
    this.mbClickedChangeTab = false;
  }

  // Signal that the change tab process is complete
  //
  this.mbChangingTabs = false;

  // Perform additional processing if initial tab specified
  //
  if (WWHFrame.WWHHelp.mInitialTabName == "contents")
  {
    WWHFrame.WWHHelp.mInitialTabName = null;
    WWHFrame.WWHHelp.mbAutoSyncTOC = true;
  }
  setTimeout("WWHFrame.WWHHelp.fAutoSyncTOC();", 1);
}

function  WWHJavaScript_SyncTOC(ParamBookIndex,
                                ParamFileIndex,
                                ParamAnchor,
                                bParamReportError)
{
  var  TabIndex;
  var  Index;


  // Confirm TOC is available as a tab
  //
  if (this.mSettings.mTOC.mbShow)
  {
    // Confirm file is part of a known book
    //
    if ((ParamBookIndex >= 0) &&
        (ParamFileIndex >= 0))
    {
      // Determine visibility
      //
      if (this.mPanels.fGetCurrentPanelObject().mPanelTabTitle == this.mMessages.mTabsTOCLabel)
      {
        // Sync TOC
        //
        WWHFrame.WWHOutline.fSync(ParamBookIndex, ParamFileIndex, ParamAnchor, true, bParamReportError);
      }
      else
      {
        // Determine tab to display for TOC
        //
        TabIndex = -1;
        Index = 0;
        while ((TabIndex == -1) &&
               (Index < WWHFrame.WWHJavaScript.mPanels.mPanelEntries.length))
        {
          if (WWHFrame.WWHJavaScript.mPanels.mPanelEntries[Index].mPanelObject.mPanelTabTitle == WWHFrame.WWHJavaScript.mMessages.mTabsTOCLabel)
          {
            TabIndex = Index;
          }

          Index++;
        }

        // Display contents tab and sync
        //
        if (TabIndex != -1)
        {
          // Force auto sync on tab display
          //
          WWHFrame.WWHHelp.mInitialTabName = "contents";
          WWHFrame.WWHJavaScript.fStartChangeTab(TabIndex);
        }
      }
    }
  }
}

function  WWHJavaScript_FavoritesCurrent(ParamBookIndex,
                                         ParamFileIndex)
{
  WWHFrame.WWHFavorites.fSetCurrent(ParamBookIndex, ParamFileIndex);

  // Update navigation
  //
  if (this.mPanels.fGetCurrentPanelObject().mPanelTabTitle == this.mMessages.mTabsFavoritesLabel)
  {
    // Refresh
    //
    WWHFrame.WWHJavaScript.mPanels.fReloadNavigation();
  }
}
function MultiPhrase_Object(ParamText, ParamBookSearchInfoObject)
{
  this.mSearchText     = ParamText;
  this.mWords          = new Array();
  this.mPhrases        = new Array()
  this.mPhraseObjects  = new Array();
  this.mMatchRecords   = new Array();
  this.mBookSearchInfo = ParamBookSearchInfoObject;

  // Define functions for this Object
  //
  this.fGetWords             = MultiPhrase_GetWords;
  this.fGetPhrases           = MultiPhrase_GetPhrases;
  this.fPhraseCount          = MultiPhrase_PhraseCount;
  this.fGetMatches           = MultiPhrase_GetMatchingPhrases;
  this.fResetMatches         = MultiPhrase_ResetMatches;
  this.fCheckForMatch        = MultiPhrase_CheckForMatch;
  this.fParse                = MultiPhrase_Parse;
  this.t                     = MultiPhrase_Test;
  this.fTest                 = MultiPhrase_Test;
}

/******************** Accessors ********************/
// Returns all the search words that are not part of
// phrases and that are valid search terms for the book
//
function MultiPhrase_GetWords()
{
  return this.mWords;
}

// Returns all the phrases that for the current search text
// This includes all stop words.  The phrases are as they were
// typed in by the user
//
function MultiPhrase_GetPhrases()
{
  return this.mPhrases;
}

// Returns the count of valid phrases
// If this return value is 0, then no valid phrases exist
//
function MultiPhrase_PhraseCount()
{
  return this.mPhraseObjects.length;
}

// Returns an Array of Phrases that have matched
//
function MultiPhrase_GetMatchingPhrases()
{
  var matchArray = new Array();
  var index;

  for(index = 0; index < this.mPhraseObjects.length; ++index)
  {
    if(this.mPhraseObjects[index].fIsMatch())
    {
      matchArray[matchArray.length] = this.mPhraseObjects[index];
    }
  }

  return matchArray;
}
/***************** End Accessors ******************/

// Calls ParseWordsAndPhrases to construct the mWords and mPhrases
// Array
//
function MultiPhrase_Parse()
{
  var WordsAndPhrases;
  var Index;
  var Words;
  var PhraseIndex;
  var Phrase;
  var PhraseObject;

  WordsAndPhrases = WWHStringUtilities_ParseWordsAndPhrases(this.mSearchText);

  for(Index = 0; Index < WordsAndPhrases.length; ++Index)
  {
    Words = WWHStringUtilities_ParseWordsAndPhrases(WordsAndPhrases[Index]);

    if(Words.length == 1)
    {
      if(this.mBookSearchInfo.fValidSearchWord(Words[0]))
      {
        this.mWords[this.mWords.length] = Words[0];
      }
    }
    else if(Words.length > 1)
    {
      // The entry is a phrase, construct the phrase here
      //
      Phrase = "";
      this.mPhrases[this.mPhrases.length] = WordsAndPhrases[Index];
      for(PhraseIndex = 0; PhraseIndex < Words.length; ++PhraseIndex)
      {
        if(this.mBookSearchInfo.fValidSearchWord(Words[PhraseIndex]))
        {
          Phrase += Words[PhraseIndex] + " ";
        }
      }
      if(Phrase.length > 0)
      {
        PhraseObject = new Phrase_Object(Phrase.substring(0, Phrase.length - 1));
        PhraseObject.fParse();
        this.mPhraseObjects[this.mPhraseObjects.length] = PhraseObject;
      }
    }
  }
}

// Tests all the phrases in mPhrases for matches on the
// Parameter Words
//
function MultiPhrase_Test(ParamFirst, ParamSecond)
{
  var index;
  var currentPhrase;

  for(index = 0; index < this.mPhraseObjects.length; ++index)
  {
    this.mPhraseObjects[index].fTestPhrase(ParamFirst, ParamSecond);
  }
}

// After the word pair file runs its tests on the multi phrase object
// this method will be called to see if all the phrases matched.  If they
// did then the book and file index will be recorded and stored.
//
function MultiPhrase_CheckForMatch(ParamBookIndex, ParamFileIndex)
{
  var result = false;
  var matchingPhrases = new Array();

  matchingPhrases = this.fGetMatches();

  if(this.mPhraseObjects.length > 0 &&
     matchingPhrases.length > 0 &&
     matchingPhrases.length == this.mPhraseObjects.length)
  {
    result = true;
  }

  return result;
}

// This function will be called between each pair file test to
// reset the matches from the previous pair file test.  The
// matches have been recorded so no information is lost
//
function MultiPhrase_ResetMatches()
{
  var index;
  for(index = 0; index < this.mPhraseObjects.length; ++index)
  {
    this.mPhraseObjects[index].fResetMatches();
  }
}// Copyright (c) 2000-2003 Quadralay Corporation.  All rights reserved.
//

function  WWHOutlineImagingFast_Object()
{
  this.mIterator    = new WWHOutlineIterator_Object(true);
  this.mImageSrcDir = WWHOutlineImaging_ImageSrcDir();
  this.mEventString = WWHPopup_EventString();
  this.mHTMLSegment = new WWHStringBuffer_Object();
  this.mbUseList    = true;

  this.fGetIconURL     = WWHOutlineImaging_GetIconURL;
  this.fGetPopupAction = WWHOutlineImaging_GetPopupAction;
  this.fGetLink        = WWHOutlineImaging_GetLink;
  this.fGetEntryHTML   = WWHOutlineImaging_GetEntryHTML;

  this.fGenerateStyles = WWHOutlineImagingFast_GenerateStyles;
  this.fReset          = WWHOutlineImagingFast_Reset;
  this.fAdvance        = WWHOutlineImagingFast_Advance;
  this.fOpenLevel      = WWHOutlineImagingFast_OpenLevel;
  this.fCloseLevel     = WWHOutlineImagingFast_CloseLevel;
  this.fSameLevel      = WWHOutlineImagingFast_SameLevel;
  this.fDisplayEntry   = WWHOutlineImagingFast_DisplayEntry;
  this.fUpdateEntry    = WWHOutlineImagingFast_UpdateEntry;
  this.fRevealEntry    = WWHOutlineImagingFast_RevealEntry;

  // Workaround for Windows IE
  //
  if ((WWHFrame.WWHBrowser.mBrowser == 2) &&  // Shorthand for IE
      (WWHFrame.WWHBrowser.mPlatform == 1))   // Shorthand for Windows
  {
    this.mbUseList = false;
  }
}

function  WWHOutlineImagingFast_GenerateStyles()
{
  var  StyleBuffer = new WWHStringBuffer_Object();


  StyleBuffer.fAppend("<style type=\"text/css\">\n");
  StyleBuffer.fAppend(" <!--\n");
  StyleBuffer.fAppend("  a:active\n");
  StyleBuffer.fAppend("  {\n");
  StyleBuffer.fAppend("    text-decoration: none;\n");
  StyleBuffer.fAppend("    background-color: " + WWHFrame.WWHJavaScript.mSettings.mTOC.mHighlightColor + ";\n");
  StyleBuffer.fAppend("    " + WWHFrame.WWHJavaScript.mSettings.mTOC.mFontStyle + ";\n");
  StyleBuffer.fAppend("  }\n");
  StyleBuffer.fAppend("  a:hover\n");
  StyleBuffer.fAppend("  {\n");
  StyleBuffer.fAppend("    text-decoration: underline;\n");
  StyleBuffer.fAppend("    color: " + WWHFrame.WWHJavaScript.mSettings.mTOC.mEnabledColor + ";\n");
  StyleBuffer.fAppend("    " + WWHFrame.WWHJavaScript.mSettings.mTOC.mFontStyle + ";\n");
  StyleBuffer.fAppend("  }\n");
  StyleBuffer.fAppend("  a\n");
  StyleBuffer.fAppend("  {\n");
  StyleBuffer.fAppend("    text-decoration: none;\n");
  StyleBuffer.fAppend("    color: " + WWHFrame.WWHJavaScript.mSettings.mTOC.mEnabledColor + ";\n");
  StyleBuffer.fAppend("    " + WWHFrame.WWHJavaScript.mSettings.mTOC.mFontStyle + ";\n");
  StyleBuffer.fAppend("  }\n");
  StyleBuffer.fAppend("  td\n");
  StyleBuffer.fAppend("  {\n");
  StyleBuffer.fAppend("    margin-top: 0pt;\n");
  StyleBuffer.fAppend("    margin-bottom: 0pt;\n");
  StyleBuffer.fAppend("    margin-left: 0pt;\n");
  StyleBuffer.fAppend("    margin-right: 0pt;\n");
  StyleBuffer.fAppend("    text-align: left;\n");
  StyleBuffer.fAppend("    vertical-align: middle;\n");
  StyleBuffer.fAppend("    " + WWHFrame.WWHJavaScript.mSettings.mTOC.mFontStyle + ";\n");
  StyleBuffer.fAppend("  }\n");
  if (this.mbUseList)
  {
    StyleBuffer.fAppend("  ul\n");
    StyleBuffer.fAppend("  {\n");
    StyleBuffer.fAppend("    list-style-type: none;\n");
    StyleBuffer.fAppend("    padding-left: 0pt;\n");
    StyleBuffer.fAppend("    padding-right: 0pt;\n");
    StyleBuffer.fAppend("    margin-top: 0pt;\n");
    StyleBuffer.fAppend("    margin-bottom: 0pt;\n");
    StyleBuffer.fAppend("    margin-left: 0pt;\n");
    StyleBuffer.fAppend("    margin-right: 0pt;\n");
    StyleBuffer.fAppend("  }\n");
    StyleBuffer.fAppend("  li\n");
    StyleBuffer.fAppend("  {\n");
    StyleBuffer.fAppend("    margin-top: 0pt;\n");
    StyleBuffer.fAppend("    margin-bottom: 0pt;\n");
    StyleBuffer.fAppend("    margin-left: 0pt;\n");
    StyleBuffer.fAppend("    margin-right: 0pt;\n");
    StyleBuffer.fAppend("  }\n");
  }
  else
  {
    StyleBuffer.fAppend("  div.list\n");
    StyleBuffer.fAppend("  {\n");
    StyleBuffer.fAppend("    margin-top: 0pt;\n");
    StyleBuffer.fAppend("    margin-bottom: 0pt;\n");
    StyleBuffer.fAppend("    margin-left: 0pt;\n");
    StyleBuffer.fAppend("    margin-right: 0pt;\n");
    StyleBuffer.fAppend("  }\n");
  }
  StyleBuffer.fAppend(" -->\n");
  StyleBuffer.fAppend("</style>\n");

  return StyleBuffer.fGetBuffer();
}

function  WWHOutlineImagingFast_Reset()
{
  this.mIterator.fReset(WWHFrame.WWHOutline.mTopEntry);
}

function  WWHOutlineImagingFast_Advance(ParamMaxHTMLSegmentSize)
{
  var  Entry;


  this.mHTMLSegment.fReset();
  while (((ParamMaxHTMLSegmentSize == -1) ||
          (this.mHTMLSegment.fSize() < ParamMaxHTMLSegmentSize)) &&
         (this.mIterator.fAdvance(this)))
  {
    Entry = this.mIterator.mEntry;

    // Process current entry
    //
    if (Entry.mbShow)
    {
      if (this.mbUseList)
      {
        this.mHTMLSegment.fAppend("<li id=i" + Entry.mID + ">");
        this.mHTMLSegment.fAppend(this.fDisplayEntry(Entry));
      }
      else
      {
        if (Entry.mChildren != null)
        {
          this.mHTMLSegment.fAppend("<div class=\"list\" id=l" + Entry.mID + ">\n");
          this.mHTMLSegment.fAppend(this.fDisplayEntry(Entry));
          if ( ! Entry.mbExpanded)
          {
            this.mHTMLSegment.fAppend("</div>\n");
          }
        }
        else
        {
          this.mHTMLSegment.fAppend(this.fDisplayEntry(Entry));
        }
      }
    }
  }

  return (this.mHTMLSegment.fSize() > 0);  // Return true if segment created
}

function  WWHOutlineImagingFast_OpenLevel()
{
  if (this.mbUseList)
  {
    this.mHTMLSegment.fAppend("<ul>\n");
  }
}

function  WWHOutlineImagingFast_CloseLevel(bParamScopeComplete)
{
  if (this.mbUseList)
  {
    this.mHTMLSegment.fAppend("</li>\n");
    this.mHTMLSegment.fAppend("</ul>\n");
    if ( ! bParamScopeComplete)
    {
      this.mHTMLSegment.fAppend("</li>\n");
    }
  }
  else
  {
    if ( ! bParamScopeComplete)
    {
      this.mHTMLSegment.fAppend("</div>\n");
    }
  }
}

function  WWHOutlineImagingFast_SameLevel()
{
  if (this.mbUseList)
  {
    this.mHTMLSegment.fAppend("</li>\n");
  }
}

function  WWHOutlineImagingFast_DisplayEntry(ParamEntry)
{
  var  VarEntryHTML = "";


  if (this.mbUseList)
  {
    VarEntryHTML += this.fGetEntryHTML(ParamEntry) + "\n";
  }
  else
  {
    VarEntryHTML += "<div id=i" + ParamEntry.mID + ">" + this.fGetEntryHTML(ParamEntry) + "</div>\n";
  }

  return VarEntryHTML;
}

function  WWHOutlineImagingFast_UpdateEntry(ParamEntry)
{
  var  EntryHTML = "";
  var  ElementID;
  var  VarPanelViewFrame;


  // Get entry display
  //
  EntryHTML = this.fDisplayEntry(ParamEntry);

  // Reset iterator to process current entry's children
  //
  this.mIterator.fReset(ParamEntry);

  // Process display of children
  //
  if (this.fAdvance(-1))
  {
    // Result already stored in this.mHTMLSegment
    //
  }

  // Close down any popups we had going to prevent JavaScript errors
  //
  WWHFrame.WWHJavaScript.mPanels.mPopup.fHide();

  // Update HTML
  //
  VarPanelViewFrame = eval(WWHFrame.WWHHelp.fGetFrameReference("WWHPanelViewFrame"));
  if (this.mbUseList)
  {
    ElementID = "i" + ParamEntry.mID;
  }
  else
  {
    ElementID = "l" + ParamEntry.mID;
  }
  if ((WWHFrame.WWHBrowser.mBrowser == 2) ||  // Shorthand for IE
      (WWHFrame.WWHBrowser.mBrowser == 3))    // Shorthand for iCab
  {
    VarPanelViewFrame.document.all[ElementID].innerHTML = EntryHTML + this.mHTMLSegment.fGetBuffer();
  }
  else if ((WWHFrame.WWHBrowser.mBrowser == 4) ||  // Shorthand for Netscape 6.0
           (WWHFrame.WWHBrowser.mBrowser == 5))    // Shorthand for Safari
  {
    VarPanelViewFrame.document.getElementById(ElementID).innerHTML = EntryHTML + this.mHTMLSegment.fGetBuffer();
  }
}

function  WWHOutlineImagingFast_RevealEntry(ParamEntry,
                                            bParamVisible)
{
  var  ParentEntry;
  var  LastClosedParentEntry = null;


  // Expand out enclosing entries
  //
  ParentEntry = ParamEntry.mParent;
  while (ParentEntry != null)
  {
    if ( ! ParentEntry.mbExpanded)
    {
      ParentEntry.mbExpanded = true;
      LastClosedParentEntry = ParentEntry;
    }

    ParentEntry = ParentEntry.mParent;
  }

  // Set target entry
  //
  WWHFrame.WWHOutline.mPanelAnchor = "t" + ParamEntry.mID;

  // Update display
  //
  if (bParamVisible)
  {
    // Expand parent entry to reveal target entry
    //
    if (LastClosedParentEntry != null)
    {
      this.fUpdateEntry(LastClosedParentEntry);
    }

    // Display target
    //
    WWHFrame.WWHJavaScript.mPanels.fJumpToAnchor();
  }
}
// Copyright (c) 2000-2003 Quadralay Corporation.  All rights reserved.
//

function  WWHOutline_Object()
{
  var  bUseSafeMethods = true;


  // Determine display method based on browser type
  //
  if ((WWHFrame.WWHBrowser.mBrowser == 2) ||  // Shorthand for IE
      (WWHFrame.WWHBrowser.mBrowser == 3) ||  // Shorthand for iCab
      (WWHFrame.WWHBrowser.mBrowser == 4) ||  // Shorthand for Netscape 6.0 (Mozilla)
      (WWHFrame.WWHBrowser.mBrowser == 5))    // Shorthand for Safari
  {
    bUseSafeMethods = false;
  }

  this.mbPanelInitialized = false;
  this.mPanelAnchor       = null;
  this.mPanelTabTitle     = WWHFrame.WWHJavaScript.mMessages.mTabsTOCLabel;
  this.mPanelTabIndex     = -1;
  this.mPanelFilename     = "panelvie.htm";
  this.mInitIndex         = 0;
  this.mBookEntryArray    = new Array();
  this.mEntryHash         = new WWHOutlineEntryHash_Object();
  this.mTopEntry          = new WWHOutlineEntry_Top_Object();
  this.mNextEntryID       = 0;
  this.mMaxLevel          = 0;
  this.mSyncBookIndex     = null;
  this.mSyncFileIndex     = null;
  this.mSyncAnchor        = null;
  this.mImagingObject     = (bUseSafeMethods) ? new WWHOutlineImagingSafe_Object() : new WWHOutlineImagingFast_Object();

  this.fInitHeadHTML          = WWHOutline_InitHeadHTML;
  this.fInitBodyHTML          = WWHOutline_InitBodyHTML;
  this.fInitGroupings         = WWHOutline_InitGroupings;
  this.fInitLoadBookTOC       = WWHOutline_InitLoadBookTOC;
  this.fHeadHTML              = WWHOutline_HeadHTML;
  this.fClickedExpand         = WWHOutline_ClickedExpand;
  this.fClickedCollapse       = WWHOutline_ClickedCollapse;
  this.fClickedDisplayDoc     = WWHOutline_ClickedDisplayDoc;
  this.fStartHTMLSegments     = WWHOutline_StartHTMLSegments;
  this.fAdvanceHTMLSegment    = WWHOutline_AdvanceHTMLSegment;
  this.fGetHTMLSegment        = WWHOutline_GetHTMLSegment;
  this.fEndHTMLSegments       = WWHOutline_EndHTMLSegments;
  this.fPanelNavigationLoaded = WWHOutline_PanelNavigationLoaded;
  this.fPanelViewLoaded       = WWHOutline_PanelViewLoaded;
  this.fHoverTextTranslate    = WWHOutline_HoverTextTranslate;
  this.fHoverTextFormat       = WWHOutline_HoverTextFormat;
  this.fExpand                = WWHOutline_Expand;
  this.fCollapse              = WWHOutline_Collapse;
  this.fDisplayDoc            = WWHOutline_DisplayDoc;
  this.fSync                  = WWHOutline_Sync;
}

function  WWHOutline_InitHeadHTML()
{
  var  InitHeadHTML = "";


  return InitHeadHTML;
}

function  WWHOutline_InitBodyHTML()
{
  var  HTML = new WWHStringBuffer_Object();
  var  BookList = WWHFrame.WWHHelp.mBooks.mBookList;
  var  VarParameters;


  // Workaround Safari reload bug
  //
  VarParameters = "";
  if (WWHFrame.WWHBrowser.mBrowser == 5)  // Shorthhand for Safari
  {
    VarParameters = "?" + (new Date() * 1);
  }

  // Display initializing message
  //
  HTML.fAppend("<h2>" + WWHFrame.WWHJavaScript.mMessages.mInitializingMessage + "</h2>\n");

  // Create top level entries for groups and books
  //
  this.fInitGroupings(this.mTopEntry, WWHFrame.WWHHelp.mBookGroups);

  // Load book TOC data
  //
  this.mInitIndex = 0;
  HTML.fAppend("<script language=\"JavaScript1.2\" src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhbdata/js/toc.js" + VarParameters + "\"></script>\n");

  return HTML.fGetBuffer();
}

function  WWHOutline_InitGroupings(ParamParentEntry,
                                   ParamGroup)
{
  var  MaxIndex;
  var  Index;
  var  GroupEntry;
  var  TOCEntry;


  for (MaxIndex = ParamGroup.mChildren.length, Index = 0 ; Index < MaxIndex ; Index++)
  {
    GroupEntry = ParamGroup.mChildren[Index];

    if (GroupEntry.mbGrouping)
    {
      // Create entry in TOC
      //
      TOCEntry = ParamParentEntry.fNewChild(GroupEntry.mTitle, "", GroupEntry.mIcon, GroupEntry.mOpenIcon);
      TOCEntry.mbExpanded = GroupEntry.mbExpand;

      this.fInitGroupings(TOCEntry, GroupEntry);
    }
    else  // Must be a book directory
    {
      TOCEntry = ParamParentEntry.fNewChild(WWHFrame.WWHHelp.mBooks.mBookList[this.mBookEntryArray.length].mTitle, "", GroupEntry.mIcon, GroupEntry.mOpenIcon);

      // Set display options
      //
      TOCEntry.mbShow = GroupEntry.mbShow;
      if (GroupEntry.mbShow)
      {
        TOCEntry.mbExpanded = GroupEntry.mbExpand;
      }
      else
      {
        TOCEntry.mbExpanded = true;
        TOCEntry.mLevel     = ParamParentEntry.mLevel;
      }

      // Add to mBookEntryArray
      //
      this.mBookEntryArray[this.mBookEntryArray.length] = TOCEntry;
    }
  }
}

function  WWHOutline_InitLoadBookTOC(ParamAddTOCEntriesFunc)
{
  var  BookEntry;


  // Access book entry
  //
  BookEntry = this.mBookEntryArray[this.mInitIndex];

  // Set Book Index
  //
  BookEntry.mBookIndex = this.mInitIndex;

  // Load TOC
  //
  ParamAddTOCEntriesFunc(BookEntry);

  // Assign URL for book entry
  //
  if ((BookEntry.mbShow) &&
      (WWHFrame.WWHHelp.mBooks.mBookList[BookEntry.mBookIndex].mFiles.mFileList.length > 0))
  {
    BookEntry.mURL = "0";
  }

  // Increment init book index
  //
  this.mInitIndex++;

  // Mark initialized if done
  //
  if (this.mInitIndex == WWHFrame.WWHHelp.mBooks.mBookList.length)
  {
    this.mbPanelInitialized = true;

    // Sync contents if necessary
    //
    if ((this.mSyncBookIndex != null) &&
        (this.mSyncFileIndex != null)
        (this.mSyncAnchor != null))
    {
      this.fSync(this.mSyncBookIndex, this.mSyncFileIndex, this.mSyncAnchor, false);

      this.mSyncBookIndex = null;
      this.mSyncFileIndex = null;
      this.mSyncAnchor    = null;
    }
  }
}

function  WWHOutline_HeadHTML()
{
  var  HTML = new WWHStringBuffer_Object();


  // Write formatting styles
  //
  HTML.fAppend(this.mImagingObject.fGenerateStyles());

  return HTML.fGetBuffer();
}

function  WWHOutline_ClickedExpand(ParamEntryID)
{
  var  VarAnchorPrefix;


  // Expand
  //
  this.fExpand(ParamEntryID);

  // Set focus
  //
  if (WWHFrame.WWHHelp.mbAccessible)
  {
    VarAnchorPrefix = "t";
  }
  else
  {
    VarAnchorPrefix = "tb";
  }
  WWHFrame.WWHHelp.fFocus("WWHPanelViewFrame", VarAnchorPrefix + ParamEntryID);
}

function  WWHOutline_ClickedCollapse(ParamEntryID)
{
  var  VarAnchorPrefix;


  // Collapse
  //
  this.fCollapse(ParamEntryID);

  // Set focus
  //
  if (WWHFrame.WWHHelp.mbAccessible)
  {
    VarAnchorPrefix = "t";
  }
  else
  {
    VarAnchorPrefix = "tb";
  }
  WWHFrame.WWHHelp.fFocus("WWHPanelViewFrame", VarAnchorPrefix + ParamEntryID);
}

function  WWHOutline_ClickedDisplayDoc(ParamEntryID)
{
  this.fDisplayDoc(ParamEntryID);
}

function  WWHOutline_StartHTMLSegments()
{
  var  HTML = new WWHStringBuffer_Object();


  // Reset imaging object
  //
  this.mImagingObject.fReset();

  // Define accessor functions to reduce file size
  //
  HTML.fAppend("<script type=\"text/javascript\" language=\"JavaScript1.2\">\n");
  HTML.fAppend(" <!--\n");
  HTML.fAppend("  function  fE(ParamEntryID)\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    WWHFrame.WWHOutline.fClickedExpand(ParamEntryID);\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("\n");
  HTML.fAppend("  function  fC(ParamEntryID)\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    WWHFrame.WWHOutline.fClickedCollapse(ParamEntryID);\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("\n");
  HTML.fAppend("  function  fD(ParamEntryID)\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    WWHFrame.WWHOutline.fClickedDisplayDoc(ParamEntryID);\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("\n");
  HTML.fAppend("  function  fS(ParamEntryID,\n");
  HTML.fAppend("               ParamEvent)\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    WWHFrame.WWHJavaScript.mPanels.mPopup.fShow(ParamEntryID, ParamEvent);\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("\n");
  HTML.fAppend("  function  fH()\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    WWHFrame.WWHJavaScript.mPanels.mPopup.fHide();\n");
  HTML.fAppend("  }\n");
  HTML.fAppend(" // -->\n");
  HTML.fAppend("</script>\n");

  return HTML.fGetBuffer();
}

function  WWHOutline_AdvanceHTMLSegment()
{
  return this.mImagingObject.fAdvance(WWHFrame.WWHJavaScript.mMaxHTMLSegmentSize);
}

function  WWHOutline_GetHTMLSegment()
{
  return this.mImagingObject.mHTMLSegment.fGetBuffer();
}

function  WWHOutline_EndHTMLSegments()
{
  return "";
}

function  WWHOutline_PanelNavigationLoaded()
{
}

function  WWHOutline_PanelViewLoaded()
{
  // Restore focus
  //
  WWHFrame.WWHHelp.fFocus("WWHPanelViewFrame");
}

function  WWHOutline_HoverTextTranslate(ParamEntryID)
{
  return this.mEntryHash[ParamEntryID].mText;
}

function  WWHOutline_HoverTextFormat(ParamWidth,
                                     ParamTextID,
                                     ParamText)
{
  var  FormattedText   = "";
  var  ForegroundColor = WWHFrame.WWHJavaScript.mSettings.mHoverText.mForegroundColor;
  var  BackgroundColor = WWHFrame.WWHJavaScript.mSettings.mHoverText.mBackgroundColor;
  var  BorderColor     = WWHFrame.WWHJavaScript.mSettings.mHoverText.mBorderColor;
  var  ImageDir        = WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/common/images";
  var  ReqSpacer1w2h   = "<img src=\"" + ImageDir + "/spc1w2h.gif\" width=1 height=2 alt=\"\">";
  var  ReqSpacer2w1h   = "<img src=\"" + ImageDir + "/spc2w1h.gif\" width=2 height=1 alt=\"\">";
  var  ReqSpacer1w7h   = "<img src=\"" + ImageDir + "/spc1w7h.gif\" width=1 height=7 alt=\"\">";
  var  ReqSpacer5w1h   = "<img src=\"" + ImageDir + "/spc5w1h.gif\" width=5 height=1 alt=\"\">";
  var  Spacer1w2h      = ReqSpacer1w2h;
  var  Spacer2w1h      = ReqSpacer2w1h;
  var  Spacer1w7h      = ReqSpacer1w7h;
  var  Spacer5w1h      = ReqSpacer5w1h;
  var  StyleAtttribute;


  // Set style attribute to insure small image height
  //
  StyleAttribute = " style=\"font-size: 1px; line-height: 1px;\"";

  FormattedText += "<table width=\"" + ParamWidth + "\" border=0 cellspacing=0 cellpadding=0 bgcolor=\"" + BackgroundColor + "\">";
  FormattedText += " <tr>";
  FormattedText += "  <td" + StyleAttribute + " height=2 colspan=5 bgcolor=\"" + BorderColor + "\">" + Spacer1w2h + "</td>";
  FormattedText += " </tr>";

  FormattedText += " <tr>";
  FormattedText += "  <td" + StyleAttribute + " height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  FormattedText += "  <td" + StyleAttribute + " height=7 colspan=3>" + Spacer1w7h + "</td>";
  FormattedText += "  <td" + StyleAttribute + " height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  FormattedText += " </tr>";

  FormattedText += " <tr>";
  FormattedText += "  <td bgcolor=\"" + BorderColor + "\">" + ReqSpacer2w1h + "</td>";
  FormattedText += "  <td>" + ReqSpacer5w1h + "</td>";
  FormattedText += "  <td width=\"100%\" id=\"" + ParamTextID + "\" style=\"color: " + ForegroundColor + " ; " + WWHFrame.WWHJavaScript.mSettings.mHoverText.mFontStyle + "\">" + ParamText + "</td>";
  FormattedText += "  <td>" + ReqSpacer5w1h + "</td>";
  FormattedText += "  <td bgcolor=\"" + BorderColor + "\">" + ReqSpacer2w1h + "</td>";
  FormattedText += " </tr>";

  FormattedText += " <tr>";
  FormattedText += "  <td" + StyleAttribute + " height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  FormattedText += "  <td" + StyleAttribute + " height=7 colspan=3>" + Spacer1w7h + "</td>";
  FormattedText += "  <td" + StyleAttribute + " height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  FormattedText += " </tr>";

  FormattedText += " <tr>";
  FormattedText += "  <td" + StyleAttribute + " height=2 colspan=5 bgcolor=\"" + BorderColor + "\">" + Spacer1w2h + "</td>";
  FormattedText += " </tr>";
  FormattedText += "</table>";

  return FormattedText;
}

function  WWHOutline_Expand(ParamEntryID)
{
  var  Entry = this.mEntryHash[ParamEntryID];


  Entry.mbExpanded = true;
  this.mImagingObject.fUpdateEntry(Entry);
}

function  WWHOutline_Collapse(ParamEntryID)
{
  var  Entry = this.mEntryHash[ParamEntryID];


  Entry.mbExpanded = false;
  this.mImagingObject.fUpdateEntry(Entry);
}

function  WWHOutline_DisplayDoc(ParamEntryID)
{
  var  Entry;
  var  Parent;
  var  DocumentDisplayed;
  var  Parts;
  var  LinkFileIndex;
  var  LinkAnchor;
  var  BookListEntry;
  var  URL;


  // Close down any popups we had going to prevent JavaScript errors
  //
  WWHFrame.WWHJavaScript.mPanels.mPopup.fHide();

  // Access entry
  //
  Entry = this.mEntryHash[ParamEntryID];

  // Determine which book this document belongs to
  //
  Parent = Entry;
  while ((typeof(Parent.mBookIndex) != "number") &&
         (Parent.mParent != null))
  {
    Parent = Parent.mParent;
  }

  DocumentDisplayed = false;
  if (typeof(Parent.mBookIndex) == "number")
  {
    // Confirm URL defined (handles group entries)
    //
    if (Entry.mURL.length > 0)
    {
      // Determine link file index and anchor
      //
      Parts = Entry.mURL.split("#");
      LinkFileIndex = parseInt(Parts[0]);
      LinkAnchor = null;
      if (Parts.length > 1)
      {
        if (Parts[1].length > 0)
        {
          LinkAnchor = Parts[1];
        }
      }

      URL = WWHFrame.WWHHelp.fGetBookIndexFileIndexURL(Parent.mBookIndex, LinkFileIndex, LinkAnchor);
      WWHFrame.WWHHelp.fSetDocumentHREF(URL, false);
      DocumentDisplayed = true;
    }
  }

  // Expand/collapse view as needed
  //
  if (Entry.mbExpanded)
  {
    // Collapse folder if Accessible
    //
    if (WWHFrame.WWHHelp.mbAccessible)
    {
      // Document displayed?
      //
      if (DocumentDisplayed)
      {
        // Indicate collapsing
        //
        WWHFrame.WWHHelp.mCollapsingTOCEntry = true;
      }

      this.fCollapse(ParamEntryID);

      // Set focus
      //
      WWHFrame.WWHHelp.fFocus("WWHPanelViewFrame", "t" + ParamEntryID);
    }
  }
  else
  {
    // Expand if folder
    //
    if (Entry.mChildren != null)
    {
      this.fExpand(ParamEntryID);

      // Set focus
      //
      WWHFrame.WWHHelp.fFocus("WWHPanelViewFrame", "t" + ParamEntryID);
    }
  }
}

function  WWHOutline_Sync(ParamBookIndex,
                          ParamFileIndex,
                          ParamAnchor,
                          bParamVisible,
                          bParamReportError)
{
  var  BookEntry;
  var  MaxIndex;
  var  Index;
  var  SearchPattern;
  var  Iterator;
  var  MatchedEntry;
  var  CandidateEntry;


  if ( ! this.mbPanelInitialized)
  {
    this.mSyncBookIndex = ParamBookIndex;
    this.mSyncFileIndex = ParamFileIndex;
    this.mSyncAnchor    = ParamAnchor;
  }
  else  // (this.mbPanelInitialized)
  {
    BookEntry = null;
    MatchedEntry = null;

    // Find book entry
    //
    if (this.mBookEntryArray.length > 0)
    {
      // Find matching book entry
      //
      for (MaxIndex = this.mBookEntryArray.length, Index = 0 ; Index < MaxIndex ; Index++)
      {
        if (this.mBookEntryArray[Index].mBookIndex == ParamBookIndex)
        {
          BookEntry = this.mBookEntryArray[Index];
        }
      }
    }

    // Confirm we found our matching book entry
    //
    if (BookEntry != null)
    {
      // Confirm we have a possible entry
      //
      if (ParamFileIndex != -1)
      {
        SearchPattern = "" + ParamFileIndex + ParamAnchor;
        Iterator = new WWHOutlineIterator_Object(false);

        if (ParamAnchor.length > 0)
        {
          // Look for match
          //
          Iterator.fReset(BookEntry);
          while ((MatchedEntry == null) &&
                 (Iterator.fAdvance(null)))
          {
            if (Iterator.mEntry.mURL == SearchPattern)
            {
              MatchedEntry = Iterator.mEntry;
            }
          }
        }

        // If match not found, search using just the file index without the anchor
        //
        if (MatchedEntry == null)
        {
          SearchPattern = "" + ParamFileIndex;

          // Look for match
          //
          Iterator.fReset(BookEntry);
          while ((MatchedEntry == null) &&
                 (Iterator.fAdvance(null)))
          {
            // Trim of any trailing anchor information, if specified
            //
            if (Iterator.mEntry.mURL.indexOf("#") != -1)
            {
              CandidateEntry = Iterator.mEntry.mURL.substring(0, Iterator.mEntry.mURL.indexOf("#"));
            }
            else
            {
              CandidateEntry = Iterator.mEntry.mURL;
            }

            if (CandidateEntry == SearchPattern)
            {
              MatchedEntry = Iterator.mEntry;
            }
          }
        }

        // See if this matches the book entry
        //
        if ((MatchedEntry == null) &&
            (BookEntry.mbShow))
        {
          SearchPattern = "" + ParamFileIndex;

          if (SearchPattern == BookEntry.mURL)
          {
            MatchedEntry = BookEntry;
          }
        }

        // Sync display if entry found
        //
        if (MatchedEntry != null)
        {
          // Update display
          //
          this.mImagingObject.fRevealEntry(MatchedEntry, bParamVisible);
        }
      }
    }

    // Display a message if the entry was not found
    //
    if (bParamReportError)
    {
      if ((BookEntry == null) ||
          (MatchedEntry == null))
      {
        setTimeout("alert(\"" + WWHFrame.WWHJavaScript.mMessages.mTOCFileNotFoundMessage + "\");", 1);
      }
    }
  }
}

function  WWHOutlineEntry_Top_Object()
{
  this.mParent    = null;
  this.mbShow     = false;
  this.mText      = "Top Level";
  this.mURL       = "";
  this.mID        = -1;
  this.mLevel     = -1;
  this.mbExpanded = true;
  this.mChildren  = null;

  this.fNewChild = WWHOutlineEntry_NewChild;
  this.fN        = WWHOutlineEntry_NewChild;
}

function  WWHOutlineEntry_Object(ParamParent,
                                 ParamText,
                                 ParamURL,
                                 ParamIcon,
                                 ParamOpenIcon)
{
  this.mParent    = ParamParent;
  this.mbShow     = true;
  this.mText      = ParamText;
  this.mURL       = (typeof(ParamURL) == "string") ? ParamURL : "";
  this.mID        = WWHFrame.WWHOutline.mNextEntryID;
  this.mLevel     = ParamParent.mLevel + 1;
  this.mbExpanded = false;
  this.mChildren  = null;

  this.fNewChild = WWHOutlineEntry_NewChild;
  this.fN        = WWHOutlineEntry_NewChild;

  // Assign custom icons if defined
  //
  if (typeof(ParamIcon) == "string")
  {
    this.mIcon = ParamIcon;
  }
  if (typeof(ParamOpenIcon) == "string")
  {
    this.mOpenIcon = ParamOpenIcon;
  }

  // Increment ID
  //
  WWHFrame.WWHOutline.mNextEntryID++;
}

function  WWHOutlineEntry_NewChild(ParamText,
                                   ParamURL,
                                   ParamIcon,
                                   ParamOpenIcon)
{
  var  NewChild;


  // Create a new entry
  //
  NewChild = new WWHOutlineEntry_Object(this, ParamText, ParamURL, ParamIcon, ParamOpenIcon);

  // Expand top level entries, if necessary
  //
  if (NewChild.mLevel == 0)
  {
    if (WWHFrame.WWHHelp.mBookGroups.mbExpandAllAtTop)
    {
      NewChild.mbExpanded = true;
    }
  }

  // Add to entry hash keyed by ID
  //
  WWHFrame.WWHOutline.mEntryHash[NewChild.mID] = NewChild;

  // Add child to parent entry
  //
  if (this.mChildren == null)
  {
    this.mChildren = new Array(NewChild);
  }
  else
  {
    this.mChildren[this.mChildren.length] = NewChild;
  }

  // Bump mMaxLevel if we've exceeded it
  //
  if (NewChild.mLevel > WWHFrame.WWHOutline.mMaxLevel)
  {
    WWHFrame.WWHOutline.mMaxLevel = NewChild.mLevel;
  }

  return NewChild;
}

function  WWHOutlineEntryHash_Object()
{
}

function  WWHOutlineIterator_Object(bParamVisibleOnly)
{
  this.mbVisibleOnly  = bParamVisibleOnly;
  this.mIteratorScope = null;
  this.mEntry         = null;
  this.mStack         = new Array();

  this.fReset   = WWHOutlineIterator_Reset;
  this.fAdvance = WWHOutlineIterator_Advance;
}

function  WWHOutlineIterator_Reset(ParamEntry)
{
  this.mIteratorScope = ParamEntry;
  this.mEntry         = ParamEntry;
  this.mStack.length  = 0;
}

function  WWHOutlineIterator_Advance(ParamLevelStatusObject)
{
  var  bSameLevel;
  var  ParentEntry;
  var  StackTop;


  // Advance to the next visible entry
  //
  if (this.mEntry != null)
  {
    // Check for visible children
    //
    if ((this.mEntry.mChildren != null) &&
        (( ! this.mbVisibleOnly) ||
         (this.mEntry.mbExpanded)))
    {
      // Process children
      //
      this.mEntry = this.mEntry.mChildren[0];
      this.mStack[this.mStack.length] = 0;

      if (ParamLevelStatusObject != null)
      {
        ParamLevelStatusObject.fOpenLevel();
      }
    }
    // If we've reached the iterator scope, we're done
    //
    else if (this.mEntry.mID == this.mIteratorScope.mID)
    {
      this.mEntry = null;
    }
    else
    {
      bSameLevel = true;
      ParentEntry = this.mEntry.mParent;
      this.mEntry = null;

      // Find next child of parent entry
      //
      while (ParentEntry != null)
      {
        // Increment position
        //
        StackTop = this.mStack.length - 1;
        this.mStack[StackTop]++;

        // Confirm this is a valid entry
        //
        if (this.mStack[StackTop] < ParentEntry.mChildren.length)
        {
          // Return the parent's next child
          //
          this.mEntry = ParentEntry.mChildren[this.mStack[StackTop]];

          // Signal break from loop
          //
          ParentEntry = null;
        }
        else
        {
          // Last child of parent, try up a level
          //
          if (ParentEntry.mID == this.mIteratorScope.mID)
          {
            ParentEntry = null;
          }
          else
          {
            ParentEntry = ParentEntry.mParent;
          }

          this.mStack.length--;

          bSameLevel = false;

          if (ParamLevelStatusObject != null)
          {
            ParamLevelStatusObject.fCloseLevel(ParentEntry == null);
          }
        }
      }

      if (bSameLevel)
      {
        if (ParamLevelStatusObject != null)
        {
          ParamLevelStatusObject.fSameLevel();
        }
      }
    }
  }

  return (this.mEntry != null);
}

function  WWHOutlineImaging_ImageSrcDir()
{
  var  ImageSrcDir = "../../../";


  // Update img src reference based on browser type and platform
  //
  if ((WWHFrame.WWHBrowser.mBrowser == 2) &&  // Shorthand for IE
      (WWHFrame.WWHBrowser.mPlatform == 2))   // Shorthand for Macintosh
  {
    ImageSrcDir = WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/";
  }

  return ImageSrcDir;
}

function  WWHOutlineImaging_GetIconURL(ParamEntry)
{
  var  IconURL = "";


  if (ParamEntry.mChildren != null)
  {
    if (ParamEntry.mbExpanded)
    {
      if (typeof(ParamEntry.mOpenIcon) == "string")
      {
        IconURL = this.mImageSrcDir + "images/" + ParamEntry.mOpenIcon;
      }
      else if (typeof(ParamEntry.mIcon) == "string")
      {
        IconURL = this.mImageSrcDir + "images/" + ParamEntry.mIcon;
      }
      else
      {
        IconURL = this.mImageSrcDir + "wwhimpl/common/images/fo.gif";
      }
    }
    else
    {
      if (typeof(ParamEntry.mIcon) == "string")
      {
        IconURL = this.mImageSrcDir + "images/" + ParamEntry.mIcon;
      }
      else
      {
        IconURL = this.mImageSrcDir + "wwhimpl/common/images/fc.gif";
      }
    }
  }
  else
  {
    if (typeof(ParamEntry.mIcon) == "string")
    {
      IconURL = this.mImageSrcDir + "images/" + ParamEntry.mIcon;
    }
    else
    {
      IconURL = this.mImageSrcDir + "wwhimpl/common/images/doc.gif";
    }
  }

  return IconURL;
}

function  WWHOutlineImaging_GetPopupAction(ParamEntry)
{
  var  PopupAction = "";


  if (WWHFrame.WWHJavaScript.mSettings.mHoverText.mbEnabled)
  {
    PopupAction += " onmouseover=\"fS(" + ParamEntry.mID + ", " + this.mEventString + ");\"";
    PopupAction += " onmouseout=\"fH();\"";
  }

  return PopupAction;
}

function  WWHOutlineImaging_GetLink(ParamEntry,
                                    bParamForIcon)
{
  var  VarLink;
  var  VarAccessibilityMessage;
  var  VarAccessibilityTitle = "";
  var  VarSiblings;
  var  VarMaxIndex;
  var  VarIndex;
  var  VarIDPrefix;
  var  VarAction;


  // Initialize return value
  //
  VarLink = "";

  // Determine title for accessibility
  //
  if (WWHFrame.WWHHelp.mbAccessible)
  {
    // Determine if this is a book or a topic
    //
    if (ParamEntry.mChildren != null)
    {
      if (ParamEntry.mbExpanded)
      {
        VarAccessibilityMessage = WWHFrame.WWHJavaScript.mMessages.mAccessibilityTOCBookExpanded;
      }
      else
      {
        VarAccessibilityMessage = WWHFrame.WWHJavaScript.mMessages.mAccessibilityTOCBookCollapsed;
      }
    }
    else
    {
      VarAccessibilityMessage = WWHFrame.WWHJavaScript.mMessages.mAccessibilityTOCTopic;
    }

    // Format message
    //
    VarAccessibilityTitle = WWHStringUtilities_FormatMessage(VarAccessibilityMessage,
                                                             ParamEntry.mText);

    // Add position information
    //
    if (ParamEntry.mParent != null)
    {
      VarSiblings = ParamEntry.mParent.mChildren;
      VarMaxIndex = VarSiblings.length;
      VarIndex = 0;
      while (VarIndex < VarMaxIndex)
      {
        if (VarSiblings[VarIndex].mID == ParamEntry.mID)
        {
          // Record position
          //
          VarAccessibilityTitle += " " + WWHStringUtilities_FormatMessage(WWHFrame.WWHJavaScript.mMessages.mAccessibilityTOCOneOfTotal,
                                                                          (VarIndex + 1),
                                                                          VarMaxIndex);

          // Exit loop
          //
          VarIndex = VarMaxIndex;
        }

        VarIndex += 1;
      }
    }

    VarAccessibilityTitle = WWHStringUtilities_EscapeHTML(VarAccessibilityTitle);
    VarAccessibilityTitle = " title=\"" + VarAccessibilityTitle + "\"";
  }

  // Set link
  //
  if ((ParamEntry.mURL.length > 0) ||
      (ParamEntry.mChildren != null))
  {
    if (bParamForIcon)
    {
      VarIDPrefix = "tb";
    }
    else
    {
      VarIDPrefix = "t";
    }

    // Determine display action
    //
    VarAction = "fD";
    if ( ! WWHFrame.WWHHelp.mbAccessible)
    {
      if (bParamForIcon)
      {
        if (ParamEntry.mChildren != null)
        {
          if (ParamEntry.mbExpanded)
          {
            VarAction = "fC";
          }
          else
          {
            VarAction = "fE";
          }
        }
      }
    }

    VarLink += "<a name=\"" + VarIDPrefix + ParamEntry.mID + "\" href=\"javascript:" + VarAction + "(" + ParamEntry.mID + ");\"" + VarAccessibilityTitle + this.fGetPopupAction(ParamEntry) + ">";
  }

  return VarLink;
}

function  WWHOutlineImaging_GetEntryHTML(ParamEntry)
{
  var  EntryHTML = "";
  var  IconURL;
  var  VarLink;


  EntryHTML += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
  EntryHTML += "<tr>";
  if (ParamEntry.mLevel > 0)
  {
    EntryHTML += "<td width=\"" + (WWHFrame.WWHJavaScript.mSettings.mTOC.mIndent * ParamEntry.mLevel) + "\">";
    EntryHTML += "<img width=\"" + (WWHFrame.WWHJavaScript.mSettings.mTOC.mIndent * ParamEntry.mLevel) + "\" height=\"2\" border=\"0\" src=\"" + this.mImageSrcDir + "wwhimpl/common/images/spc1w2h.gif\" alt=\"\">";
    EntryHTML += "</td>";
  }
  EntryHTML += "<td width=\"19\">";
  EntryHTML += "<nobr>";

  IconURL = this.fGetIconURL(ParamEntry);
  VarLink = this.fGetLink(ParamEntry, true);
  if (VarLink.length > 0)
  {
    EntryHTML += VarLink;
  }
  EntryHTML += "<img width=\"17\" height=\"17\" border=\"0\" src=\"" + IconURL + "\" alt=\"\">";
  if (VarLink.length > 0)
  {
    if ( ! WWHFrame.WWHHelp.mbAccessible)
    {
      EntryHTML += "</a>";
    }
  }
  EntryHTML += "<img width=\"2\" height=\"1\" border=\"0\" src=\"" + this.mImageSrcDir + "wwhimpl/common/images/spc2w1h.gif\" alt=\"\">";
  if (VarLink.length > 0)
  {
    if (WWHFrame.WWHHelp.mbAccessible)
    {
      EntryHTML += "</a>";
    }
  }

  EntryHTML += "</nobr>";
  EntryHTML += "</td>";
  EntryHTML += "<td>";
  EntryHTML += "<nobr>";

  VarLink = this.fGetLink(ParamEntry, false);
  if (VarLink.length > 0)
  {
    EntryHTML += VarLink;
  }
  EntryHTML += ParamEntry.mText;
  if (VarLink.length > 0)
  {
    EntryHTML += "</a>";
  }

  EntryHTML += "</nobr>";
  EntryHTML += "</td>";
  EntryHTML += "</tr>";
  EntryHTML += "</table>";

  return EntryHTML;
}
// Copyright (c) 2000-2003 Quadralay Corporation.  All rights reserved.
//

function  WWHOutlineImagingSafe_Object()
{
  this.mIterator    = new WWHOutlineIterator_Object(true);
  this.mImageSrcDir = WWHOutlineImaging_ImageSrcDir();
  this.mEventString = WWHPopup_EventString();
  this.mHTMLSegment = new WWHStringBuffer_Object();

  this.fGetIconURL     = WWHOutlineImaging_GetIconURL;
  this.fGetPopupAction = WWHOutlineImaging_GetPopupAction;
  this.fGetLink        = WWHOutlineImaging_GetLink;
  this.fGetEntryHTML   = WWHOutlineImaging_GetEntryHTML;

  this.fGenerateStyles = WWHOutlineImagingSafe_GenerateStyles;
  this.fReset          = WWHOutlineImagingSafe_Reset;
  this.fAdvance        = WWHOutlineImagingSafe_Advance;
  this.fOpenLevel      = WWHOutlineImagingSafe_OpenLevel;
  this.fCloseLevel     = WWHOutlineImagingSafe_CloseLevel;
  this.fSameLevel      = WWHOutlineImagingSafe_SameLevel;
  this.fDisplayEntry   = WWHOutlineImagingSafe_DisplayEntry;
  this.fUpdateEntry    = WWHOutlineImagingSafe_UpdateEntry;
  this.fRevealEntry    = WWHOutlineImagingSafe_RevealEntry;
}

function  WWHOutlineImagingSafe_GenerateStyles()
{
  var  StyleBuffer = new WWHStringBuffer_Object();
  var  MaxLevel;
  var  Level;


  StyleBuffer.fAppend("<style type=\"text/css\">\n");
  StyleBuffer.fAppend(" <!--\n");
  StyleBuffer.fAppend("  a:active\n");
  StyleBuffer.fAppend("  {\n");
  StyleBuffer.fAppend("    text-decoration: none;\n");
  StyleBuffer.fAppend("    background-color: " + WWHFrame.WWHJavaScript.mSettings.mTOC.mHighlightColor + ";\n");
  StyleBuffer.fAppend("    " + WWHFrame.WWHJavaScript.mSettings.mTOC.mFontStyle + ";\n");
  StyleBuffer.fAppend("  }\n");
  StyleBuffer.fAppend("  a:hover\n");
  StyleBuffer.fAppend("  {\n");
  StyleBuffer.fAppend("    text-decoration: underline;\n");
  StyleBuffer.fAppend("    color: " + WWHFrame.WWHJavaScript.mSettings.mTOC.mEnabledColor + ";\n");
  StyleBuffer.fAppend("    " + WWHFrame.WWHJavaScript.mSettings.mTOC.mFontStyle + ";\n");
  StyleBuffer.fAppend("  }\n");
  StyleBuffer.fAppend("  a\n");
  StyleBuffer.fAppend("  {\n");
  StyleBuffer.fAppend("    text-decoration: none;\n");
  StyleBuffer.fAppend("    color: " + WWHFrame.WWHJavaScript.mSettings.mTOC.mEnabledColor + ";\n");
  StyleBuffer.fAppend("    " + WWHFrame.WWHJavaScript.mSettings.mTOC.mFontStyle + ";\n");
  StyleBuffer.fAppend("  }\n");
  StyleBuffer.fAppend("  td\n");
  StyleBuffer.fAppend("  {\n");
  StyleBuffer.fAppend("    margin-top: 0pt;\n");
  StyleBuffer.fAppend("    margin-bottom: 0pt;\n");
  StyleBuffer.fAppend("    margin-left: 0pt;\n");
  StyleBuffer.fAppend("    margin-right: 0pt;\n");
  StyleBuffer.fAppend("    text-align: left;\n");
  StyleBuffer.fAppend("    vertical-align: middle;\n");
  StyleBuffer.fAppend("    " + WWHFrame.WWHJavaScript.mSettings.mTOC.mFontStyle + ";\n");
  StyleBuffer.fAppend("  }\n");
  StyleBuffer.fAppend(" -->\n");
  StyleBuffer.fAppend("</style>\n");

  return StyleBuffer.fGetBuffer();
}

function  WWHOutlineImagingSafe_Reset()
{
  this.mIterator.fReset(WWHFrame.WWHOutline.mTopEntry);
}

function  WWHOutlineImagingSafe_Advance(ParamMaxHTMLSegmentSize)
{
  var  Entry;


  this.mHTMLSegment.fReset();
  while (((ParamMaxHTMLSegmentSize == -1) ||
          (this.mHTMLSegment.fSize() < ParamMaxHTMLSegmentSize)) &&
         (this.mIterator.fAdvance(this)))
  {
    Entry = this.mIterator.mEntry;

    // Process current entry
    //
    if (Entry.mbShow)
    {
      this.mHTMLSegment.fAppend(this.fDisplayEntry(Entry));
    }
  }

  return (this.mHTMLSegment.fSize() > 0);  // Return true if segment created
}

function  WWHOutlineImagingSafe_OpenLevel()
{
}

function  WWHOutlineImagingSafe_CloseLevel(bParamScopeComplete)
{
}

function  WWHOutlineImagingSafe_SameLevel()
{
}

function  WWHOutlineImagingSafe_DisplayEntry(ParamEntry)
{
  var  VarEntryHTML = "";


  VarEntryHTML += this.fGetEntryHTML(ParamEntry);
  VarEntryHTML += "\n";

  return VarEntryHTML;
}

function  WWHOutlineImagingSafe_UpdateEntry(ParamEntry)
{
  var  EntryURL;


  // Reload page to display expanded/collapsed entry
  //
  WWHFrame.WWHJavaScript.mPanels.fReloadView();
}

function  WWHOutlineImagingSafe_RevealEntry(ParamEntry,
                                            bParamVisible)
{
  var  ParentEntry;
  var  LastClosedParentEntry = null;


  // Expand out enclosing entries
  //
  ParentEntry = ParamEntry.mParent;
  while (ParentEntry != null)
  {
    if ( ! ParentEntry.mbExpanded)
    {
      ParentEntry.mbExpanded = true;
      LastClosedParentEntry = ParentEntry;
    }

    ParentEntry = ParentEntry.mParent;
  }

  // Set target entry
  //
  WWHFrame.WWHOutline.mPanelAnchor = "t" + ParamEntry.mID;

  // Update display
  //
  if (bParamVisible)
  {
    // Update display if entry not already visible
    //
    if (LastClosedParentEntry != null)
    {
      this.fUpdateEntry(ParamEntry);
    }
    else
    {
      // Display target
      //
      WWHFrame.WWHJavaScript.mPanels.fJumpToAnchor();
    }
  }
}
function Pairs_Object(ParamArray)
{
  // Store Original Array
  //
  this.mOriginalArray = ParamArray;

  // Hash of word pairs to test, keys are prefixed by '~'
  //
  this.mPairsHash = new Object();

  // Define Functions for this object
  //
  this.fGetPairs     = Pairs_GetPairs;
  this.fResetMatches = Pairs_ResetMatches;
  this.fTestPair     = Pairs_TestPair;
  this.fIsMatch      = Pairs_IsMatch;
  this.fCreateHash   = Pairs_CreateHash;
}

// Create the Hash of Word Pairs
//
function Pairs_CreateHash()
{
  var index = 0;
  var innerHash;
  var lastWord;
  var currentWord;
  var currentInnerHash;
  var innerHashValue

  for(index = 0; index < this.mOriginalArray.length; index++)
  {
    innerHash = new Object();
    if (index == 0)
    {
      lastWord = "~" + this.mOriginalArray[index];
    }
    else
    {
      currentWord = "~" + this.mOriginalArray[index];
      currentInnerHash = this.mPairsHash[lastWord];
      if(currentInnerHash != null)
      {
        innerHashValue = currentInnerHash[currentWord]
        if(innerHashValue == null)
        {
          currentInnerHash[currentWord] = 0;
        }
      }
      else
      {
        innerHash[currentWord] = 0;
        this.mPairsHash[lastWord] = innerHash;
      }

      lastWord = currentWord;
    }
  }
}

// Accessor function to return the hash
//
function Pairs_GetPairs()
{
  return this.mPairsHash;
}

// After each doc is tested for the occurrence
// of the pairs in the search phrase, the recorded
// matches in the hash can be reset for the next
// doc to test
//
function Pairs_ResetMatches()
{
  var outerKey;
  var innerKey;
  var innerHash;

  for(outerKey in this.mPairsHash)
  {
    innerHash = this.mPairsHash[outerKey];
    for(innerKey in innerHash)
    {
      innerHash[innerKey] = 0;
    }
  }
}

// The list of word pairs generated during output
// calls this function with each word pair in the doc
// if the word pair is present in the hash created
// from the search phrase, then that match is recorded.
//
function Pairs_TestPair(ParamFirst, ParamSecond)
{
  var innerHash;

  innerHash = this.mPairsHash["~" + ParamFirst];
  if(this.mPairsHash["~" + ParamFirst] != null &&
      this.mPairsHash["~" + ParamFirst]["~" + ParamSecond] != null)
  {
    this.mPairsHash["~" + ParamFirst]["~" + ParamSecond]++;
  }
}

// IsMatch iterates all keys of mPairsHash testing
// whether the inner hashes have values greater than 0
// If all inner hash values are greater than 0, then
// There is a match on the phrase in the doc.
//
function Pairs_IsMatch()
{
  var result = true;

  var outerKey;
  var innerKey;
  var matchValue;

  for(outerKey in this.mPairsHash)
  {
    for(innerKey in this.mPairsHash[outerKey])
    {
      matchValue = this.mPairsHash[outerKey][innerKey];

      if(matchValue <= 0)
      {
        result = false;
        break;
      }
    }

    if(!result)
    {
      break;
    }
  }

  return result;
}// Copyright (c) 2000-2003 Quadralay Corporation.  All rights reserved.
//

function  WWHPanelsEntry_Object(ParamPanelObject)
{
  this.mPanelObject      = ParamPanelObject;
  this.mScrollPosition   = new Array(0, 0);
}

function  WWHPanels_Object()
{
  this.mCurrentPanel = 0;
  this.mPanelEntries = new Array();
  this.mPopup        = new WWHPopup_Object("WWHFrame.WWHJavaScript.mPanels.mPopup",
                                           "REPLACE ME",
                                           WWHPanelHoverText_Translate, WWHPanelHoverText_Format,
                                           "WWHPanelPopupDIV", "WWHPanelPopupText", 1000, 12, 20,
                                           WWHFrame.WWHJavaScript.mSettings.mHoverText.mWidth);
  this.mbChangingPanels       = false;
  this.mbLoading              = false;
  this.mbReloadOnlyNavigation = false;

  this.fGetCurrentPanelEntry  = WWHPanels_GetCurrentPanelEntry;
  this.fGetCurrentPanelObject = WWHPanels_GetCurrentPanelObject;
  this.fInitHeadHTML          = WWHPanels_InitHeadHTML;
  this.fInitBodyHTML          = WWHPanels_InitBodyHTML;
  this.fInitLoaded            = WWHPanels_InitLoaded;
  this.fPopupHTML             = WWHPanels_PopupHTML;
  this.fClearScrollPosition   = WWHPanels_ClearScrollPosition;
  this.fSaveScrollPosition    = WWHPanels_SaveScrollPosition;
  this.fRestoreScrollPosition = WWHPanels_RestoreScrollPosition;
  this.fJumpToAnchor          = WWHPanels_JumpToAnchor;
  this.fChangePanel           = WWHPanels_ChangePanel;
  this.fReloadPanel           = WWHPanels_ReloadPanel;
  this.fReloadNavigation      = WWHPanels_ReloadNavigation;
  this.fReloadView            = WWHPanels_ReloadView;
  this.fPanelNavigationLoaded = WWHPanels_PanelNavigationLoaded;
  this.fPanelViewLoaded       = WWHPanels_PanelViewLoaded;

  // Add visible panels
  //
  if (WWHFrame.WWHJavaScript.mSettings.mTOC.mbShow)
  {
    WWHFrame.WWHOutline.mPanelTabIndex = this.mPanelEntries.length;
    this.mPanelEntries[this.mPanelEntries.length] = new WWHPanelsEntry_Object(WWHFrame.WWHOutline);
  }
  if (WWHFrame.WWHJavaScript.mSettings.mIndex.mbShow)
  {
    WWHFrame.WWHIndex.mPanelTabIndex = this.mPanelEntries.length;
    this.mPanelEntries[this.mPanelEntries.length] = new WWHPanelsEntry_Object(WWHFrame.WWHIndex);
  }
  if (WWHFrame.WWHJavaScript.mSettings.mSearch.mbShow)
  {
    WWHFrame.WWHSearch.mPanelTabIndex = this.mPanelEntries.length;
    this.mPanelEntries[this.mPanelEntries.length] = new WWHPanelsEntry_Object(WWHFrame.WWHSearch);
  }
  if ((WWHFrame.WWHHelp.fCookiesEnabled()) &&
      (WWHFrame.WWHJavaScript.mSettings.mFavorites.mbShow))
  {
    WWHFrame.WWHFavorites.mPanelTabIndex = this.mPanelEntries.length;
    this.mPanelEntries[this.mPanelEntries.length] = new WWHPanelsEntry_Object(WWHFrame.WWHFavorites);
  }
}

function  WWHPanels_GetCurrentPanelEntry()
{
  return this.mPanelEntries[this.mCurrentPanel];
}

function  WWHPanels_GetCurrentPanelObject()
{
  return this.mPanelEntries[this.mCurrentPanel].mPanelObject;
}

function  WWHPanels_InitHeadHTML()
{
  var  HTML = "";
  var  PanelEntry;


  if (WWHFrame.WWHHelp.mInitStage > 0)
  {
    // Access panel entry
    //
    PanelEntry = this.fGetCurrentPanelEntry();

    HTML = PanelEntry.mPanelObject.fInitHeadHTML();
  }

  return HTML;
}

function  WWHPanels_InitBodyHTML()
{
  var  HTML = "";
  var  PanelEntry;


  if (WWHFrame.WWHHelp.mInitStage > 0)
  {
    // Access panel entry
    //
    PanelEntry = this.fGetCurrentPanelEntry();

    HTML = PanelEntry.mPanelObject.fInitBodyHTML();
  }

  return HTML;
}

function  WWHPanels_InitLoaded()
{
  this.fClearScrollPosition();
  this.mbLoading = false;
  this.fReloadPanel();
}

function  WWHPanels_PopupHTML()
{
  var  VarHTML = "";


  if (WWHFrame.WWHBrowser.mbSupportsPopups)
  {
    VarHTML = this.mPopup.fDivTagText();
  }

  return VarHTML;
}

function  WWHPanels_ClearScrollPosition()
{
  var  PanelEntry;


  PanelEntry = this.fGetCurrentPanelEntry();

  PanelEntry.mScrollPosition[0] = 0;
  PanelEntry.mScrollPosition[1] = 0;
}

function  WWHPanels_SaveScrollPosition()
{
  var  PanelEntry;
  var  PanelObject;
  var  VarPanelViewFrame;


  if ( ! this.mbLoading)
  {
    // Access panel object
    //
    PanelEntry  = this.fGetCurrentPanelEntry();
    PanelObject = this.fGetCurrentPanelObject();
    if (PanelObject.mbPanelInitialized)
    {
      VarPanelViewFrame = eval(WWHFrame.WWHHelp.fGetFrameReference("WWHPanelViewFrame"));

      if ((WWHFrame.WWHBrowser.mBrowser == 1) ||  // Shorthand for Netscape
          (WWHFrame.WWHBrowser.mBrowser == 3) ||  // Shorthand for iCab
          (WWHFrame.WWHBrowser.mBrowser == 4) ||  // Shorthand for Netscape 6.0 (Mozilla)
          (WWHFrame.WWHBrowser.mBrowser == 5))    // Shorthand for Safari
      {
        PanelEntry.mScrollPosition[0] = VarPanelViewFrame.window.pageXOffset;
        PanelEntry.mScrollPosition[1] = VarPanelViewFrame.window.pageYOffset;
      }
      else if (WWHFrame.WWHBrowser.mBrowser == 2)  // Shorthand for IE
      {
        // Test required to avoid JavaScript error under IE5.5 on Windows
        //
        if (typeof(VarPanelViewFrame.document.body) == "undefined")
        {
          PanelEntry.mScrollPosition[0] = 0;
          PanelEntry.mScrollPosition[1] = 0;
        }
        else
        {
          if ((typeof(VarPanelViewFrame.document.documentElement) != "undefined") &&
              (typeof(VarPanelViewFrame.document.documentElement.scrollLeft) != "undefined") &&
              (typeof(VarPanelViewFrame.document.documentElement.scrollTop) != "undefined") &&
              ((VarPanelViewFrame.document.documentElement.scrollLeft != 0) ||
               (VarPanelViewFrame.document.documentElement.scrollTop != 0)))
          {
            PanelEntry.mScrollPosition[0] = VarPanelViewFrame.document.documentElement.scrollLeft;
            PanelEntry.mScrollPosition[1] = VarPanelViewFrame.document.documentElement.scrollTop;
          }
          else
          {
            PanelEntry.mScrollPosition[0] = VarPanelViewFrame.document.body.scrollLeft;
            PanelEntry.mScrollPosition[1] = VarPanelViewFrame.document.body.scrollTop;
          }
        }
      }
    }
  }
}

function  WWHPanels_RestoreScrollPosition()
{
  var  PanelEntry;
  var  ScrollPosition;


  if ( ! this.mbLoading)
  {
    // Access panel entry
    //
    PanelEntry = this.fGetCurrentPanelEntry();

    // See if a target position has been specified
    //
    if (PanelEntry.mPanelObject.mPanelAnchor != null)
    {
      this.fJumpToAnchor();
    }
    else
    {
      // Restore scroll position
      //
      ScrollPosition = PanelEntry.mScrollPosition;

      // setTimeout required for correct operation in Netscape 6.0
      //
      setTimeout(WWHFrame.WWHHelp.fGetFrameReference("WWHPanelViewFrame") + ".window.scrollTo(" + ScrollPosition[0] + ", " + ScrollPosition[1] + ");", 10);
    }
  }
}

function  WWHPanels_JumpToAnchor()
{
  var  PanelObject;
  var  bVarEnableNavigatorWorkaround;
  var  VarPanelViewFrame;


  if ( ! this.mbLoading)
  {
    // Access panel object
    //
    PanelObject = this.fGetCurrentPanelObject();
    if ((PanelObject.mbPanelInitialized) &&
        (PanelObject.mPanelAnchor != null))
    {
      if (WWHFrame.WWHBrowser.mbSupportsFocus)
      {
        // Use focus() method
        //
        WWHFrame.WWHHelp.fFocus("WWHPanelViewFrame", PanelObject.mPanelAnchor);

        PanelObject.mPanelAnchor = null;
      }
      else
      {
        // Navigator reloads the page if the hash isn't already defined
        //
        bVarEnableNavigatorWorkaround = false;
        VarPanelViewFrame = eval(WWHFrame.WWHHelp.fGetFrameReference("WWHPanelViewFrame"));
        if (WWHFrame.WWHBrowser.mBrowser == 1)  // Shorthand for Netscape
        {
          if (VarPanelViewFrame.location.hash.length == 0)
          {
            bVarEnableNavigatorWorkaround = true;
          }
        }

        // Jump to anchor
        //
        VarPanelViewFrame.location.hash = PanelObject.mPanelAnchor;

        // Navigator reloads the page if the hash isn't already defined
        //
        if ( ! bVarEnableNavigatorWorkaround)
        {
          PanelObject.mPanelAnchor = null;
        }
      }
    }
  }
}

function  WWHPanels_ChangePanel(ParamPanelIndex)
{
  if (( ! this.mbChangingPanels) &&
      ( ! this.mbLoading))
  {
    // Set flag
    //
    this.mbChangingPanels = true;

    // Save scroll position
    //
    this.fSaveScrollPosition();

    // Close down any popups we had going to prevent JavaScript errors
    //
    this.mPopup.fHide();

    // Set panel index
    //
    this.mCurrentPanel = ParamPanelIndex;

    // Update current panel
    //
    this.fReloadPanel();
  }
}

function  WWHPanels_ReloadPanel()
{
  var  PanelObject;
  var  HTMLFilename;


  if ( ! this.mbLoading)
  {
    // Set flag
    //
    this.mbLoading = true;

    // Access panel object
    //
    PanelObject = this.fGetCurrentPanelObject();

    // Determine file to load
    //
    if ( ! PanelObject.mbPanelInitialized)
    {
      HTMLFilename = "panelini.htm";
    }
    else
    {
      HTMLFilename = PanelObject.mPanelFilename;
    }

    // Redirect to the correct file
    //
    WWHFrame.WWHHelp.fReplaceLocation("WWHPanelFrame", WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/html/" + HTMLFilename);
  }
}

function  WWHPanels_ReloadNavigation()
{
  if ( ! this.mbLoading)
  {
    // Set flag
    //
    this.mbLoading = true;

    this.mbReloadOnlyNavigation = true;

    WWHFrame.WWHHelp.fReplaceLocation("WWHPanelNavigationFrame", WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/html/panelnav.htm");
  }
}

function  WWHPanels_ReloadView()
{
  var  ExtraAction;
  var  VarPanelViewFrame;


  if ( ! this.mbLoading)
  {
    // Save scroll position
    //
    this.fSaveScrollPosition();

    // Set flag
    //
    this.mbLoading = true;

    // Close down any popups we had going to prevent JavaScript errors
    //
    this.mPopup.fHide();

    // Handle browser specific issues
    //
    ExtraAction = "";
    if ((WWHFrame.WWHBrowser.mBrowser == 1) ||  // Shorthand for Netscape
        (WWHFrame.WWHBrowser.mBrowser == 4))    // Shorthand for Netscape 6.0 (Mozilla)
    {
      // Navigator has trouble if the hash is defined
      //
      VarPanelViewFrame = eval(WWHFrame.WWHHelp.fGetFrameReference("WWHPanelViewFrame"));
      if (VarPanelViewFrame.location.hash.length != 0)
      {
        ExtraAction = WWHFrame.WWHHelp.fGetFrameReference("WWHPanelViewFrame") + ".location.hash = \"\"; ";

        if (WWHFrame.WWHBrowser.mBrowser == 4)  // Shorthand for Netscape 6.0 (Mozilla)
        {
          ExtraAction += WWHFrame.WWHHelp.fGetFrameReference("WWHPanelViewFrame") + ".location.replace(\"" + WWHStringUtilities_EscapeURLForJavaScriptAnchor(WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/html/panelvie.htm") + "\"); "
        }
      }
    }

    setTimeout(ExtraAction + WWHFrame.WWHHelp.fGetFrameReference("WWHPanelViewFrame") + ".location.replace(\"" + WWHStringUtilities_EscapeURLForJavaScriptAnchor(WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/html/panelvie.htm") + "\");", 1);
  }
}

function  WWHPanels_PanelNavigationLoaded()
{
  var  PanelObject;


  // Access panel object
  //
  PanelObject = this.fGetCurrentPanelObject();

  // Set frame name for accessibility
  //
  if (WWHFrame.WWHHelp.mbAccessible)
  {
    WWHFrame.WWHHelp.fSetFrameName("WWHPanelNavigationFrame");
  }

  // Update flag
  //
  if (this.mbReloadOnlyNavigation)
  {
    this.mbLoading = false;
  }

  // Notify panel object navigation loaded
  //
  PanelObject.fPanelNavigationLoaded();

  // Load view panel
  //
  if (this.mbReloadOnlyNavigation)
  {
    this.mbReloadOnlyNavigation = false;
  }
  else
  {
    WWHFrame.WWHHelp.fReplaceLocation("WWHPanelViewFrame", WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/html/panelvie.htm");
  }
}

function  WWHPanels_PanelViewLoaded()
{
  var  PanelObject;


  // Set frame name for accessibility
  //
  if (WWHFrame.WWHHelp.mbAccessible)
  {
    WWHFrame.WWHHelp.fSetFrameName("WWHPanelViewFrame");
  }

  // Update flag
  //
  this.mbLoading = false;

  // Restore window position
  //
  this.fRestoreScrollPosition();

  // Update popup window reference
  //
  this.mPopup.mWindowRef = WWHFrame.WWHHelp.fGetFrameReference("WWHPanelViewFrame")

  // Access panel object
  //
  PanelObject = this.fGetCurrentPanelObject();

  // Notify panel object view loaded
  //
  PanelObject.fPanelViewLoaded();

  // Complete changing tabs
  //
  if (this.mbChangingPanels)
  {
    // Notify end of tab change
    //
    WWHFrame.WWHJavaScript.fEndChangeTab();

    this.mbChangingPanels = false;
  }
}

function  WWHPanelHoverText_Translate(ParamEntryID)
{
  var  Text = "";
  var  PanelObject;


  // Access panel object
  //
  PanelObject = WWHFrame.WWHJavaScript.mPanels.fGetCurrentPanelObject();
  if (PanelObject.mbPanelInitialized)
  {
    Text = PanelObject.fHoverTextTranslate(ParamEntryID);
  }

  return Text;
}

function  WWHPanelHoverText_Format(ParamWidth,
                                   ParamTextID,
                                   ParamText)
{
  var  HTML = "";
  var  PanelObject;


  // Access panel object
  //
  PanelObject = WWHFrame.WWHJavaScript.mPanels.fGetCurrentPanelObject();
  if (PanelObject.mbPanelInitialized)
  {
    HTML = PanelObject.fHoverTextFormat(ParamWidth, ParamTextID, ParamText);
  }

  return HTML;
}
function Phrase_Object(ParamPhrase)
{
  // Array of search words
  //
  this.mWords          = new Array();

  // Original Search Phrase
  //
  this.mPhrase         = ParamPhrase;

  // Pairs object containing the word pairs of the phrase
  //
  this.mPairs = null;

  this.fTestPhrase    = Phrase_TestPhrase;
  this.fIsMatch       = Phrase_IsMatch;
  this.fParse         = Phrase_Parse;
  this.fIsValidPhrase = Phrase_IsValidPhrase;

  // Accessors and other methods for testing
  //
  this.fGetWords      = Phrase_GetWords;
  this.fGetPairsHash  = Phrase_GetPairs;
  this.fResetMatches  = Phrase_ResetMatches;
}

// Tests the word pair passed in as parameter to check
// if it exists in the word pair hash
//
function Phrase_TestPhrase(ParamFirst, ParamSecond)
{
  this.mPairs.fTestPair(ParamFirst, ParamSecond);
}

// Calls the Pairs object's IsMatch function to see
// if all word pairs are present in the search text
//
function Phrase_IsMatch()
{
  return this.mPairs.fIsMatch();
}

// Parses out the words in the phrase adding them to the
// Pairs object if they are valid search words for the current book
//
function Phrase_Parse()
{
  var StringWithSpace = "x x";
  var phraseSplit;
  var index;
  var currentSplit;

  phraseSplit = this.mPhrase.split(StringWithSpace.substring(1, 2));

  for(index = 0; index < phraseSplit.length; ++index)
  {
    currentSplit = phraseSplit[index];
    if(currentSplit.length > 0)
    {
      this.mWords[this.mWords.length] = currentSplit;
    }
  }

  if(this.mWords.length > 0)
  {
    this.mPairs = new Pairs_Object(this.mWords);
    this.mPairs.fCreateHash();
  }
  else
  {
    this.mPairs = null;
  }
}

// Returns the word array that is the phrase
// minus the skip wors
//
function Phrase_GetWords()
{
  return this.mWords;
}

// Returns the stored hash of pairs from the pair object
//
function Phrase_GetPairs()
{
  return this.mPairs.fGetPairs();
}

// Resets the match count for the pairs object
//
function Phrase_ResetMatches()
{
  this.mPairs.fResetMatches();
}

// Tests to see if any word pairs exist for this phrase
// Returns true if there are any word pairs, meaning there
// is a valid phrase object
//
function Phrase_IsValidPhrase()
{
  return this.mPairs != null;
}// Copyright (c) 2000-2005 Quadralay Corporation.  All rights reserved.
//

function  WWHSearch_Object()
{
  this.mbPanelInitialized     = false;
  this.mPanelAnchor           = null;
  this.mPanelTabTitle         = WWHFrame.WWHJavaScript.mMessages.mTabsSearchLabel;
  this.mPanelTabIndex         = -1;
  this.mPanelFilename         = ((WWHFrame.WWHBrowser.mBrowser == 1) ? "panelfns.htm" : "panelfss.htm");
  this.mInitIndex             = 0;
  this.mBookSearchInfoList    = new Array();
  this.mMultiPhraseList       = new Array();
  this.mSearchState           = null;
  this.mSearchScopeInfo       = null;
  this.mSavedSearchWords      = "";
  this.mSavedSearchScope      = 0;
  this.mSearchWordList        = new Array();
  this.mSearchWordRegExpList  = new Array();
  this.mBookIndex             = 0;
  this.mBookMatchesList       = new Array();
  this.mCombinedResults       = new WWHSearchResults_Object();
  this.mCombinedResultsIndex  = 0;

  this.fInitialize             = WWHSearch_Initialize;
  this.fInitHeadHTML           = WWHSearch_InitHeadHTML;
  this.fInitBodyHTML           = WWHSearch_InitBodyHTML;
  this.fInitLoadBookSearchInfo = WWHSearch_InitLoadBookSearchInfo;
  this.fNavigationHeadHTML     = WWHSearch_NavigationHeadHTML;
  this.fNavigationBodyHTML     = WWHSearch_NavigationBodyHTML;
  this.fHeadHTML               = WWHSearch_HeadHTML;
  this.fStartHTMLSegments      = WWHSearch_StartHTMLSegments;
  this.fAdvanceHTMLSegment     = WWHSearch_AdvanceHTMLSegment;
  this.fGetHTMLSegment         = WWHSearch_GetHTMLSegment;
  this.fEndHTMLSegments        = WWHSearch_EndHTMLSegments;
  this.fPanelNavigationLoaded  = WWHSearch_PanelNavigationLoaded;
  this.fPanelViewLoaded        = WWHSearch_PanelViewLoaded;
  this.fHoverTextTranslate     = WWHSearch_HoverTextTranslate;
  this.fHoverTextFormat        = WWHSearch_HoverTextFormat;
  this.fDisplaySearchForm      = WWHSearch_DisplaySearchForm;
  this.fSubmit                 = WWHSearch_Submit;
  this.fApplyWordBreaks        = WWHSearch_ApplyWordBreaks;
  this.fSetSearchWords         = WWHSearch_SetSearchWords;
  this.fCheckForMatch          = WWHSearch_CheckForMatch;
  this.fSearchWordsComplete    = WWHSearch_SearchWordsComplete;
  this.fCheckForPhraseMatch    = WWHSearch_CheckForPhraseMatch;
  this.fSearchPairsComplete    = WWHSearch_SearchPairsComplete;
  this.fCombineResults         = WWHSearch_CombineResults;
  this.fShowEntry              = WWHSearch_ShowEntry;

  // Initialize
  //
  this.fInitialize();
}

function  WWHSearch_Initialize()
{
}

function  WWHSearch_InitHeadHTML()
{
  var  InitHeadHTML = "";


  // Create search scope info
  //
  this.mSearchScopeInfo = new WWHSearchScope_Object();

  return InitHeadHTML;
}

function  WWHSearch_InitBodyHTML()
{
  var  HTML = new WWHStringBuffer_Object();
  var  VarParameters;


  // Workaround Safari reload bug
  //
  VarParameters = "";
  if (WWHFrame.WWHBrowser.mBrowser == 5)  // Shorthhand for Safari
  {
    VarParameters = "?" + (new Date() * 1);
  }

  // Display initializing message
  //
  HTML.fAppend("<h2>" + WWHFrame.WWHJavaScript.mMessages.mInitializingMessage + "</h2>\n");

  // Load search info
  //
  this.mInitIndex = 0;
  HTML.fAppend("<script language=\"JavaScript1.2\" src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhbdata/js/search.js" + VarParameters + "\"></script>\n");

  return HTML.fGetBuffer();
}

function  WWHSearch_InitLoadBookSearchInfo(ParamSearchFileCount,
                                           ParamMinimumWordLength,
                                           ParamSearchSkipWordsFunc)
{
  // Load book search info
  //
  this.mBookSearchInfoList[this.mInitIndex] = new WWHBookSearchInfo_Object(ParamSearchFileCount, ParamMinimumWordLength);
  ParamSearchSkipWordsFunc(this.mBookSearchInfoList[this.mInitIndex]);

  // Create match objects for each book
  //
  this.mBookMatchesList[this.mBookMatchesList.length] = new WWHSearchBookMatches_Object();

  // Increment init book index
  //
  this.mInitIndex++;

  // Mark initialized if done
  //
  if (this.mInitIndex == WWHFrame.WWHHelp.mBooks.mBookList.length)
  {
    this.mbPanelInitialized = true;
  }
}

function  WWHSearch_NavigationHeadHTML()
{
  return "";
}

function  WWHSearch_NavigationBodyHTML()
{
  return this.fDisplaySearchForm();
}

function  WWHSearch_HeadHTML()
{
  var  HTML = new WWHStringBuffer_Object();
  var  Settings = WWHFrame.WWHJavaScript.mSettings.mSearch;


  // Generate style section
  //
  HTML.fAppend("<style type=\"text/css\">\n");
  HTML.fAppend(" <!--\n");
  HTML.fAppend("  a:active\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    text-decoration: none;\n");
  HTML.fAppend("    background-color: " + Settings.mHighlightColor + ";\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("  a:hover\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    text-decoration: underline;\n");
  HTML.fAppend("    color: " + Settings.mEnabledColor + ";\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("  a\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    text-decoration: none;\n");
  HTML.fAppend("    color: " + Settings.mEnabledColor + ";\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("  p\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    margin-top: 1pt;\n");
  HTML.fAppend("    margin-bottom: 1pt;\n");
  HTML.fAppend("    " + Settings.mFontStyle + ";\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("  p.BookTitle\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    margin-top: 1pt;\n");
  HTML.fAppend("    margin-bottom: 1pt;\n");
  HTML.fAppend("    font-weight: bold;\n");
  HTML.fAppend("    " + Settings.mFontStyle + ";\n");
  HTML.fAppend("  }\n");
  HTML.fAppend("  ol\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    margin-top: 1pt;\n");
  HTML.fAppend("    margin-bottom: 1pt;\n");
  if (Settings.mbShowRank)
  {
    HTML.fAppend("    " + Settings.mFontStyle + ";\n");
  }
  else
  {
    HTML.fAppend("    list-style: none;\n");
  }
  HTML.fAppend("  }\n");
  HTML.fAppend("  li\n");
  HTML.fAppend("  {\n");
  HTML.fAppend("    margin-top: 2pt;\n");
  HTML.fAppend("    margin-bottom: 0pt;\n");
  HTML.fAppend("    " + Settings.mFontStyle + ";\n");
  HTML.fAppend("  }\n");
  HTML.fAppend(" -->\n");
  HTML.fAppend("</style>\n");

  return HTML.fGetBuffer();
}

function  WWHSearch_StartHTMLSegments()
{
  var  HTML = new WWHStringBuffer_Object();
  var  VarParameters;
  var  MaxBookIndex;
  var  BookIndex;
  var  BookList;
  var  MaxIndex;
  var  Index;
  var  BookDirectory;
  var  bDisplayBookTitles;
  var  Entry;
  var  MultiPhraseEntry;


  if (this.mbPanelInitialized)
  {
    // Workaround Safari reload bug
    //
    VarParameters = "";
    if (WWHFrame.WWHBrowser.mBrowser == 5)  // Shorthhand for Safari
    {
      VarParameters = "?" + (new Date() * 1);
    }

    // Perform search if required
    //
    if (this.mSearchState == "words")
    {
      // Display searching message
      //
      HTML.fAppend("<h2>" + WWHFrame.WWHJavaScript.mMessages.mSearchSearchingMessage + "</h2>\n");

      // Handle single book search
      //
      BookList = WWHFrame.WWHHelp.mBooks.mBookList;
      if (this.mSavedSearchScope > 0)
      {
        BookIndex    = this.mSearchScopeInfo.mEntries[this.mSavedSearchScope - 1].mStartBookIndex;
        MaxBookIndex = this.mSearchScopeInfo.mEntries[this.mSavedSearchScope - 1].mEndBookIndex + 1;
      }
      else
      {
        BookIndex    = 0;
        MaxBookIndex = BookList.length;
      }

      // Generate search actions
      //
      this.mBookIndex = BookIndex;
      for ( ; BookIndex < MaxBookIndex ; BookIndex++)
      {
        BookDirectory = BookList[BookIndex].mDirectory;

        for (MaxIndex = this.mBookSearchInfoList[BookIndex].mSearchFileCount, Index = 0 ; Index < MaxIndex ; Index++)
        {
          HTML.fAppend("<script type=\"text/javascript\" language=\"JavaScript1.2\" src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + BookDirectory + "wwhdata/js/search/search" + Index + ".js" + VarParameters + "\"></script>\n");
          HTML.fAppend("<script type=\"text/javascript\" language=\"JavaScript1.2\" src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/scripts/search2s.js" + VarParameters + "\"></script>\n");
        }

        HTML.fAppend("<script type=\"text/javascript\" language=\"JavaScript1.2\" src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/scripts/search3s.js" + VarParameters + "\"></script>\n");
      }

      HTML.fAppend("<script type=\"text/javascript\" language=\"JavaScript1.2\" src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/scripts/search4s.js" + VarParameters + "\"></script>\n");
    }
    else if (this.mSearchState == "pairs")
    {
      // Display searching message
      //
      HTML.fAppend("<h2>" + WWHFrame.WWHJavaScript.mMessages.mSearchSearchingMessage + "</h2>\n");

      BookList = WWHFrame.WWHHelp.mBooks.mBookList;

      // Generate search actions
      //
      for (MaxIndex = this.mCombinedResults.mEntries.length, Index = 0 ; Index < MaxIndex ; Index++)
      {
        Entry = this.mCombinedResults.mEntries[Index];

        MultiPhraseEntry = this.mMultiPhraseList[Entry.mBookIndex];
        if (MultiPhraseEntry.fPhraseCount() > 0)
        {
          BookDirectory = BookList[Entry.mBookIndex].mDirectory;

          HTML.fAppend("<script type=\"text/javascript\" language=\"JavaScript1.2\" src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + BookDirectory + "wwhdata/js/search/pairs/pair" + Entry.mFileIndex + ".js" + VarParameters + "\"></script>\n");
          HTML.fAppend("<script type=\"text/javascript\" language=\"JavaScript1.2\" src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/scripts/search5s.js" + VarParameters + "\"></script>\n");
        }

        HTML.fAppend("<script type=\"text/javascript\" language=\"JavaScript1.2\" src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/scripts/search6s.js" + VarParameters + "\"></script>\n");
      }

      HTML.fAppend("<script type=\"text/javascript\" language=\"JavaScript1.2\" src=\"" + WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/scripts/search7s.js" + VarParameters + "\"></script>\n");
    }
    else
    {
      // Define accessor functions to reduce file size
      //
      HTML.fAppend("<script type=\"text/javascript\" language=\"JavaScript1.2\">\n");
      HTML.fAppend(" <!--\n");
      HTML.fAppend("  function  fC(ParamEntryID)\n");
      HTML.fAppend("  {\n");
      HTML.fAppend("    WWHFrame.WWHSearch.fShowEntry(ParamEntryID);\n");
      HTML.fAppend("  }\n");
      HTML.fAppend("\n");
      HTML.fAppend("  function  fS(ParamEntryID,\n");
      HTML.fAppend("               ParamEvent)\n");
      HTML.fAppend("  {\n");
      HTML.fAppend("    WWHFrame.WWHJavaScript.mPanels.mPopup.fShow(ParamEntryID, ParamEvent);\n");
      HTML.fAppend("  }\n");
      HTML.fAppend("\n");
      HTML.fAppend("  function  fH()\n");
      HTML.fAppend("  {\n");
      HTML.fAppend("    WWHFrame.WWHJavaScript.mPanels.mPopup.fHide();\n");
      HTML.fAppend("  }\n");
      HTML.fAppend(" // -->\n");
      HTML.fAppend("</script>\n");

      // Display search message and/or prepare results for display
      //
      if (this.mSavedSearchWords.length == 0)
      {
        HTML.fAppend("<h3>" + WWHFrame.WWHJavaScript.mMessages.mSearchDefaultMessage + "</h3>\n");
      }
      else if ((typeof(this.mCombinedResults.mEntries) != "undefined") &&
               (this.mCombinedResults.mEntries.length > 0))
      {
        // Determine if book name should be displayed about results
        //
        if ((WWHFrame.WWHHelp.mBooks.mBookList.length == 1) ||
            ((this.mSavedSearchScope > 0) &&
             (this.mSearchScopeInfo.mEntries[this.mSavedSearchScope - 1].mStartBookIndex == this.mSearchScopeInfo.mEntries[this.mSavedSearchScope - 1].mEndBookIndex)))
        {
          // Single book scope selected, do not display book titles
          //
          bDisplayBookTitles = false;
        }
        else
        {
          // More than one book in search scope, display book titles
          //
          bDisplayBookTitles = true;
        }

        this.mCombinedResults.fDisplayReset(bDisplayBookTitles);
      }
      else
      {
        HTML.fAppend("<h3>" + WWHFrame.WWHJavaScript.mMessages.mSearchNothingFoundMessage + "</h3>\n");
      }
    }
  }

  return HTML.fGetBuffer();
}

function  WWHSearch_AdvanceHTMLSegment()
{
  var  bSegmentCreated = false;


  if (this.mbPanelInitialized)
  {
    if (this.mSearchState == null)
    {
      bSegmentCreated = this.mCombinedResults.fDisplayAdvance();
    }
  }

  return bSegmentCreated;
}

function  WWHSearch_GetHTMLSegment()
{
  return this.mCombinedResults.mHTMLSegment.fGetBuffer();
}

function  WWHSearch_EndHTMLSegments()
{
  return "";
}

function  WWHSearch_PanelNavigationLoaded()
{
  // Set focus
  //
  WWHFrame.WWHHelp.fFocus("WWHPanelNavigationFrame");
}

function  WWHSearch_PanelViewLoaded()
{
  // Display search results if necessary
  //
  if (this.mSearchState == "words")
  {
    this.mSearchState = "pairs";

    WWHFrame.WWHJavaScript.mPanels.fReloadView();
  }
  else if (this.mSearchState == "pairs")
  {
    this.mSearchState = null;

    WWHFrame.WWHJavaScript.mPanels.fReloadView();
  }
}

function  WWHSearch_HoverTextTranslate(ParamEntryID)
{
  var  HTML     = "";
  var  BookList = WWHFrame.WWHHelp.mBooks.mBookList;
  var  Settings = WWHFrame.WWHJavaScript.mSettings.mSearch;
  var  Messages = WWHFrame.WWHJavaScript.mMessages;
  var  Entry;
  var  Rank = "";
  var  Title;
  var  Book = "";
  var  Format;


  // Retrieve specified entry
  //
  Entry = this.mCombinedResults.mEntries[ParamEntryID];

  // Get Rank
  //
  if (Settings.mbShowRank)
  {
    Rank = Math.floor((Entry.mScore / this.mCombinedResults.mMaxScore) * 100) + "%";
  }

  // Get Title
  //
  Title = Entry.mTitle;

  // Get Book
  //
  if ((BookList.length > 1) &&                 // More than one book exists
      (this.mCombinedResults.mSortedBy == 1))  // By Score
  {
    Book = BookList[Entry.mBookIndex].mTitle;
  }

  // Format for display
  //
  if ((Rank.length == 0) &&
      (Book.length == 0))
  {
    // Simple format, just the title
    //
    HTML = Title;
  }
  else
  {
    Format = " align=\"left\" valign=\"top\"><span style=\"" + WWHFrame.WWHJavaScript.mSettings.mHoverText.mFontStyle + "\">";

    // Complex format, requires a table
    //
    HTML += "<table width=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\">";
    if (Rank.length > 0)
    {
      HTML += "<tr>";
      HTML += "<th style=\"white-space: nowrap;\"" + Format + Messages.mSearchRankLabel + "</span></th>";
      HTML += "<td" + Format + Rank + "</span></td>";
      HTML += "</tr>";
    }
    HTML += "<tr>";
    HTML += "<th style=\"white-space: nowrap;\"" + Format + Messages.mSearchTitleLabel + "</span></th>";
    HTML += "<td" + Format + Title + "</span></td>";
    HTML += "</tr>";
    if (Book.length > 0)
    {
      HTML += "<tr>";
      HTML += "<th style=\"white-space: nowrap;\"" + Format + Messages.mSearchBookLabel + "</span></th>";
      HTML += "<td" + Format + Book + "</span></td>";
      HTML += "</tr>";
    }
    HTML += "</table>";

    // IE 5.0 on the Macintosh drops the last table for some reason
    //
    if (WWHFrame.WWHBrowser.mbMacIE50)
    {
      HTML += "<table><tr><td></td></tr></table>";
    }
  }

  return HTML;
}

function  WWHSearch_HoverTextFormat(ParamWidth,
                                    ParamTextID,
                                    ParamText)
{
  var  FormattedText   = "";
  var  ForegroundColor = WWHFrame.WWHJavaScript.mSettings.mHoverText.mForegroundColor;
  var  BackgroundColor = WWHFrame.WWHJavaScript.mSettings.mHoverText.mBackgroundColor;
  var  BorderColor     = WWHFrame.WWHJavaScript.mSettings.mHoverText.mBorderColor;
  var  ImageDir        = WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/common/images";
  var  ReqSpacer1w2h   = "<img src=\"" + ImageDir + "/spc1w2h.gif\" width=1 height=2 alt=\"\">";
  var  ReqSpacer2w1h   = "<img src=\"" + ImageDir + "/spc2w1h.gif\" width=2 height=1 alt=\"\">";
  var  ReqSpacer1w7h   = "<img src=\"" + ImageDir + "/spc1w7h.gif\" width=1 height=7 alt=\"\">";
  var  ReqSpacer5w1h   = "<img src=\"" + ImageDir + "/spc5w1h.gif\" width=5 height=1 alt=\"\">";
  var  Spacer1w2h      = ReqSpacer1w2h;
  var  Spacer2w1h      = ReqSpacer2w1h;
  var  Spacer1w7h      = ReqSpacer1w7h;
  var  Spacer5w1h      = ReqSpacer5w1h;
  var  StyleAtttribute;


  // Set style attribute to insure small image height
  //
  StyleAttribute = " style=\"font-size: 1px; line-height: 1px;\"";

  FormattedText += "<table width=\"" + ParamWidth + "\" border=0 cellspacing=0 cellpadding=0 bgcolor=\"" + BackgroundColor + "\">";
  FormattedText += " <tr>";
  FormattedText += "  <td" + StyleAttribute + " height=2 colspan=5 bgcolor=\"" + BorderColor + "\">" + Spacer1w2h + "</td>";
  FormattedText += " </tr>";

  FormattedText += " <tr>";
  FormattedText += "  <td" + StyleAttribute + " height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  FormattedText += "  <td" + StyleAttribute + " height=7 colspan=3>" + Spacer1w7h + "</td>";
  FormattedText += "  <td" + StyleAttribute + " height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  FormattedText += " </tr>";

  FormattedText += " <tr>";
  FormattedText += "  <td bgcolor=\"" + BorderColor + "\">" + ReqSpacer2w1h + "</td>";
  FormattedText += "  <td>" + ReqSpacer5w1h + "</td>";
  FormattedText += "  <td width=\"100%\" id=\"" + ParamTextID + "\" style=\"color: " + ForegroundColor + " ; " + WWHFrame.WWHJavaScript.mSettings.mHoverText.mFontStyle + "\">" + ParamText + "</td>";
  FormattedText += "  <td>" + ReqSpacer5w1h + "</td>";
  FormattedText += "  <td bgcolor=\"" + BorderColor + "\">" + ReqSpacer2w1h + "</td>";
  FormattedText += " </tr>";

  FormattedText += " <tr>";
  FormattedText += "  <td" + StyleAttribute + " height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  FormattedText += "  <td" + StyleAttribute + " height=7 colspan=3>" + Spacer1w7h + "</td>";
  FormattedText += "  <td" + StyleAttribute + " height=7 bgcolor=\"" + BorderColor + "\">" + Spacer2w1h + "</td>";
  FormattedText += " </tr>";

  FormattedText += " <tr>";
  FormattedText += "  <td" + StyleAttribute + " height=2 colspan=5 bgcolor=\"" + BorderColor + "\">" + Spacer1w2h + "</td>";
  FormattedText += " </tr>";
  FormattedText += "</table>";

  return FormattedText;
}

function  WWHSearch_DisplaySearchForm()
{
  var  HTML = "";
  var  BookList = WWHFrame.WWHHelp.mBooks.mBookList;
  var  SelectedIndex;
  var  MaxIndex;
  var  Index;
  var  SearchScopeEntry;
  var  MaxLevel;
  var  Level;


  HTML += "<form name=\"WWHSearchForm\" onsubmit=\"WWHFrame.WWHSearch.fSubmit();\">\n";
  HTML += "<nobr>\n";
  HTML += "<input type=\"text\" name=\"WWHSearchWordsText\" size=\"20\" value=\"" + WWHStringUtilities_EscapeHTML(this.mSavedSearchWords) + "\" onkeydown=\"WWHFrame.WWHHelp.fIgnoreNextKeyPress((document.all||document.getElementById||document.layers)?event:null);\">\n";
  HTML += "<input type=\"submit\" value=\"" + WWHFrame.WWHJavaScript.mMessages.mSearchButtonLabel + "\">\n";
  HTML += "</nobr>\n";

  if (BookList.length > 1)
  {
    SelectedIndex = this.mSavedSearchScope - 1;

    HTML += "<br>\n";
    HTML += "<select name=\"WWHSearchScope\">\n";
    HTML += "<option>" + WWHFrame.WWHJavaScript.mMessages.mSearchScopeAllLabel + "</option>\n";
    for (MaxIndex = this.mSearchScopeInfo.mEntries.length, Index = 0 ; Index < MaxIndex ; Index++)
    {
      // Access current search scope entry
      //
      SearchScopeEntry = this.mSearchScopeInfo.mEntries[Index];

      // Restore selection
      //
      if (Index == SelectedIndex)
      {
        HTML += "<option selected>";
      }
      else
      {
        HTML += "<option>";
      }

      // Indent to show different levels
      //
      for (MaxLevel = SearchScopeEntry.mLevel, Level = 0 ; Level < MaxLevel ; Level++)
      {
        HTML += "- ";
      }

      // Close out entry
      //
      HTML += SearchScopeEntry.mTitle + "</option>\n";
    }
    HTML += "</select>\n";
  }

  HTML += "</form>\n";

  return HTML;
}

function  WWHSearch_Submit()
{
  var  VarPanelNavigationFrame;
  var  SearchForm;
  var  NewSearchWords;
  var  NewSearchScope;
  var  MaxIndex;
  var  Index;


  if ((WWHFrame.WWHHandler.fIsReady()) &&
      (this.mSearchState == null))
  {
    VarPanelNavigationFrame = eval(WWHFrame.WWHHelp.fGetFrameReference("WWHPanelNavigationFrame"));
    SearchForm = VarPanelNavigationFrame.document.forms["WWHSearchForm"];

    // Update search words
    //
    NewSearchWords = SearchForm.elements["WWHSearchWordsText"].value;
    if (NewSearchWords != this.mSavedSearchWords)
    {
      this.mSavedSearchWords = NewSearchWords;

      this.mSearchState = "words";
    }

    // Update search scope
    //
    if (WWHFrame.WWHHelp.mBooks.mBookList.length > 1)
    {
      NewSearchScope = SearchForm.elements["WWHSearchScope"].selectedIndex;
      if (NewSearchScope != this.mSavedSearchScope)
      {
        this.mSavedSearchScope = NewSearchScope;

        this.mSearchState = "words";
      }
    }

    // Perform search if something changed
    //
    if (this.mSearchState == "words")
    {
      if (this.mSavedSearchWords.length > 0)
      {
        // Clear previous results
        //
        for (MaxIndex = this.mBookMatchesList.length, Index = 0 ; Index < MaxIndex ; Index++)
        {
          this.mBookMatchesList[Index].fClear();
        }
        this.mCombinedResults.fClear();

        // Perform search
        //
        this.fSetSearchWords(this.mSavedSearchWords);
        WWHFrame.WWHJavaScript.mPanels.fClearScrollPosition();

        // Submit will cause navigation area to reload which will trigger the view pane
        // to reload and perform the search.
        //
      }
    }
  }

  return (this.mSearchState == "words");
}

function  WWHSearch_ApplyWordBreaks(ParamSearchWordsString)
{
  var  VarResult = "";
  var  VarMaxIndex;
  var  VarIndex;
  var  VarBreak;

  // Apply Unicode rules for word breaking
  // These rules taken from http://www.unicode.org/unicode/reports/tr29/
  //
  for (VarMaxIndex = ParamSearchWordsString.length, VarIndex = 0; VarIndex < VarMaxIndex ; VarIndex++)
  {
    // Break?
    //
    VarBreak = WWHUnicode_CheckBreakAtIndex(ParamSearchWordsString, VarIndex);
    if (VarBreak)
    {
      VarResult += " " + ParamSearchWordsString.charAt(VarIndex) + " ";
    }
    else
    {
      VarResult += ParamSearchWordsString.charAt(VarIndex);
    }
  }
  
  return VarResult;
}

function  WWHSearch_SetSearchWords(ParamSearchWordsString)
{
  var  SearchWordAndPhraseList;
  var  SearchWordAndPhraseEntry;
  var  SearchWordList;
  var  MaxIndex;
  var  Index;
  var  MaxWordIndex;
  var  WordIndex;
  var  SearchWord;
  var  SearchRegExpPattern;


  // Clear search words
  //
  this.mSearchWordList.length = 0;
  this.mSearchWordRegExpList.length = 0;

  // Add search words to hash
  //
  SearchWordAndPhraseList = WWHStringUtilities_ParseWordsAndPhrases(ParamSearchWordsString);
  for (MaxIndex = SearchWordAndPhraseList.length, Index = 0 ; Index < MaxIndex ; Index++)
  {
    SearchWordAndPhraseEntry = this.fApplyWordBreaks(SearchWordAndPhraseList[Index]);
    SearchWordList = WWHStringUtilities_ParseWordsAndPhrases(SearchWordAndPhraseEntry);
    for (MaxWordIndex = SearchWordList.length, WordIndex = 0 ; WordIndex < MaxWordIndex ; WordIndex++)
    {
      SearchWord = SearchWordList[WordIndex];

      // Skip 0 length words
      //
      if (SearchWord.length > 0)
      {
        // Add to search words hash
        //
        SearchRegExpPattern = WWHStringUtilities_WordToRegExpPattern(SearchWord);

        this.mSearchWordList[this.mSearchWordList.length] = SearchWord;
        this.mSearchWordRegExpList[this.mSearchWordRegExpList.length] = new RegExp(SearchRegExpPattern, "i");
      }
    }
  }

  // Create a items in mMultiPhraseList array that parallel the mBookSearchInfoList array
  // each MultiPhrase item is passed the corresponding index from mBookSearchInfoList and
  // the search words
  //
  var BookSearchIndex;
  var NewMultiPhrase;
  var CurrentBookSearch;
  this.mMultiPhraseList.length = 0;
  for(BookSearchIndex = 0; BookSearchIndex < this.mBookSearchInfoList.length; ++BookSearchIndex)
  {
    CurrentBookSearch = this.mBookSearchInfoList[BookSearchIndex];
    NewMultiPhrase = new MultiPhrase_Object(ParamSearchWordsString.toLowerCase(), CurrentBookSearch);
    NewMultiPhrase.fParse();
    this.mMultiPhraseList[this.mMultiPhraseList.length] = NewMultiPhrase;
  }
}

function  WWHSearch_CheckForMatch(ParamSearchFunc)
{
  var  Count;
  var  MaxIndex;
  var  Index;
  var  BookMatchesListEntry;
  var  SearchPattern;


  Count = 0;
  for (MaxIndex = this.mSearchWordList.length, Index = 0 ; Index < MaxIndex ; Index++)
  {
    if (this.mBookSearchInfoList[this.mBookIndex].fValidSearchWord(this.mSearchWordList[Index]))
    {
      BookMatchesListEntry = this.mBookMatchesList[this.mBookIndex];

      BookMatchesListEntry.fSetMatchedWordIndex(Count);

      SearchPattern = this.mSearchWordRegExpList[Index];
      SearchPattern.t = SearchPattern.test;

      ParamSearchFunc(SearchPattern, BookMatchesListEntry);

      Count++;
    }
  }
}

function  WWHSearch_SearchWordsComplete()
{
  // Combine results for display
  //
  this.fCombineResults();
  this.mCombinedResultsIndex = 0;
}

function  WWHSearch_CheckForPhraseMatch(ParamSearchFunc)
{
  var  Entry;
  var  BookIndex;
  var  FileIndex;
  var  MultiPhraseEntry;

  Entry            = this.mCombinedResults.mEntries[this.mCombinedResultsIndex];
  BookIndex        = Entry.mBookIndex;
  FileIndex        = Entry.mFileIndex;
  MultiPhraseEntry = this.mMultiPhraseList[BookIndex];

  // Reset the incremented values of the matching word pairs
  // for this multiphrase object for a new round of testing
  //
  MultiPhraseEntry.fResetMatches();

  // Perform Test
  //
  ParamSearchFunc(MultiPhraseEntry);

  // Match?
  //
  if (MultiPhraseEntry.fCheckForMatch())
  {
    // Match - Do Nothing
    //
  }
  else
  {
    // Remove from results
    //
    this.mCombinedResults.mEntries[this.mCombinedResultsIndex] = null;
  }
}

function  WWHSearch_SearchPairsComplete()
{
  var  Entries = new Array();
  var  MaxIndex;
  var  Index;

  // Remove failed matches
  //
  for (MaxIndex = this.mCombinedResults.mEntries.length, Index = 0 ; Index < MaxIndex ; Index++)
  {
    if (this.mCombinedResults.mEntries[Index] != null)
    {
      Entries[Entries.length] = this.mCombinedResults.mEntries[Index];
    }
  }
  this.mCombinedResults.mEntries = Entries;

  // Sort results based on single or multi-book display
  //
  if ((WWHFrame.WWHJavaScript.mSettings.mSearch.mbResultsByBook) ||
      ((WWHFrame.WWHHelp.mBooks.mBookList.length == 1) ||
       ((this.mSavedSearchScope > 0) &&
        (this.mSearchScopeInfo.mEntries[this.mSavedSearchScope - 1].mStartBookIndex == this.mSearchScopeInfo.mEntries[this.mSavedSearchScope - 1].mEndBookIndex))))
  {
    this.mCombinedResults.fSortByBookIndex();
  }
  else
  {
    this.mCombinedResults.fSortByScore();
  }
}

function  WWHSearch_CombineResults()
{
  var  MaxBookIndex;
  var  BookIndex;
  var  BookMatches;
  var  BookListEntry;
  var  FileID;
  var  FileIndex;


  this.mCombinedResults.fClear();
  for (MaxBookIndex = this.mBookMatchesList.length, BookIndex = 0 ; BookIndex < MaxBookIndex ; BookIndex++)
  {
    BookMatches = this.mBookMatchesList[BookIndex];
    BookListEntry = WWHFrame.WWHHelp.mBooks.mBookList[BookIndex];

    // Add results
    //
    BookMatches.fJoinFileScores();
    for (FileID in BookMatches.mFileScores)
    {
      FileIndex = parseInt(FileID.substring(1, FileID.length));

      this.mCombinedResults.fAddEntry(BookIndex, FileIndex, BookMatches.mFileScores[FileID], BookListEntry.mFiles.fFileIndexToTitle(FileIndex));
    }
  }
}

function  WWHSearch_ShowEntry(ParamIndex)
{
  this.mCombinedResults.fShowEntry(ParamIndex);
}

function  WWHSearchScope_Entry_Object(ParamLevel,
                                      ParamTitle,
                                      ParamBookIndex)
{
  this.mLevel          = ParamLevel;
  this.mTitle          = ParamTitle;
  this.mStartBookIndex = ParamBookIndex;
  this.mEndBookIndex   = ParamBookIndex;
}

function  WWHSearchScope_Object()
{
  this.mEntries = new Array();
  this.mGroupStack = new Array();
  this.mBookIndex = 0;

  this.fAddScopeEntries = WWHSearchScope_AddScopeEntries;

  // Set scope entries
  //
  this.fAddScopeEntries(WWHFrame.WWHHelp.mBookGroups);
}

function  WWHSearchScope_AddScopeEntries(ParamGroup)
{
  var  MaxIndex;
  var  Index;
  var  MaxGroupStackIndex;
  var  GroupStackIndex;
  var  ScopeEntry;


  for (MaxIndex = ParamGroup.mChildren.length, Index = 0 ; Index < MaxIndex ; Index++)
  {
    if (ParamGroup.mChildren[Index].mbGrouping)
    {
      // Add an entry
      //
      ScopeEntry = new WWHSearchScope_Entry_Object(this.mGroupStack.length, ParamGroup.mChildren[Index].mTitle, -1);
      this.mEntries[this.mEntries.length] = ScopeEntry;

      // Push this entry onto the group stack
      //
      this.mGroupStack[this.mGroupStack.length] = ScopeEntry;

      // Process group entries
      //
      this.fAddScopeEntries(ParamGroup.mChildren[Index]);

      // Pop this entry off the group stack
      //
      this.mGroupStack.length -= 1;
    }
    else
    {
      // Add an entry
      //
      this.mEntries[this.mEntries.length] = new WWHSearchScope_Entry_Object(this.mGroupStack.length, WWHFrame.WWHHelp.mBooks.mBookList[this.mBookIndex].mTitle, this.mBookIndex);

      // Process all entries in the group stack, updating start/end book indicies
      //
      for (MaxGroupStackIndex = this.mGroupStack.length, GroupStackIndex = 0 ; GroupStackIndex < MaxGroupStackIndex ; GroupStackIndex++)
      {
        ScopeEntry = this.mGroupStack[GroupStackIndex];

        // Update start
        //
        if (ScopeEntry.mStartBookIndex == -1)
        {
          ScopeEntry.mStartBookIndex = this.mBookIndex;
        }

        // Update end
        //
        ScopeEntry.mEndBookIndex = this.mBookIndex;
      }

      // Increment book index
      //
      this.mBookIndex += 1;
    }
  }
}

function  WWHBookSearchInfo_Object(ParamSearchFileCount,
                                   ParamMinimumWordLength)
{
  this.mSearchFileCount   = ParamSearchFileCount;
  this.mMinimumWordLength = ParamMinimumWordLength;
  this.mSkipWords         = new WWHBookSearchInfo_SkipWords_Object();

  this.fAddSkipWord     = WWHBookSearchInfo_AddSkipWord;
  this.fA               = WWHBookSearchInfo_AddSkipWord;
  this.fValidSearchWord = WWHBookSearchInfo_ValidSearchWord;
}

function  WWHBookSearchInfo_AddSkipWord(ParamSkipWord)
{
  if (ParamSkipWord.length > 0)
  {
    this.mSkipWords[ParamSkipWord + "~"] = 1;
  }
}

function  WWHBookSearchInfo_ValidSearchWord(ParamSearchWord)
{
  var  bValid = true;


  if ((ParamSearchWord.length < this.mMinimumWordLength) ||
      (typeof(this.mSkipWords[ParamSearchWord + "~"]) == "number"))
  {
    bValid = false;
  }

  return bValid;
}

function  WWHBookSearchInfo_SkipWords_Object()
{
}

function  WWHSearchBookMatches_Object()
{
  this.mFirstMatchedWordIndex = -1;
  this.mMatchedWordIndex      = -1;
  this.mWordFileScores        = new Array();
  this.mFileScores            = new WWHSearchBookMatches_FileScores_Object();

  this.fClear               = WWHSearchBookMatches_Clear;
  this.fSetMatchedWordIndex = WWHSearchBookMatches_SetMatchedWordIndex;
  this.fAddMatches          = WWHSearchBookMatches_AddMatches;
  this.f                    = WWHSearchBookMatches_AddMatches;  // For smaller search files
  this.fJoinFileScores      = WWHSearchBookMatches_JoinFileScores;
}

function  WWHSearchBookMatches_Clear()
{
  this.mFirstMatchedWordIndex = -1;
  this.mMatchedWordIndex      = -1;
  this.mWordFileScores.length = 0;
  this.mFileScores            = new WWHSearchBookMatches_FileScores_Object();
}

function  WWHSearchBookMatches_SetMatchedWordIndex(ParamMatchedWordIndex)
{
  this.mMatchedWordIndex = ParamMatchedWordIndex;
  if (ParamMatchedWordIndex == this.mWordFileScores.length)
  {
    this.mWordFileScores[this.mWordFileScores.length] = new WWHSearchBookMatches_FileScores_Object();
  }
}

function  WWHSearchBookMatches_AddMatches(ParamMatchString)
{
  var  MatchList = null;
  var  WordFileScoresEntry;
  var  MaxIndex;
  var  Index;
  var  FileID;
  var  Score;


  if (typeof(ParamMatchString) != "undefined")
  {
    MatchList = ParamMatchString.split(",");
  }

  if ((MatchList != null) &&
      (MatchList.length > 0))
  {
    WordFileScoresEntry = this.mWordFileScores[this.mMatchedWordIndex];

    // Add all entries to word file score entry
    //
    for (MaxIndex = MatchList.length, Index = 0 ; Index < MaxIndex ; Index += 2)
    {
      FileID = "i" + MatchList[Index];
      Score  = MatchList[Index + 1];

      WordFileScoresEntry[FileID] = parseInt(Score);
    }
  }
}

function  WWHSearchBookMatches_JoinFileScores()
{
  var  MaxIndex;
  var  Index;
  var  WordFileScoresEntry;


  this.mFileScores = new WWHSearchBookMatches_FileScores_Object();
  for (MaxIndex = this.mWordFileScores.length, Index = 0 ; Index < MaxIndex ; Index++)
  {
    WordFileScoresEntry = this.mWordFileScores[Index];

    if (Index == 0)
    {
      // Add all entries if first entry
      //
      this.mFileScores = WordFileScoresEntry;
    }
    else
    {
      // Remove all entries not found in results set
      //
      for (FileID in this.mFileScores)
      {
        if (typeof(WordFileScoresEntry[FileID]) == "number")
        {
          this.mFileScores[FileID] += WordFileScoresEntry[FileID];
        }
        else
        {
          delete this.mFileScores[FileID];
        }
      }
    }
  }
}

function  WWHSearchBookMatches_FileScores_Object()
{
}

function  WWHSearchResults_Object()
{
  this.mSortedBy     = null;
  this.mEntries      = new Array();
  this.mMaxScore     = 0;
  this.mDisplayIndex = 0;
  this.mByBookDetect = -1;
  this.mHTMLSegment  = new WWHStringBuffer_Object();
  this.mEventString  = WWHPopup_EventString();

  this.fClear           = WWHSearchResults_Clear;
  this.fAddEntry        = WWHSearchResults_AddEntry;
  this.fSortByScore     = WWHSearchResults_SortByScore;
  this.fSortByBookIndex = WWHSearchResults_SortByBookIndex;
  this.fDisplayReset    = WWHSearchResults_DisplayReset;
  this.fDisplayAdvance  = WWHSearchResults_DisplayAdvance;
  this.fGetPopupAction  = WWHSearchResults_GetPopupAction;
  this.fShowEntry       = WWHSearchResults_ShowEntry;
}

function  WWHSearchResults_Clear()
{
  this.mSortedBy       = null;
  this.mEntries.length = 0;
  this.mMaxScore       = 0;
}

function  WWHSearchResults_AddEntry(ParamBookIndex,
                                    ParamFileIndex,
                                    ParamScore,
                                    ParamTitle)
{
  // Add a new entry
  //
  this.mEntries[this.mEntries.length] = new WWHSearchResultsEntry_Object(ParamBookIndex,
                                                                         ParamFileIndex,
                                                                         ParamScore,
                                                                         ParamTitle);

  // Bump mMaxScore if necessary
  //
  if (ParamScore > this.mMaxScore)
  {
    this.mMaxScore = ParamScore;
  }
}

function  WWHSearchResults_SortByScore()
{
  this.mSortedBy = 1;  // By Score

  if (this.mEntries.length > 0)
  {
    this.mEntries = this.mEntries.sort(WWHSearchResultsEntry_ByScoreByBookIndexByTitleFileIndexURL);
  }
}

function  WWHSearchResults_SortByBookIndex()
{
  this.mSortedBy = 2;  // By BookIndex

  if (this.mEntries.length > 0)
  {
    this.mEntries = this.mEntries.sort(WWHSearchResultsEntry_ByBookIndexByScoreByTitleFileIndexURL);
  }
}

function  WWHSearchResults_DisplayReset(bParamDisplayBookTitles)
{
  this.mDisplayIndex = 0;
  this.mByBookDetect = -1;

  if ( ! bParamDisplayBookTitles)
  {
    this.mByBookDetect = -2;
  }
}

function  WWHSearchResults_DisplayAdvance()
{
  var  bSegmentCreated = false;
  var  Settings = WWHFrame.WWHJavaScript.mSettings.mSearch;
  var  HTML;
  var  MaxHTMLSegmentSize;
  var  BookList;
  var  MaxIndex;
  var  Index;
  var  Entry;
  var  VarAccessibilityTitle = "";
  var  VarPercent;


  // Insure that there is something to display
  //
  if ((this.mSortedBy != null) &&
      (this.mEntries.length > 0))
  {
    MaxHTMLSegmentSize = WWHFrame.WWHJavaScript.mMaxHTMLSegmentSize;
    this.mHTMLSegment.fReset();
    BookList = WWHFrame.WWHHelp.mBooks.mBookList;

    // If this is the first entry, display the headers and open the list
    //
    if (this.mDisplayIndex == 0)
    {
      HTML = "";

      HTML += "<p><nobr><b>";

      // Display column headers
      //
      if (Settings.mbShowRank)
      {
        HTML += WWHFrame.WWHJavaScript.mMessages.mSearchRankLabel + " ";
      }
      HTML += WWHFrame.WWHJavaScript.mMessages.mSearchTitleLabel;
      if ((BookList.length > 1) &&  // More than one book exists
          (this.mSortedBy == 1))    // By Score
      {
        HTML += ", " + WWHFrame.WWHJavaScript.mMessages.mSearchBookLabel;
      }
      HTML += "</b></nobr></p>\n";

      HTML += "<ol>\n";

      this.mHTMLSegment.fAppend(HTML);
    }

    // Display result entries
    //
    MaxIndex = this.mEntries.length;
    Index = this.mDisplayIndex;
    while ((this.mHTMLSegment.fSize() < MaxHTMLSegmentSize) &&
           (Index < MaxIndex))
    {
      HTML = "";

      Entry = this.mEntries[Index];

      // Display Book
      //
      if ((BookList.length > 1) &&  // More than one book exists
          (this.mSortedBy == 2))    // By BookIndex
      {
        if (this.mByBookDetect == -2)
        {
          // Do not display book titles
          //
        }
        else if (this.mByBookDetect != Entry.mBookIndex)
        {
          // Close list for previous book
          //
          if (Index > 0)
          {
            HTML += "</ol>\n";
          }

          HTML += "<p><nobr>&nbsp;</nobr></p>";
          HTML += "<p class=\"BookTitle\"><nobr>" + BookList[Entry.mBookIndex].mTitle + "</nobr></p>";

          this.mByBookDetect = Entry.mBookIndex;

          // Open new list for next book
          //
          HTML += "<ol>\n";
        }
      }

      // Accessibility support
      //
      if (WWHFrame.WWHHelp.mbAccessible)
      {
        VarAccessibilityTitle = "";

        // Rank
        //
        if (Settings.mbShowRank)
        {
          VarPercent = Math.floor((Entry.mScore / this.mMaxScore) * 100);

          // Some browsers do not allow value attributes to be 0
          //
          if (VarPercent < 1)
          {
            VarPercent = 1;
          }

          VarAccessibilityTitle += WWHStringUtilities_EscapeHTML(WWHFrame.WWHJavaScript.mMessages.mSearchRankLabel + " " + VarPercent + ", ");
        }

        // Title
        //
        VarAccessibilityTitle += WWHStringUtilities_EscapeHTML(WWHFrame.WWHJavaScript.mMessages.mSearchTitleLabel + " " + Entry.mTitle);

        // Book
        //
        if (BookList.length > 1)  // More than one book exists
        {
          VarAccessibilityTitle += WWHStringUtilities_EscapeHTML(WWHFrame.WWHHelp.mMessages.mAccessibilityListSeparator + " " + WWHFrame.WWHJavaScript.mMessages.mSearchBookLabel + " " + BookList[Entry.mBookIndex].mTitle);
        }

        VarAccessibilityTitle = " title=\"" + VarAccessibilityTitle + "\"";
      }

      // Display Rank
      //
      if (Settings.mbShowRank)
      {
        VarPercent = Math.floor((Entry.mScore / this.mMaxScore) * 100);

        // Some browsers do not allow value attributes to be 0
        //
        if (VarPercent < 1)
        {
          VarPercent = 1;
        }

        HTML += "<li value=\"" + VarPercent + "\">";
      }
      else
      {
        HTML += "<li>";
      }

      // Display Title
      //
      HTML += "<a href=\"javascript:fC(" + Index + ");\"" + this.fGetPopupAction(Index) + VarAccessibilityTitle + ">";
      HTML += Entry.mTitle;
      HTML += "</a>";

      // Display Book
      //
      if ((BookList.length > 1) &&  // More than one book exists
          (this.mSortedBy == 1))    // By Score
      {
        HTML += ", " + BookList[Entry.mBookIndex].mTitle;
      }

      HTML += "</li>\n";

      this.mHTMLSegment.fAppend(HTML);

      Index++;
    }

    // Record current display index so we can pick up where we left off
    //
    this.mDisplayIndex = Index;
    if (this.mHTMLSegment.fSize() > 0)
    {
      bSegmentCreated = true;
    }

    // If this is the last entry, close the list
    //
    if (this.mDisplayIndex == this.mEntries.length)
    {
      this.mHTMLSegment.fAppend("</ol>\n");
    }
  }

  return bSegmentCreated;
}

function  WWHSearchResults_GetPopupAction(ParamEntryIndex)
{
  var  PopupAction = "";


  if (WWHFrame.WWHJavaScript.mSettings.mHoverText.mbEnabled)
  {
    PopupAction += " onmouseover=\"fS('" + ParamEntryIndex + "', " + this.mEventString + ");\"";
    PopupAction += " onmouseout=\"fH();\"";
  }

  return PopupAction;
}

function  WWHSearchResults_ShowEntry(ParamIndex)
{
  var  Entry;
  var  URL;


  // Update highlight words
  //
  WWHFrame.WWHHighlightWords.fSetWordList(WWHStringUtilities_ParseWordsAndPhrases(WWHFrame.WWHSearch.mSavedSearchWords));

  // Display document
  //
  Entry = this.mEntries[ParamIndex];
  URL = WWHFrame.WWHHelp.fGetBookIndexFileIndexURL(Entry.mBookIndex, Entry.mFileIndex, null);
  WWHFrame.WWHHelp.fSetDocumentHREF(URL, false);
}

function  WWHSearchResultsEntry_Object(ParamBookIndex,
                                       ParamFileIndex,
                                       ParamScore,
                                       ParamTitle)
{
  this.mBookIndex = ParamBookIndex;
  this.mFileIndex = ParamFileIndex;
  this.mScore     = ParamScore;
  this.mTitle     = ParamTitle;
}

function  WWHSearchResultsEntry_ByScoreByBookIndexByTitleFileIndexURL(ParamAlphaEntry,
                                                                      ParamBetaEntry)
{
  var  Result;


  Result = WWHSearchResultsEntry_CompareByScore(ParamAlphaEntry, ParamBetaEntry);
  if (Result == 0)
  {
    Result = WWHSearchResultsEntry_CompareByBookIndex(ParamAlphaEntry, ParamBetaEntry);
  }
  if (Result == 0)
  {
    Result = WWHSearchResultsEntry_CompareByTitleFileIndexURL(ParamAlphaEntry, ParamBetaEntry);
  }

  return Result;
}

function  WWHSearchResultsEntry_ByBookIndexByScoreByTitleFileIndexURL(ParamAlphaEntry,
                                                                      ParamBetaEntry)
{
  var  Result;


  Result = WWHSearchResultsEntry_CompareByBookIndex(ParamAlphaEntry, ParamBetaEntry);
  if (Result == 0)
  {
    Result = WWHSearchResultsEntry_CompareByScore(ParamAlphaEntry, ParamBetaEntry);
  }
  if (Result == 0)
  {
    Result = WWHSearchResultsEntry_CompareByTitleFileIndexURL(ParamAlphaEntry, ParamBetaEntry);
  }

  return Result;
}

function  WWHSearchResultsEntry_CompareByScore(ParamAlphaEntry,
                                               ParamBetaEntry)
{
  var  Result = 0;


  // Sort by score
  //
  if (ParamAlphaEntry.mScore < ParamBetaEntry.mScore)
  {
    Result = 1;
  }
  else if (ParamAlphaEntry.mScore > ParamBetaEntry.mScore)
  {
    Result = -1;
  }

  return Result;
}

function  WWHSearchResultsEntry_CompareByBookIndex(ParamAlphaEntry,
                                                   ParamBetaEntry)
{
  var  Result = 0;


  if (ParamAlphaEntry.mBookIndex < ParamBetaEntry.mBookIndex)
  {
    Result = -1;
  }
  else if (ParamAlphaEntry.mBookIndex > ParamBetaEntry.mBookIndex)
  {
    Result = 1;
  }

  return Result;
}

function  WWHSearchResultsEntry_CompareByTitleFileIndexURL(ParamAlphaEntry,
                                                           ParamBetaEntry)
{
  var  Result = 0;
  var  BookList;
  var  AlphaBookEntry;
  var  BetaBookEntry;
  var  AlphaURL;
  var  BetaURL;


  // Sort by Title
  //
  if (ParamAlphaEntry.mTitle < ParamBetaEntry.mTitle)
  {
    Result = -1;
  }
  else if (ParamAlphaEntry.mTitle > ParamBetaEntry.mTitle)
  {
    Result = 1;
  }
  // Sort by FileIndex
  //
  else if (ParamAlphaEntry.mFileIndex < ParamBetaEntry.mFileIndex)
  {
    Result = -1;
  }
  else if (ParamAlphaEntry.mFileIndex > ParamBetaEntry.mFileIndex)
  {
    Result = 1;
  }
  // Sort by URL
  //
  else
  {
    BookList = WWHFrame.WWHHelp.mBooks.mBookList;

    AlphaBookEntry = BookList[ParamAlphaEntry.mBookIndex];
    BetaBookEntry  = BookList[ParamBetaEntry.mBookIndex];

    AlphaURL = WWHFrame.WWHHelp.mBaseURL + AlphaBookEntry.mDirectory + AlphaBookEntry.mFiles.fFileIndexToHREF(ParamAlphaEntry.mFileIndex);
    BetaURL  = WWHFrame.WWHHelp.mBaseURL + BetaBookEntry.mDirectory + BetaBookEntry.mFiles.fFileIndexToHREF(ParamBetaEntry.mFileIndex);

    if (AlphaURL < BetaURL)
    {
      Result = -1;
    }
    else if (AlphaURL > BetaURL)
    {
      Result = 1;
    }
  }

  return Result;
}
// Copyright (c) 2000-2003 Quadralay Corporation.  All rights reserved.
//

function  WWHTabs_Object(ParamPanels)
{
  this.mWidth = null;

  this.fReload   = WWHTabs_Reload;
  this.fHeadHTML = WWHTabs_HeadHTML;
  this.fBodyHTML = WWHTabs_BodyHTML;
  this.fLoaded   = WWHTabs_Loaded;

  // Calculate width based on number of panels
  //
  if (ParamPanels > 0)
  {
    this.mWidth = "" + (100 / ParamPanels) + "%";
  }
}

function  WWHTabs_Reload()
{
  WWHFrame.WWHHelp.fReplaceLocation("WWHTabsFrame", WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/html/tabs.htm");
}

function  WWHTabs_HeadHTML()
{
  var  StylesHTML = "";


  // Generate style section
  //
  StylesHTML += "<style type=\"text/css\">\n";
  StylesHTML += " <!--\n";
  StylesHTML += "  a.active\n";
  StylesHTML += "  {\n";
  StylesHTML += "    text-decoration: none;\n";
  StylesHTML += "    color: " + WWHFrame.WWHJavaScript.mSettings.mTabs.mSelectedTabForegroundColor + ";\n";
  StylesHTML += "    " + WWHFrame.WWHJavaScript.mSettings.mTabs.mFontStyle + ";\n";
  StylesHTML += "  }\n";
  StylesHTML += "  a.inactive\n";
  StylesHTML += "  {\n";
  StylesHTML += "    text-decoration: none;\n";
  StylesHTML += "    color: " + WWHFrame.WWHJavaScript.mSettings.mTabs.mDefaultTabForegroundColor + ";\n";
  StylesHTML += "    " + WWHFrame.WWHJavaScript.mSettings.mTabs.mFontStyle + ";\n";
  StylesHTML += "  }\n";
  StylesHTML += "  th\n";
  StylesHTML += "  {\n";
  StylesHTML += "    color: " + WWHFrame.WWHJavaScript.mSettings.mTabs.mSelectedTabForegroundColor + ";\n";
  StylesHTML += "    " + WWHFrame.WWHJavaScript.mSettings.mTabs.mFontStyle + ";\n";
  StylesHTML += "  }\n";
  StylesHTML += "  td\n";
  StylesHTML += "  {\n";
  StylesHTML += "    color: " + WWHFrame.WWHJavaScript.mSettings.mTabs.mDefaultTabForegroundColor + ";\n";
  StylesHTML += "    " + WWHFrame.WWHJavaScript.mSettings.mTabs.mFontStyle + ";\n";
  StylesHTML += "  }\n";
  StylesHTML += " -->\n";
  StylesHTML += "</style>\n";

  return StylesHTML;
}

function  WWHTabs_BodyHTML()
{
  var  TabsHTML = "";
  var  ImageDir = WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/images";
  var  MaxIndex;
  var  Index;
  var  VarTabTitle;
  var  VarAccessibilityTitle = "";
  var  CellType;
  var  WrapPrefix;
  var  WrapSuffix;
  var  StyleAttribute;
  var  OnClick;
  var  ImgSuffix;
  var  TableWidth;


  // Set style attribute to insure small image height
  //
  StyleAttribute = " style=\"font-size: 1px; line-height: 1px;\"";

  // Force on one line with a table, except for Netscape 4.x
  //
  if (WWHFrame.WWHBrowser.mBrowser != 1)  // Shorthand for Netscape
  {
    TabsHTML += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\n";
    TabsHTML += "<tr>";
  }

  // Tabs
  //
  for (MaxIndex = WWHFrame.WWHJavaScript.mPanels.mPanelEntries.length, Index = 0 ; Index < MaxIndex ; Index++)
  {
    // Get tab title
    //
    VarTabTitle = WWHFrame.WWHJavaScript.mPanels.mPanelEntries[Index].mPanelObject.mPanelTabTitle;

    // Display anchor only if not selected
    //
    if (Index == WWHFrame.WWHJavaScript.mCurrentTab)
    {
      // Determine title for accessibility
      //
      if (WWHFrame.WWHHelp.mbAccessible)
      {
        VarAccessibilityTitle = WWHStringUtilities_FormatMessage(WWHFrame.WWHJavaScript.mMessages.mAccessibilityActiveTab,
                                                                 VarTabTitle);
        VarAccessibilityTitle = " title=\"" + WWHStringUtilities_EscapeHTML(VarAccessibilityTitle) + "\"";
      }

      CellType = "th";
      WrapPrefix = "<b><a class=\"active\" name=\"tab" + Index + "\" href=\"javascript:void(0);\"" + VarAccessibilityTitle + ">";
      WrapSuffix = "</a></b>";
      OnClick = "";
      ImgSuffix = "";
    }
    else
    {
      // Determine title for accessibility
      //
      if (WWHFrame.WWHHelp.mbAccessible)
      {
        VarAccessibilityTitle = WWHStringUtilities_FormatMessage(WWHFrame.WWHJavaScript.mMessages.mAccessibilityInactiveTab,
                                                                 VarTabTitle);
        VarAccessibilityTitle = " title=\"" + WWHStringUtilities_EscapeHTML(VarAccessibilityTitle) + "\"";
      }

      CellType = "td";
      WrapPrefix = "<b><a class=\"inactive\" name=\"tab" + Index + "\" href=\"javascript:WWHFrame.WWHJavaScript.fClickedChangeTab(" + Index + ");\"" + VarAccessibilityTitle + ">";
      WrapSuffix = "</a></b>";
      OnClick = " onclick=\"WWHFrame.WWHJavaScript.fClickedChangeTabWithDelay(" + Index + ");\"";
      ImgSuffix = "x";
    }

    // Force on one line with a table, except for Netscape 4.x
    //
    if (WWHFrame.WWHBrowser.mBrowser != 1)  // Shorthand for Netscape
    {
      TabsHTML += "<td width=\"" + this.mWidth + "\">";
    }

    // Force on one line with a table, except for Netscape 4.x
    //
    if (WWHFrame.WWHBrowser.mBrowser == 1)  // Shorthand for Netscape
    {
      TableWidth = this.mWidth;
    }
    else
    {
      TableWidth = "100%";
    }
    TabsHTML += "<table align=\"left\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"" + TableWidth + "\">";

    // Top spacer
    //
    TabsHTML += "<tr>"
    TabsHTML += "<td><div" + StyleAttribute + "><img src=\"" + ImageDir + "/spc_top" + ImgSuffix + ".gif\" alt=\"\"></div></td>";
    TabsHTML += "</tr>"

    // Top row
    //
    TabsHTML += "<tr>";
    if (Index == 0)
    {
      TabsHTML += "<td><div" + StyleAttribute + "><img src=\"" + ImageDir + "/spc_tabl.gif\" alt=\"\"></div></td>\n";
    }
    else
    {
      TabsHTML += "<td><div" + StyleAttribute + "><img src=\"" + ImageDir + "/spc_tabm.gif\" alt=\"\"></div></td>\n";
    }

    TabsHTML += "<td" + OnClick + "><div" + StyleAttribute + "><img src=\"" + ImageDir + "/btn_nw" + ImgSuffix + ".gif\" alt=\"\"></div></td>\n";
    TabsHTML += "<td" + OnClick + " background=\"" + ImageDir + "/btn_n" + ImgSuffix + ".gif\"><div" + StyleAttribute + "><img src=\"" + ImageDir + "/spc_n.gif\" alt=\"\"></div></td>\n";
    TabsHTML += "<td" + OnClick + "><div" + StyleAttribute + "><img src=\"" + ImageDir + "/btn_ne" + ImgSuffix + ".gif\" alt=\"\"></div></td>\n";

    if ((Index + 1) == MaxIndex)
    {
      TabsHTML += "<td><div" + StyleAttribute + "><img src=\"" + ImageDir + "/spc_tabr.gif\" alt=\"\"></div></td>\n";
    }
    TabsHTML += "</tr>";

    // Middle row
    //
    TabsHTML += "<tr>";
    if (Index == 0)
    {
      TabsHTML += "<td><div" + StyleAttribute + "><img src=\"" + ImageDir + "/spc_tabl.gif\" alt=\"\"></div></td>\n";
    }
    else
    {
      TabsHTML += "<td><div" + StyleAttribute + "><img src=\"" + ImageDir + "/spc_tabm.gif\" alt=\"\"></div></td>\n";
    }

    TabsHTML += "<td" + OnClick + " background=\"" + ImageDir + "/btn_w" + ImgSuffix + ".gif\"><div" + StyleAttribute + "><img src=\"" + ImageDir + "/spc_w.gif\" alt=\"\"></div></td>\n";
    TabsHTML += "<" + CellType + " background=\"" + ImageDir + "/btn_bg" + ImgSuffix + ".gif\" nowrap align=\"center\" width=\"100%\"" + OnClick + ">";
    TabsHTML += WrapPrefix;
    TabsHTML += VarTabTitle;
    TabsHTML += WrapSuffix;
    TabsHTML += "</" + CellType + ">";
    TabsHTML += "<td" + OnClick + " background=\"" + ImageDir + "/btn_e" + ImgSuffix + ".gif\"><div" + StyleAttribute + "><img src=\"" + ImageDir + "/spc_e.gif\" alt=\"\"></div></td>\n";

    if ((Index + 1) == MaxIndex)
    {
      TabsHTML += "<td><div" + StyleAttribute + "><img src=\"" + ImageDir + "/spc_tabr.gif\" alt=\"\"></div></td>\n";
    }
    TabsHTML += "</tr>";

    // Bottom row
    //
    TabsHTML += "<tr>";
    if (Index == 0)
    {
      TabsHTML += "<td><div" + StyleAttribute + "><img src=\"" + ImageDir + "/spc_tabl.gif\" alt=\"\"></div></td>\n";
    }
    else
    {
      TabsHTML += "<td><div" + StyleAttribute + "><img src=\"" + ImageDir + "/spc_tabm.gif\" alt=\"\"></div></td>\n";
    }

    TabsHTML += "<td" + OnClick + "><div" + StyleAttribute + "><img src=\"" + ImageDir + "/btn_sw" + ImgSuffix + ".gif\" alt=\"\"></div></td>\n";
    TabsHTML += "<td" + OnClick + " background=\"" + ImageDir + "/btn_s" + ImgSuffix + ".gif\"><div" + StyleAttribute + "><img src=\"" + ImageDir + "/spc_s" + ImgSuffix + ".gif\" alt=\"\"></div></td>\n";
    TabsHTML += "<td" + OnClick + "><div" + StyleAttribute + "><img src=\"" + ImageDir + "/btn_se" + ImgSuffix + ".gif\" alt=\"\"></div></td>\n";

    if ((Index + 1) == MaxIndex)
    {
      TabsHTML += "<td><div" + StyleAttribute + "><img src=\"" + ImageDir + "/spc_tabr.gif\" alt=\"\"></div></td>\n";
    }
    TabsHTML += "</tr>";

    TabsHTML += "</table>";

    // Force on one line with a table, except for Netscape 4.x
    //
    if (WWHFrame.WWHBrowser.mBrowser != 1)  // Shorthand for Netscape
    {
      TabsHTML += "</td>\n";
    }
  }

  // Force on one line with a table, except for Netscape 4.x
  //
  if (WWHFrame.WWHBrowser.mBrowser != 1)  // Shorthand for Netscape
  {
    TabsHTML += "</tr>\n";
    TabsHTML += "</table>\n";
  }

  return TabsHTML;
}

function  WWHTabs_Loaded()
{
  // Set frame name for accessibility
  //
  if (WWHFrame.WWHHelp.mbAccessible)
  {
    WWHFrame.WWHHelp.fSetFrameName("WWHTabsFrame");
  }

  // Display requested panel
  //
  WWHFrame.WWHJavaScript.mPanels.fChangePanel(WWHFrame.WWHJavaScript.mCurrentTab);
}

