tags that are rewritten on the fly
//
if (WWHFrame.WWHBrowser.mBrowser == 4) // Shorthand for Netscape 6.x (Mozilla)
{
Spacer1w2h = "";
Spacer2w1h = "";
Spacer1w7h = "";
Spacer5w1h = "";
}
FormattedText += "
";
FormattedText += " ";
FormattedText += " " + Spacer1w2h + " | ";
FormattedText += "
";
FormattedText += " ";
FormattedText += " " + Spacer2w1h + " | ";
FormattedText += " " + Spacer1w7h + " | ";
FormattedText += " " + Spacer2w1h + " | ";
FormattedText += "
";
FormattedText += " ";
FormattedText += " " + ReqSpacer2w1h + " | ";
FormattedText += " " + ReqSpacer5w1h + " | ";
FormattedText += " " + ParamText + " | ";
FormattedText += " " + ReqSpacer5w1h + " | ";
FormattedText += " " + ReqSpacer2w1h + " | ";
FormattedText += "
";
FormattedText += " ";
FormattedText += " " + Spacer2w1h + " | ";
FormattedText += " " + Spacer1w7h + " | ";
FormattedText += " " + Spacer2w1h + " | ";
FormattedText += "
";
FormattedText += " ";
FormattedText += " " + Spacer1w2h + " | ";
FormattedText += "
";
FormattedText += "
";
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 += "
\n";
return HTML;
}
function WWHSearch_Submit()
{
var VarPanelNavigationFrame;
var SearchForm;
var NewSearchWords;
var NewSearchScope;
var MaxIndex;
var Index;
if (WWHFrame.WWHHandler.fIsReady())
{
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.mbSearching = true;
}
// Update search scope
//
if (WWHFrame.WWHHelp.mBooks.mBookList.length > 1)
{
NewSearchScope = SearchForm.elements["WWHSearchScope"].selectedIndex;
if (NewSearchScope != this.mSavedSearchScope)
{
this.mSavedSearchScope = NewSearchScope;
this.mbSearching = true;
}
}
// Perform search if something changed
//
if (this.mbSearching)
{
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.mbSearching;
}
function WWHSearch_SetSearchWords(ParamSearchWordsString)
{
// Workaround for stupid Netscape 4.x bug
//
var StringWithSpace = "x x";
var SearchWordList;
var MaxIndex;
var Index;
var SearchWord;
var SearchRegExpPattern;
// Clear search words
//
this.mSearchWordList.length = 0;
this.mSearchWordRegExpList.length = 0;
// Add search words to hash
//
SearchWordList = ParamSearchWordsString.split(StringWithSpace.substring(1, 2));
for (MaxIndex = SearchWordList.length, Index = 0 ; Index < MaxIndex ; Index++)
{
// Skip 0 length words
//
if (SearchWordList[Index].length > 0)
{
// Add to search words hash
//
SearchWord = SearchWordList[Index].toLowerCase();
SearchRegExpPattern = WWHStringUtilities_WordToRegExpPattern(SearchWord);
this.mSearchWordList[this.mSearchWordList.length] = SearchWord;
this.mSearchWordRegExpList[this.mSearchWordRegExpList.length] = new RegExp(SearchRegExpPattern, "i");
}
}
}
function WWHSearch_CheckForMatch(ParamSearchFunc)
{
var Count;
var MaxIndex;
var Index;
var BookSearchInfoEntry;
var BookMatchesListEntry;
var SearchPattern;
Count = 0;
for (MaxIndex = this.mSearchWordList.length, Index = 0 ; Index < MaxIndex ; Index++)
{
BookSearchInfoEntry = this.mBookSearchInfoList[this.mBookIndex]
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_SearchComplete()
{
// Combine results for display
//
this.fCombineResults();
// 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 += "
";
// 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 += "
\n";
HTML += "
\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 += "
\n";
}
HTML += "
";
HTML += "
" + BookList[Entry.mBookIndex].mTitle + "
";
this.mByBookDetect = Entry.mBookIndex;
// Open new list for next book
//
HTML += "
\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 += "- ";
}
else
{
HTML += "
- ";
}
// Display Title
//
HTML += "";
HTML += Entry.mTitle;
HTML += "";
// Display Book
//
if ((BookList.length > 1) && // More than one book exists
(this.mSortedBy == 1)) // By Score
{
HTML += ", " + BookList[Entry.mBookIndex].mTitle;
}
HTML += "
\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("
\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(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;
}