home *** CD-ROM | disk | FTP | other *** search
- function Tabs_Object(ParamWWHelp)
- {
- this.mWWHelp = ParamWWHelp;
-
- this.mMessageKeys = new Array("Tabs TOC", "Tabs Index", "Tabs Search", "Tabs Favorites");
- this.mXYPosition = new Array(new Array(0,0), new Array(0,0), new Array(0,0), new Array(0,0));
- this.mCurrentTab = -1;
-
- this.fChangeTab = Tabs_ChangeTab;
- this.fUpdateXYPosition = Tabs_UpdateXYPosition;
- this.fGenerateStyles = Tabs_GenerateStyles;
- this.fDisplayTabs = Tabs_DisplayTabs;
- }
-
- function Tabs_ChangeTab(ParamTabIndex)
- {
- this.fUpdateXYPosition();
-
- this.mCurrentTab = ParamTabIndex;
-
- WWHelpTopFrame.WWHNavigation.WWHTabs.location.href = this.mWWHelp.mBaseURL + "wwhelp/js/html/tabs.htm";
- WWHelpTopFrame.WWHNavigation.WWHSync.location.href = this.mWWHelp.mBaseURL + "wwhelp/js/html/sync.htm";
- }
-
- function Tabs_UpdateXYPosition()
- {
- if (this.mWWHelp.mBrowser == 1) // Shorthand for Netscape
- {
- this.mXYPosition[this.mCurrentTab][0] = WWHelpTopFrame.WWHNavigation.WWHSync.window.pageXOffset;
- this.mXYPosition[this.mCurrentTab][1] = WWHelpTopFrame.WWHNavigation.WWHSync.window.pageYOffset;
- }
- else if (this.mWWHelp.mBrowser == 2) // Shorthand for IE
- {
- this.mXYPosition[this.mCurrentTab][0] = WWHelpTopFrame.WWHNavigation.WWHSync.document.body.scrollLeft;
- this.mXYPosition[this.mCurrentTab][1] = WWHelpTopFrame.WWHNavigation.WWHSync.document.body.scrollTop;
- }
- }
-
- function Tabs_GenerateStyles()
- {
- // Generate style section
- //
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.writeln("<style type=\"text/css\">");
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.writeln(" <!--");
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.writeln(" a { text-decoration: none ;");
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.writeln(" color: " + this.mWWHelp.mMessages["Tabs Default Text Color"] + " }");
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.writeln(" th { color: " + this.mWWHelp.mMessages["Tabs Selected Text Color"] + " ;");
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.writeln(" font-family: " + this.mWWHelp.mMessages["Font Family"] + " ;");
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.writeln(" font-size: " + this.mWWHelp.mMessages["Font Size"] + " }");
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.writeln(" td { color: " + this.mWWHelp.mMessages["Tabs Default Text Color"] + " ;");
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.writeln(" font-family: " + this.mWWHelp.mMessages["Font Family"] + " ;");
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.writeln(" font-size: " + this.mWWHelp.mMessages["Font Size"] + " }");
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.writeln(" -->");
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.writeln("</style>");
- }
-
- function Tabs_DisplayTabs()
- {
- var NumDisplayedTabs;
- var MaxIndex;
- var Index;
- var Height = 24;
- var Width = 80;
- var CellType;
- var BackgoundColor;
- var WrapPrefix;
- var WrapSuffix;
- var OnClick;
- var bInitDisplay = false;
-
-
- // Calculate width based on number of displayed tabs
- //
- NumDisplayedTabs = 0;
- for (MaxIndex = this.mMessageKeys.length, Index = 0 ; Index < MaxIndex ; Index++)
- {
- if (this.mWWHelp.mMessages[this.mMessageKeys[Index]].length > 0)
- {
- NumDisplayedTabs++;
- }
- }
-
- if (NumDisplayedTabs < 0)
- {
- NumDisplayedTabs = 1;
- }
-
- Width = "\"" + 100/NumDisplayedTabs + "%\"";
-
- // Setup table for tab display
- //
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.writeln("<table border=0 cellspacing=2 cellpadding=0 width=\"100%\">");
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.writeln("<tr>");
-
- for (MaxIndex = this.mMessageKeys.length, Index = 0 ; Index < MaxIndex ; Index++)
- {
- // Only display tabs with display names
- //
- if (this.mWWHelp.mMessages[this.mMessageKeys[Index]])
- {
- // Initialize mCurrentTab (only occurs on initial load)
- //
- if (this.mCurrentTab == -1)
- {
- // Update tab area and sync area as well
- //
- this.mCurrentTab = Index;
- bInitDisplay = true;
- }
-
- // Display anchor only if not selected
- //
- if (Index == this.mCurrentTab)
- {
- CellType = "th";
- BackgroundColor = this.mWWHelp.mMessages["Tabs Selected Tab Color"];
- WrapPrefix = "<b>";
- WrapSuffix = "</b>";
- OnClick = "";
- }
- else
- {
- CellType = "td";
- BackgroundColor = this.mWWHelp.mMessages["Tabs Default Tab Color"];
- WrapPrefix = "<b><a href=\"javascript:WWHelpTopFrame.WWHelp.mTabs.fChangeTab(" + Index + ");\">";
- WrapSuffix = "</a></b>";
- OnClick = " onClick=\"WWHelpTopFrame.WWHelp.mTabs.fChangeTab(" + Index + ");\"";
- }
-
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.write("<" + CellType + " nowrap align=center height=" + Height + " width=" + Width + " bgcolor=\"" + BackgroundColor + "\"" + OnClick + ">");
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.write(WrapPrefix);
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.write(this.mWWHelp.mMessages[this.mMessageKeys[Index]]);
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.write(WrapSuffix);
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.writeln("</" + CellType + ">");
- }
- }
-
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.writeln("</tr>");
- WWHelpTopFrame.WWHNavigation.WWHTabs.document.writeln("</table>");
-
- // Initialize display by calling change tab (only occurs on initial load)
- //
- if (bInitDisplay)
- {
- setTimeout("WWHelpTopFrame.WWHelp.mTabs.fChangeTab(" + this.mCurrentTab + ");", 100);
- }
- }
-