home *** CD-ROM | disk | FTP | other *** search
/ Thomson (Residential) / TGSTPv7203.iso / mac / Documentation / HTML / TG787v-BUS_de / wwhelp / wwhimpl / common / scripts / controls.js < prev    next >
Text File  |  2007-10-04  |  16KB  |  502 lines

  1. // Copyright (c) 2000-2001 Quadralay Corporation.  All rights reserved.
  2. //
  3.  
  4. var sPageNavTitle = "Thomson Help";
  5.  
  6. function  WWHControls_Object()
  7. {
  8.   this.mSyncPrevNext  = new Array(null, null, null);
  9.  
  10.   this.fSansNavigation = WWHControls_SansNavigation;
  11.   this.fLeftHTML       = WWHControls_LeftHTML;
  12.   this.fRightHTML      = WWHControls_RightHTML;
  13.   this.fUpdateHREF     = WWHControls_UpdateHREF;
  14.   this.fSyncTOC        = WWHControls_SyncTOC;
  15.   this.fPrevious       = WWHControls_Previous;
  16.   this.fNext           = WWHControls_Next;
  17.   this.fRelatedTopics  = WWHControls_RelatedTopics;
  18.   this.fEmail          = WWHControls_Email;
  19.   this.fPrint          = WWHControls_Print;
  20.   this.fBookmark       = WWHControls_Bookmark;
  21.   this.fBookmarkData   = WWHControls_BookmarkData;
  22.   this.fBookmarkLink   = WWHControls_BookmarkLink;
  23. }
  24.  
  25. function  WWHControls_SansNavigation()
  26. {
  27.   var  bSansNavigation = false;
  28.  
  29.  
  30.   if (typeof WWHFrame.WWHNavigationFrame == "undefined")
  31.   {
  32.     bSansNavigation = true;
  33.   }
  34.  
  35.   return bSansNavigation;
  36. }
  37.  
  38. function  WWHControls_LeftHTML()
  39. {
  40.   var  HTML = "";
  41.   var  Settings = WWHFrame.WWHHelp.mSettings;
  42.   
  43.   if (Settings.mbEmailEnabled)
  44.   {
  45.     Settings.mbEmailEnabled = ((typeof Settings.mEmailAddress == "string") &&
  46.                                (Settings.mEmailAddress.length > 0));
  47.   }
  48.  
  49.   if (Settings.mbPrintEnabled)
  50.   {
  51.     Settings.mbPrintEnabled = ((typeof WWHFrame.WWHContentFrame.WWHDocumentFrame.focus != "undefined") &&
  52.                                (typeof WWHFrame.WWHContentFrame.WWHDocumentFrame.print != "undefined"))
  53.   }
  54.   
  55. //------------------------------------------------- Edited by Jimmy Clauwaert (Begin) ----------------------------------------------------------
  56.     //wave
  57.     HTML = '<table border="0" cellpadding="0" cellspacing="0" width="100%" ><tr><td align="left" width="100%">';
  58.     
  59.     HTML += '<table style="menuBar" border="0" cellpadding="0" cellspacing="0">';
  60.     HTML += '<tr>';
  61. //------------------------------------------------- Edited by Jimmy Clauwaert (End) ----------------------------------------------------------
  62.   // Display controls
  63.   //
  64.     // Return to Home
  65.     query = location.search.substring(1);
  66.     i = query.indexOf('?') + 1;
  67.     urlParameters=query.substring(i, query.length);
  68.     numberOfCells=0;
  69.     if ((top.tr[currentLang][4]!='')) {    
  70.         HTML += "<td class=\"menuItem\"><a href=\"../../../../wwhelp.htm?"+urlParameters+"\" target=\"_top\"><img src=\"../images/home.gif\"  border=\"0\" alt=\""+top.tr[currentLang][4]+"\"></a>";
  71.         HTML += "</td>";
  72.         numberOfCells++;
  73.     }
  74.       //Previous
  75.     HTML += '<td  class="menuItem">';
  76.     HTML += "<a href=\"javascript:WWHFrame.WWHControls.fPrevious();\">";
  77.     HTML += "<img name=\"WWHPrevIcon\" alt=\"" + WWHFrame.WWHHelp.mMessages.mPrevIconLabel + "\" border=\"0\" src=\"../images/prevx.gif\">";
  78.     HTML += "</a>";
  79.     HTML += "</td>";
  80.  
  81.     //Next
  82.     HTML += '<td  class="menuItem">';
  83.     HTML += "<a href=\"javascript:WWHFrame.WWHControls.fNext();\">";
  84.     HTML += "<img name=\"WWHNextIcon\" alt=\"" + WWHFrame.WWHHelp.mMessages.mNextIconLabel + "\" border=\"0\" src=\"../images/nextx.gif\">";
  85.     HTML += "</a>";
  86.     HTML += "</td>";        
  87.     //Return to Product Selection
  88.     if ((top.tr[currentLang][5][1]!='')&&(top.showReturnButton)) {
  89.         HTML += '<td class="menuItem">';
  90.         HTML += "<a href=\""+"../../../../"+top.tr[currentLang][5][1]+"?lang="+top.langCode[top.currentLang]+"\" target=\"_top\"><img src=\"../images/return.gif\"  border=\"0\" alt=\""+top.tr[currentLang][5][0]+"\"></a>";
  91.         HTML +="</td>";     
  92.         numberOfCells++;
  93.     }
  94.  
  95.     //Sync
  96.     HTML += '<td class="menuItem" valign="middle">';
  97.     HTML += "<a href=\"javascript:WWHFrame.WWHControls.fSyncTOC();\">";
  98.     HTML += "<img name=\"WWHSyncIcon\" alt=\"" + WWHFrame.WWHHelp.mMessages.mSyncIconLabel + "\" border=\"0\" src=\"../images/syncx.gif\">";
  99.     HTML += "</a>";
  100.     HTML += "</td>";
  101.     numberOfCells++;
  102.   
  103.     if (Settings.mbEmailEnabled)
  104.     {
  105.      HTML += '  <td class="menuItem" width="23">';
  106.      HTML += "   <a href=\"javascript:WWHFrame.WWHControls.fEmail();\">\n";
  107.      HTML += "    <img name=\"WWHEmailIcon\" alt=\"" + WWHFrame.WWHHelp.mMessages.mEmailIconLabel + "\" border=\"0\" src=\"../images/emailx.gif\" width=\"23\" height=\"15\">\n";
  108.      HTML += "   </a>\n";
  109.      HTML += "  </td>\n";
  110.      numberOfCells++;
  111.     }
  112.     
  113.     if (Settings.mbPrintEnabled)
  114.     {
  115.      HTML += '<td class="menuItem">';
  116.      HTML += "<a href=\"javascript:WWHFrame.WWHControls.fPrint();\">";
  117.      HTML += "<img name=\"WWHPrintIcon\" alt=\"" + WWHFrame.WWHHelp.mMessages.mPrintIconLabel + "\" border=\"0\" src=\"../images/print.gif\">";
  118.      HTML += "</a>";
  119.      HTML += "</td>";
  120.      numberOfCells++;
  121.     }
  122.  
  123. //------------------------------------------------- Edited by Jimmy Clauwaert (Begin) ----------------------------------------------------------  
  124.     if ((top.currentPDF!="")&&(top.showPDF)) {
  125.         HTML += '<td class="menuItem">'; 
  126.         HTML += "<a href=\""+'../../../../'+top.currentPDF+"\" target=\"_blank\"><img alt=\""+top.tr[top.currentLang][0]+"\" src=\"../images/pdf.gif\" border=\"0\" /></a>";
  127.         HTML += "</a>";
  128.         HTML += "</td>";
  129.         numberOfCells++;
  130.     }
  131.     if (top.tr[top.currentLang][6][1]!="") {    
  132.         HTML += '<td class="menuItem" style="padding-right:20px">';
  133.         HTML += "<a href=\""+'../../../../'+top.tr[top.currentLang][6][1]+"\" target=\"_blank\"><img alt=\""+top.tr[top.currentLang][6][0]+"\" src=\"../images/help.gif\" border=\"0\" /></a>";
  134.         HTML += "</a>";
  135.         HTML += "</td>";
  136.         numberOfCells++;
  137.        } 
  138. HTML += '<td width="100%" style="text-align:left;padding:0px"><img style="border-style:none" src="../images/barend_left.gif"></td>';
  139. HTML += "<td style=\"vertical-align:bottom;padding-right:20px\"><a target=\"_blank\" href=\"http://www.thomson-broadband.com\"><img style=\"border-style:none\" src=\"../images/Thomson.gif\" alt=\"thomson-broadband.com\"></a></td>";
  140.  
  141.        //Colored line       
  142.     HTML +="</tr></table>";    
  143. HTML += "</td>";
  144. HTML += "</tr>";
  145. HTML += "<tr><td>";
  146.     
  147.     HTML +="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"breadcrumb\" width=\"100%\"><tr>";
  148.     HTML+="<td width=\"100%\">";
  149. //------------------------------------------------- Edited by Jimmy Clauwaert (End) ----------------------------------------------------------    
  150.   HTML += top.currentChapter;
  151.   if (top.currentSection!="") {
  152.       HTML +=" > ";
  153.       HTML +="<a href=\"../../../../about.html\" target=\"WWHDocumentFrame\">"+top.currentSection+"</a>";
  154.           if (top.currentMap!="") {
  155.           HTML +="<span> > </span>";
  156.           HTML +=top.currentMap;
  157.       }
  158.   }
  159.  HTML += " </td>";
  160. HTML += "</tr>";
  161. HTML += "</table>";        
  162. HTML += "</td></tr></table>";
  163. return (HTML);
  164.    }
  165.  
  166. function  WWHControls_RightHTML()
  167. {
  168.   var  HTML = "";
  169.   var  Settings = WWHFrame.WWHHelp.mSettings;
  170.  
  171.  
  172.   // Confirm controls can be displayed
  173.   //
  174.  
  175.  
  176.   // Display controls
  177.   //
  178.   HTML += "<table border=0 cellpadding=0 cellspacing=0 height=\"14\" width=\"100%\"><tr><td height=\"14\"></td></tr></table>";
  179.   HTML += "<table border=\"0\" bgcolor=\"#E5E5E5\" width=\"100%\" height=\"23\"><tr><td align=\"right\" width=\"100%\">";
  180.   
  181.   HTML += "<table border=0 cellpadding=1 cellspacing=0>";
  182.   HTML += "<tr>";
  183.  
  184.   if (Settings.mbRelatedTopicsEnabled)
  185.   {
  186.     HTML += "  <td width=\"23\">\n";
  187.     HTML += "   <a href=\"javascript:WWHFrame.WWHControls.fRelatedTopics();\">\n";
  188.     HTML += "    <img name=\"WWHRelatedTopicsIcon\" alt=\"" + WWHFrame.WWHHelp.mMessages.mRelatedTopicsIconLabel + "\" border=\"0\" src=\"../images/relatedx.gif\" width=\"23\" height=\"15\">\n";
  189.     HTML += "   </a>\n";
  190.     HTML += "  </td>\n";
  191.   }
  192.  
  193.  
  194.   if (Settings.mbBookmarkEnabled)
  195.   {
  196.     HTML += "  <td width=\"23\">\n";
  197.     HTML += "   <a href=\"javascript:WWHFrame.WWHControls.fBookmark();\">\n";
  198.     HTML += "    <img name=\"WWHBookmarkIcon\" alt=\"" + WWHFrame.WWHHelp.mMessages.mBookmarkIconLabel + "\" border=\"0\" src=\"../images/bkmarkx.gif\" width=\"23\" height=\"15\">\n";
  199.     HTML += "   </a>\n";
  200.     HTML += "  </td>\n";
  201.   }
  202.  
  203.  
  204.   HTML += "</tr>";
  205.   HTML += "</table>";
  206.   
  207.   HTML += "</td></tr></table>";
  208.   
  209.  
  210.   return HTML;
  211. }
  212.  
  213. function  WWHControls_UpdateHREF(ParamHREF)
  214. {
  215.   var  DocumentBookmark = "";
  216.   var  ControlsDocument;
  217.   var  Settings = WWHFrame.WWHHelp.mSettings;
  218.   var  Prefix = WWHFrame.WWHHelp.mHelpURLPrefix;
  219.   var  IconURL;
  220.  
  221.  
  222.   // Update sync/prev/next array
  223.   //
  224.   this.mSyncPrevNext = WWHFrame.WWHHelp.fGetSyncPrevNext(ParamHREF);
  225.  
  226.   // Process left control frame
  227.   //
  228.   ControlsDocument = eval("WWHFrame.WWHContentFrame.WWHPageNavFrame.WWHControlsLeftFrame.document");
  229.  
  230.   // Set Sync Icon
  231.   //
  232.   if (this.fSansNavigation())
  233.   {
  234.     ;  // Nothing to do
  235.   }
  236.   else if (Settings.mbSyncContentsEnabled)
  237.   {
  238.     if (this.mSyncPrevNext[0] != null)
  239.     {
  240.       IconURL =  Prefix + "wwhelp/wwhimpl/common/images/sync.gif";
  241.     }
  242.     else
  243.     {
  244.       IconURL = Prefix + "wwhelp/wwhimpl/common/images/syncx.gif";
  245.     }
  246.     //ControlsDocument.images["WWHSyncIcon"].src = IconURL;
  247.   }
  248.   
  249.   // Set E-Mail Icon
  250.   //
  251.   if (Settings.mbEmailEnabled)
  252.   {
  253.     if (this.mSyncPrevNext[0] != null)
  254.     {
  255.       IconURL = Prefix + "wwhelp/wwhimpl/common/images/email.gif";
  256.     }
  257.     else
  258.     {
  259.       IconURL = Prefix + "wwhelp/wwhimpl/common/images/emailx.gif";
  260.     }
  261.     //ControlsDocument.images["WWHEmailIcon"].src = IconURL;
  262.   }
  263.  
  264.   
  265.   // Set Print Icon
  266.   //
  267.   if (Settings.mbPrintEnabled)
  268.   {
  269.     if (this.mSyncPrevNext[0] != null)
  270.     {
  271.       IconURL = Prefix + "wwhelp/wwhimpl/common/images/print.gif";
  272.     }
  273.     else
  274.     {
  275.       IconURL = Prefix + "wwhelp/wwhimpl/common/images/printx.gif";
  276.     }
  277.     //ControlsDocument.images["WWHPrintIcon"].src = IconURL;
  278.   }
  279.  
  280.   // Set Previous Icon
  281.   //
  282.   if (Settings.mbPrevEnabled)
  283.   {
  284.     if (this.mSyncPrevNext[1] != null)
  285.     {
  286.       IconURL = Prefix + "wwhelp/wwhimpl/common/images/prev.gif";
  287.     }
  288.     else
  289.     {
  290.       IconURL = Prefix + "wwhelp/wwhimpl/common/images/prevx.gif";
  291.     }
  292.     //ControlsDocument.images["WWHPrevIcon"].src = IconURL;
  293.   }
  294.  
  295.   // Set Next Icon
  296.   //
  297.   if (Settings.mbNextEnabled)
  298.   {
  299.     if (this.mSyncPrevNext[2] != null)
  300.     {
  301.       IconURL = Prefix + "wwhelp/wwhimpl/common/images/next.gif";
  302.     }
  303.     else
  304.     {
  305.       IconURL = Prefix + "wwhelp/wwhimpl/common/images/nextx.gif";
  306.     }
  307.     //ControlsDocument.images["WWHNextIcon"].src = IconURL;
  308.   }
  309.  
  310.  
  311.   // Process right control frame
  312.   //
  313.   ControlsDocument = eval("WWHFrame.WWHContentFrame.WWHPageNavFrame.WWHControlsRightFrame.document");
  314.  
  315.   // Set Related Topics Icon
  316.   //
  317.   if (Settings.mbRelatedTopicsEnabled)
  318.   {
  319.     if (typeof WWHFrame.WWHContentFrame.WWHDocumentFrame.WWHDefineRelatedTopics == "function")
  320.     {
  321.       IconURL = Prefix + "wwhelp/wwhimpl/common/images/related.gif";
  322.     }
  323.     else
  324.     {
  325.       IconURL = Prefix + "wwhelp/wwhimpl/common/images/relatedx.gif";
  326.     }
  327.     //ControlsDocument.images["WWHRelatedTopicsIcon"].src = IconURL;
  328.   }
  329.  
  330.   // Set Bookmark Icon
  331.   //
  332.   if (Settings.mbBookmarkEnabled)
  333.   {
  334.     if (this.mSyncPrevNext[0] != null)
  335.     {
  336.       IconURL = Prefix + "wwhelp/wwhimpl/common/images/bkmark.gif";
  337.     }
  338.     else
  339.     {
  340.       IconURL = Prefix + "wwhelp/wwhimpl/common/images/bkmarkx.gif";
  341.     }
  342.     //ControlsDocument.images["WWHBookmarkIcon"].src = IconURL;
  343.   }
  344.  
  345. }
  346.  
  347. function  WWHControls_SyncTOC()
  348. {
  349.   var  URL = WWHStringUtilities_NormalizeURL(WWHFrame.WWHContentFrame.WWHDocumentFrame.location.href);
  350.  
  351.  
  352.   // Show navigation or reveal in TOC?
  353.   //
  354.   if (this.fSansNavigation())
  355.   {
  356.     WWHFrame.WWHHandler.fSyncTOC(URL);
  357.   }
  358.   else
  359.   {
  360.     if (this.mSyncPrevNext[0] != null)
  361.     {
  362.       WWHFrame.WWHHandler.fSyncTOC(URL);
  363.     }
  364.   }
  365. }
  366.  
  367. function  WWHControls_Previous()
  368. {
  369.   if (this.mSyncPrevNext[1] != null)
  370.   {
  371.     WWHFrame.WWHHelp.fSetDocumentHREF(this.mSyncPrevNext[1], false);
  372.   }
  373. }
  374.  
  375. function  WWHControls_Next()
  376. {
  377.   if (this.mSyncPrevNext[2] != null)
  378.   {
  379.     WWHFrame.WWHHelp.fSetDocumentHREF(this.mSyncPrevNext[2], false);
  380.   }
  381. }
  382.  
  383. function  WWHControls_RelatedTopics()
  384. {
  385.   if (typeof WWHFrame.WWHContentFrame.WWHDocumentFrame.WWHDefineRelatedTopics == "function")
  386.   {
  387.     WWHFrame.WWHRelatedTopics.fShow();
  388.   }
  389. }
  390.  
  391. function  WWHControls_Email()
  392. {
  393.   if (this.mSyncPrevNext[0] != null)
  394.   {
  395.     WWHFrame.WWHContentFrame.WWHDocumentFrame.location = "mailto:" + WWHFrame.WWHHelp.mSettings.mEmailAddress + "?subject=Feedback: " + escape(this.mSyncPrevNext[0]);
  396.   }
  397. }
  398.  
  399. function  WWHControls_Print()
  400. {
  401.   if (this.mSyncPrevNext[0] != null)
  402.   {
  403.     WWHFrame.WWHContentFrame.WWHDocumentFrame.focus();
  404.     WWHFrame.WWHContentFrame.WWHDocumentFrame.print();
  405.   }
  406. }
  407.  
  408. function  WWHControls_Bookmark()
  409. {
  410.   if (this.mSyncPrevNext[0] != null)
  411.   {
  412.     var  BookmarkData;
  413.  
  414.  
  415.     BookmarkData = this.fBookmarkData();
  416.     if ((BookmarkData[0] != null) &&
  417.         (BookmarkData[1] != null))
  418.     {
  419.       if ((WWHFrame.WWHBrowserInfo.mBrowser == 2) &&  // Shorthand for IE
  420.           ( ! WWHFrame.WWHBrowserInfo.mbMacIE45))
  421.       {
  422.         window.external.AddFavorite(BookmarkData[1], BookmarkData[0]);
  423.       }
  424.       else
  425.       {
  426.         var  Window;
  427.  
  428.  
  429.         Window = window.open(WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/common/html/bookmark.htm", "WWHBookmarkLinkWindow", "width=400,height=20");
  430.         Window.document.open();
  431.         Window.document.writeln("<p>" + WWHFrame.WWHHelp.mMessages.mBookmarkLinkMessage + "</p>");
  432.         Window.document.writeln("<p>" + this.fBookmarkLink() + "</p>");
  433.         Window.document.close();
  434.       }
  435.     }
  436.   }
  437. }
  438.  
  439. function  WWHControls_BookmarkData()
  440. {
  441.   var  BookmarkData = new Array(null, null);
  442.  
  443.  
  444.   if (this.mSyncPrevNext[0] != null)
  445.   {
  446.     var  DocumentURL;
  447.  
  448.  
  449.     // Determine bookmark link
  450.     //
  451.     DocumentURL = WWHFrame.WWHHelp.fGetBookFileHREF(this.mSyncPrevNext[0]);
  452.     if (DocumentURL != null)
  453.     {
  454.       var  DocumentTitle;
  455.       var  ResetEverything;
  456.       var  DocumentBookmarkURL;
  457.  
  458.  
  459.       DocumentTitle = WWHFrame.WWHHelp.fHREFToTitle(this.mSyncPrevNext[0]);
  460.  
  461.       if ((WWHFrame.WWHBrowserInfo.mBrowser == 1) ||  // Shorthand for Netscape
  462.           (WWHFrame.WWHBrowserInfo.mBrowser == 4))    // Shorthand for Netscape 6.0
  463.       {
  464.         ResetEverything = "y=eval("document.open();document.writeln('<a href=\\""+x+"\\">"+x+"</a>');document.close();")";
  465.       }
  466.       else
  467.       {
  468.         ResetEverything = "location=x";
  469.       }
  470.  
  471.       DocumentBookmarkURL = WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/common/html/wwhelp.htm?href=" + WWHStringUtilities_RestoreEscapedSpaces(DocumentURL);
  472.       if (this.fSansNavigation())
  473.       {
  474.         DocumentBookmarkURL += "&single=true"
  475.       }
  476.       DocumentBookmarkURL = "javascript:x=unescape('" + escape(DocumentBookmarkURL) + "');if(typeof window.WWHFrame!='undefined'){window.WWHFrame.WWHHelp.fSetContextDocument(x);}else{" + ResetEverything + ";}";
  477.  
  478.       // Set bookmark data
  479.       //
  480.       BookmarkData[0] = DocumentTitle;
  481.       BookmarkData[1] = DocumentBookmarkURL;
  482.     }
  483.   }
  484.  
  485.   return BookmarkData;
  486. }
  487.  
  488. function  WWHControls_BookmarkLink()
  489. {
  490.   var  BookmarkLink = "";
  491.   var  BookmarkData = this.fBookmarkData();
  492.  
  493.  
  494.   if ((BookmarkData[0] != null) &&
  495.       (BookmarkData[1] != null))
  496.   {
  497.     BookmarkLink = "<a href=\"" + BookmarkData[1] + "\">" + BookmarkData[0] + "</a>";
  498.   }
  499.  
  500.   return BookmarkLink;
  501. }
  502.