home *** CD-ROM | disk | FTP | other *** search
/ Thomson (Residential) / TGSTPv7203.iso / mac / Documentation / HTML / TG585n_it / wwhelp / wwhimpl / js / scripts / tabs.js < prev   
Text File  |  2007-10-02  |  4KB  |  126 lines

  1. // Copyright (c) 2000-2001 Quadralay Corporation.  All rights reserved.
  2. //
  3.  
  4. function  WWHTabs_Object()
  5. {
  6.   this.mWidth = null;
  7.  
  8.   this.fInit       = WWHTabs_Init;
  9.   this.fDisplayTab = WWHTabs_DisplayTab;
  10.   this.fHeadHTML   = WWHTabs_HeadHTML;
  11.   this.fBodyHTML   = WWHTabs_BodyHTML;
  12. }
  13.  
  14. function  WWHTabs_Init()
  15. {
  16.   var  InitialTab = -1;
  17.  
  18.  
  19.   // Select first visible tab
  20.   //
  21.   if (WWHFrame.WWHJavaScript.mPanels.mPanelEntries.length > 0)
  22.   {
  23.     InitialTab = 0;
  24.  
  25.     // Calculate width based on number of displayed tabs
  26.     //
  27.     this.mWidth = "" + 100/WWHFrame.WWHJavaScript.mPanels.mPanelEntries.length + "%";
  28.   }
  29.  
  30.   return InitialTab;
  31. }
  32.  
  33. function  WWHTabs_DisplayTab()
  34. {
  35.   WWHFrame.WWHNavigationFrame.WWHTabsFrame.location.replace(WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/html/tabs.htm");
  36. }
  37.  
  38. function  WWHTabs_HeadHTML()
  39. {
  40.   var  StylesHTML = "";
  41.  
  42.  
  43.   // Generate style section
  44.   //
  45.   StylesHTML += "<style type=\"text/css\">\n";
  46.   StylesHTML += " <!--\n";
  47.   StylesHTML += "  a  { text-decoration: none ;\n";
  48.   StylesHTML += "       color: " + WWHFrame.WWHJavaScript.mSettings.mTabs.mDefaultTabTextColor + " }\n";
  49.   StylesHTML += "  th { color: " + WWHFrame.WWHJavaScript.mSettings.mTabs.mSelectedTabTextColor + " ;\n";
  50.   StylesHTML += "       " + WWHFrame.WWHJavaScript.mSettings.mTabs.mFontStyle + " }\n";
  51.   StylesHTML += "  td { color: " + WWHFrame.WWHJavaScript.mSettings.mTabs.mDefaultTabTextColor + " ;\n";
  52.   StylesHTML += "       " + WWHFrame.WWHJavaScript.mSettings.mTabs.mFontStyle + " }\n";
  53.   StylesHTML += " -->\n";
  54.   StylesHTML += "</style>\n";
  55.  
  56.   return StylesHTML;
  57. }
  58.  
  59. function  WWHTabs_BodyHTML()
  60. {
  61.   var  TabsHTML = "";
  62.   var  Height = 42;
  63.   var  MaxIndex;
  64.   var  Index;
  65.   var  CellType;
  66.   var  BorderColor;
  67.   var  BackgoundColor;
  68.   var  WrapPrefix;
  69.   var  WrapSuffix;
  70.   var  OnClick;
  71.   var imgSrc;
  72.  
  73.   // Setup table for tab display
  74.   //
  75.   
  76.   //TabsHTML += "<table border=\"0\" cellpadding=0 cellspacing=0 width=\"100%\" class=\"docTitle\"><tr><td height=\"70\"><a target=\"_blank\" href=\"http://www.thomson-broadband.com\"><img style=\"border-style:none\" src=\"../images/Thomson.gif\" alt=\"thomson-broadband.com\"></a></td></tr></table>";  
  77.   TabsHTML += "<table border=0 cellspacing=0 cellpadding=0 width=\"100%\">";
  78.   TabsHTML += "<tr>";
  79.  
  80.   for (MaxIndex = WWHFrame.WWHJavaScript.mPanels.mPanelEntries.length, Index = 0 ; Index < MaxIndex ; Index++)
  81.   {
  82.     // Display anchor only if not selected
  83.     //
  84.     if (Index == WWHFrame.WWHJavaScript.mCurrentTab)
  85.     {
  86.       CellType = "th";
  87.       BorderColor = WWHFrame.WWHJavaScript.mSettings.mTabs.mSelectedTabBorderColor;
  88.       BackgroundColor = WWHFrame.WWHJavaScript.mSettings.mTabs.mSelectedTabColor;
  89.       WrapPrefix = "<b>";
  90.       WrapSuffix = "</b>";
  91.       OnClick = "";
  92.       imgSrc = "../images/navanim2.gif";
  93.     }
  94.     else
  95.     {
  96.       CellType = "td";
  97.       BorderColor = WWHFrame.WWHJavaScript.mSettings.mTabs.mDefaultTabBorderColor;
  98.       BackgroundColor = WWHFrame.WWHJavaScript.mSettings.mTabs.mDefaultTabColor;
  99.       WrapPrefix = "<b><a href=\"javascript:WWHFrame.WWHJavaScript.fStartChangeTab(" + Index + ");\">";
  100.       WrapSuffix = "</a></b>";
  101.       OnClick = " onClick=\"WWHFrame.WWHJavaScript.fStartChangeTabWithDelay(" + Index + ");\"";
  102.       imgSrc = "../images/navanim1.gif";
  103.     }
  104.  
  105.     TabsHTML += "<td width=\"" + this.mWidth + "\" bgcolor=\"" + BorderColor + "\" valign=\"bottom\">";
  106.     TabsHTML += "<table border=0 cellspacing=1 cellpadding=0 width=\"100%\">";
  107.     TabsHTML += "<tr valign=\"middle\">";
  108.  
  109.     TabsHTML += "<" + CellType + " nowrap align=\"center\" valign=\"middle\" height=" + Height + " width=\"" + this.mWidth + "\" bgcolor=\"" + BackgroundColor + "\"" + OnClick + ">";
  110.     TabsHTML += WrapPrefix;
  111.     TabsHTML += WWHFrame.WWHJavaScript.mPanels.mPanelEntries[Index].mPanelObject.mPanelTabTitle;
  112.     TabsHTML += WrapSuffix;
  113. //    TabsHTML += "<img src=\"" + imgSrc + "\">";
  114.     TabsHTML += "</" + CellType + ">";
  115.  
  116.     TabsHTML += "</tr>";
  117.     TabsHTML += "</table>";
  118.     TabsHTML += "</td>\n";
  119.   }
  120.  
  121.   TabsHTML += "</tr>\n";
  122.   TabsHTML += "</table>\n";
  123.  
  124.   return TabsHTML;
  125. }
  126.