home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Special / chip-cd_2001_spec_05.zip / spec_05 / document.cab / rscripts.chm / scripts / ntrktool.js < prev    next >
Text File  |  1999-12-02  |  2KB  |  84 lines

  1. /* Windows NT Resource Kit - main JavaScript for the Toolbox */
  2.  
  3. /* STYLESHEET ************ */
  4.  
  5. document.write("<STYLE>@import url(../scripts/coUA_help.css);</STYLE><STYLE>@import url(../scripts/ntrktool.css);</STYLE>");
  6.  
  7. /* BROWSE SEQUENCE FUNCTION ************
  8. version 0.5 - November 5, 1998
  9. by Peter Costantini */
  10.  
  11. /*
  12. Pass browseSequence the name of the current topic.  Main browse sequence is in a separate file, browse-main.js.  Function finds previous and next topics and writes them into a string which is a line of HTML. This string is returned by the function and written into the document.
  13. */
  14.  
  15. function browseSequence(topic)
  16. {
  17.     var i;
  18.     var sPreviousNext;
  19.     var sPrevFile;
  20.     var sPrevFull;
  21.     var sNextFile;
  22.     var sNextFull;
  23.     var sHref = "<P CLASS='browse'><A HREF='"
  24.     var sTitle = "' TITLE='"
  25.     var sNext = "'>Next</A></P>"
  26.     var sPrevious = "'>Previous</A></P>"
  27.     var sPreviousHref = "'>Previous</A> | <A HREF='"
  28.     var sCurrentTopic = topic;
  29.     var iBrowseLength = oBrowseArray.length;
  30.     var bTopicFound = false;
  31.  
  32. /* Find current topic. */
  33.  
  34.     for(i = 0; i < iBrowseLength; i++)
  35.     {
  36.         if (oBrowseArray[i].topicid == sCurrentTopic)
  37.         {
  38.             bTopicFound = true;
  39.  
  40. /* If first topic, write only link to next topic. */
  41.  
  42.             if (i == 0)
  43.             {
  44.                 sNextFile = oBrowseArray[i + 1].filename;
  45.                 sNextFull = oBrowseArray[i + 1].fullname;
  46.                 sPreviousNext = sHref + sNextFile + sTitle + sNextFull + sNext;
  47.             }
  48.  
  49. /* If last topic, write only link to previous topic. */
  50.  
  51.             else if (i == iBrowseLength - 1)
  52.             {
  53.                 sPrevFile = oBrowseArray[i - 1].filename;
  54.                 sPrevFull = oBrowseArray[i - 1].fullname;
  55.                 sPreviousNext = sHref + sPrevFile + sTitle + sPrevFull + sPrevious;
  56.             }
  57.  
  58. /* For topics in between, write links to previous and next topics. */
  59.  
  60.             else
  61.             {
  62.                 sNextFile = oBrowseArray[i + 1].filename;
  63.                 sNextFull = oBrowseArray[i + 1].fullname;
  64.                 sPrevFile = oBrowseArray[i - 1].filename;
  65.                 sPrevFull = oBrowseArray[i - 1].fullname;
  66.                 sPreviousNext = sHref + sPrevFile + sTitle + sPrevFull + sPreviousHref + sNextFile + sTitle +  sNextFull + sNext;
  67.             }
  68.         }
  69.     }
  70.  
  71. /* If topic not found, write that in place of the browse links. */
  72.  
  73.     if (bTopicFound == false)
  74.         {
  75.         sPreviousNext = "Topic not found in browse sequence.";
  76.         }
  77.  
  78. /* Write the Previous-Next HTML string into the document. */
  79.  
  80.     document.write(sPreviousNext);
  81.  
  82.     return;
  83. }
  84.