home *** CD-ROM | disk | FTP | other *** search
/ Thomson (Residential) / TGSTPv7203.iso / mac / Documentation / HTML / TG780-BUS_it / wwhelp / wwhimpl / js / scripts / panels.js < prev    next >
Text File  |  2007-06-22  |  7KB  |  191 lines

  1. // Copyright (c) 2000-2001 Quadralay Corporation.  All rights reserved.
  2. //
  3.  
  4. function  WWHPanelsEntry_Object(ParamPanelObject)
  5. {
  6.   this.mPanelObject    = ParamPanelObject;
  7.   this.mScrollPosition = new Array(0, 0);
  8. }
  9.  
  10. function  WWHPanels_Object()
  11. {
  12.   this.mPanelEntries = new Array();
  13.   this.mPopup        = new WWHPopup_Object("WWHFrame.WWHJavaScript.mPanels.mPopup",
  14.                                            "WWHFrame.WWHNavigationFrame.WWHPanelFrame",
  15.                                            WWHPanelHoverText_Translate, WWHPanelHoverText_Format,
  16.                                            "WWHPanelPopupDIV", "WWHPanelPopupText", 1000, 12, 20,
  17.                                            WWHFrame.WWHJavaScript.mSettings.mHoverText.mWidth);
  18.  
  19.   this.fClearScrollPosition   = WWHPanels_ClearScrollPosition;
  20.   this.fSaveScrollPosition    = WWHPanels_SaveScrollPosition;
  21.   this.fRestoreScrollPosition = WWHPanels_RestoreScrollPosition;
  22.   this.fJumpToAnchor          = WWHPanels_JumpToAnchor;
  23.   this.fGetCurrentPanelObject = WWHPanels_GetCurrentPanelObject;
  24.   this.fDisplayPanel          = WWHPanels_DisplayPanel;
  25.   this.fPanelLoaded           = WWHPanels_PanelLoaded;
  26.  
  27.   // Add visible panels
  28.   //
  29.   if (WWHFrame.WWHJavaScript.mSettings.mTOC.mbShow)
  30.   {
  31.     this.mPanelEntries[this.mPanelEntries.length] = new WWHPanelsEntry_Object(WWHFrame.WWHOutline);
  32.   }
  33.   if (WWHFrame.WWHJavaScript.mSettings.mIndex.mbShow)
  34.   {
  35.     this.mPanelEntries[this.mPanelEntries.length] = new WWHPanelsEntry_Object(WWHFrame.WWHIndex);
  36.   }
  37.   if (WWHFrame.WWHJavaScript.mSettings.mSearch.mbShow)
  38.   {
  39.     this.mPanelEntries[this.mPanelEntries.length] = new WWHPanelsEntry_Object(WWHFrame.WWHSearch);
  40.   }
  41. }
  42.  
  43. function  WWHPanels_ClearScrollPosition()
  44. {
  45.   var  CurrentTab = WWHFrame.WWHJavaScript.mCurrentTab;
  46.  
  47.  
  48.   this.mPanelEntries[CurrentTab].mScrollPosition[0] = 0;
  49.   this.mPanelEntries[CurrentTab].mScrollPosition[1] = 0;
  50. }
  51.  
  52. function  WWHPanels_SaveScrollPosition()
  53. {
  54.   var  CurrentTab = WWHFrame.WWHJavaScript.mCurrentTab;
  55.  
  56.  
  57.   if ((WWHFrame.WWHBrowserInfo.mBrowser == 1) ||  // Shorthand for Netscape
  58.       (WWHFrame.WWHBrowserInfo.mBrowser == 4))    // Shorthand for Netscape 6.0 (Mozilla)
  59.   {
  60.     this.mPanelEntries[CurrentTab].mScrollPosition[0] = WWHFrame.WWHNavigationFrame.WWHPanelFrame.window.pageXOffset;
  61.     this.mPanelEntries[CurrentTab].mScrollPosition[1] = WWHFrame.WWHNavigationFrame.WWHPanelFrame.window.pageYOffset;
  62.   }
  63.   else if (WWHFrame.WWHBrowserInfo.mBrowser == 2)  // Shorthand for IE
  64.   {
  65.     // Test required to avoid JavaScript error under IE5.5 on Windows
  66.     //
  67.     if (typeof WWHFrame.WWHNavigationFrame.WWHPanelFrame.document.body == "undefined")
  68.     {
  69.       this.mPanelEntries[CurrentTab].mScrollPosition[0] = 0;
  70.       this.mPanelEntries[CurrentTab].mScrollPosition[1] = 0;
  71.     }
  72.     else
  73.     {
  74.       this.mPanelEntries[CurrentTab].mScrollPosition[0] = WWHFrame.WWHNavigationFrame.WWHPanelFrame.document.body.scrollLeft;
  75.       this.mPanelEntries[CurrentTab].mScrollPosition[1] = WWHFrame.WWHNavigationFrame.WWHPanelFrame.document.body.scrollTop;
  76.     }
  77.   }
  78. }
  79.  
  80. function  WWHPanels_RestoreScrollPosition()
  81. {
  82.   var  PanelEntry     = this.mPanelEntries[WWHFrame.WWHJavaScript.mCurrentTab];
  83.   var  ScrollPosition = PanelEntry.mScrollPosition;
  84.  
  85.  
  86.   // See if a target position has been specified
  87.   //
  88.   if (PanelEntry.mPanelObject.mPanelAnchor != null)
  89.   {
  90.     this.fJumpToAnchor();
  91.   }
  92.   else
  93.   {
  94.     // setTimeout required for correct operation in Netscape 6.0
  95.     //
  96.     setTimeout("WWHFrame.WWHNavigationFrame.WWHPanelFrame.window.scroll(" + ScrollPosition[0] + ", " + ScrollPosition[1] + ");", 10);
  97.   }
  98. }
  99.  
  100. function  WWHPanels_JumpToAnchor()
  101. {
  102.   var  PanelObject = this.fGetCurrentPanelObject();
  103.   var  bEnableNavigatorWorkaround = false;
  104.  
  105.  
  106.   if (WWHFrame.WWHBrowserInfo.mBrowser == 1)  // Shorthand for Netscape
  107.   {
  108.     // Navigator reloads the page if the hash isn't already defined
  109.     //
  110.     if (WWHFrame.WWHNavigationFrame.WWHPanelFrame.location.hash.length == 0)
  111.     {
  112.       bEnableNavigatorWorkaround = true;
  113.     }
  114.   }
  115.  
  116.   // Jump to anchor
  117.   //
  118.   WWHFrame.WWHNavigationFrame.WWHPanelFrame.location.hash = PanelObject.mPanelAnchor;
  119.  
  120.   // Navigator reloads the page if the hash isn't already defined
  121.   //
  122.   if ( ! bEnableNavigatorWorkaround)
  123.   {
  124.     PanelObject.mPanelAnchor = null;
  125.   }
  126. }
  127.  
  128. function  WWHPanels_GetCurrentPanelObject()
  129. {
  130.   return this.mPanelEntries[WWHFrame.WWHJavaScript.mCurrentTab].mPanelObject;
  131. }
  132.  
  133. function  WWHPanels_DisplayPanel()
  134. {
  135.   var  PanelObject = this.fGetCurrentPanelObject();
  136.   var  ExtraAction = "";
  137.  
  138.  
  139.   if ((WWHFrame.WWHBrowserInfo.mBrowser == 1) ||  // Shorthand for Netscape
  140.       (WWHFrame.WWHBrowserInfo.mBrowser == 4))    // Shorthand for Netscape 6.0 (Mozilla)
  141.   {
  142.     // Navigator has trouble if the hash is defined
  143.     //
  144.     if (WWHFrame.WWHNavigationFrame.WWHPanelFrame.location.hash.length != 0)
  145.     {
  146.       ExtraAction = "WWHFrame.WWHNavigationFrame.WWHPanelFrame.location.hash = \"\"; ";
  147.  
  148.       if (WWHFrame.WWHBrowserInfo.mBrowser == 4)  // Shorthand for Netscape 6.0 (Mozilla)
  149.       {
  150.         ExtraAction += "WWHFrame.WWHNavigationFrame.WWHPanelFrame.location.replace(\"" + WWHStringUtilities_EscapeURLForJavaScriptAnchor(WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/html/panel.htm") + "\"); "
  151.       }
  152.     }
  153.   }
  154.  
  155.   // Close down any popups we had going to prevent JavaScript errors
  156.   //
  157.   this.mPopup.fHide();
  158.  
  159.   if ( ! PanelObject.mbPanelInitialized)
  160.   {
  161.     setTimeout(ExtraAction + "WWHFrame.WWHNavigationFrame.WWHPanelFrame.location.replace(\"" + WWHStringUtilities_EscapeURLForJavaScriptAnchor(WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/html/panelini.htm") + "\");", 1);
  162.   }
  163.   else
  164.   {
  165.     setTimeout(ExtraAction + "WWHFrame.WWHNavigationFrame.WWHPanelFrame.location.replace(\"" + WWHStringUtilities_EscapeURLForJavaScriptAnchor(WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/html/panel.htm") + "\");", 1);
  166.   }
  167. }
  168.  
  169. function  WWHPanels_PanelLoaded()
  170. {
  171.   WWHFrame.WWHJavaScript.fEndChangeTab();
  172. }
  173.  
  174. function  WWHPanelHoverText_Translate(ParamEntryID)
  175. {
  176.   var  PanelObject = WWHFrame.WWHJavaScript.mPanels.fGetCurrentPanelObject();
  177.  
  178.  
  179.   return PanelObject.fHoverTextTranslate(ParamEntryID);
  180. }
  181.  
  182. function  WWHPanelHoverText_Format(ParamWidth,
  183.                                    ParamTextID,
  184.                                    ParamText)
  185. {
  186.   var  PanelObject = WWHFrame.WWHJavaScript.mPanels.fGetCurrentPanelObject();
  187.  
  188.  
  189.   return PanelObject.fHoverTextFormat(ParamWidth, ParamTextID, ParamText);
  190. }
  191.