home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 March / PCWMAR06.iso / Software / Full / Canvas 8 / Canvas8 / HelpEngine.Cab / F21460_navbar.js < prev   
Encoding:
JavaScript  |  2001-03-28  |  3.8 KB  |  157 lines

  1. //-------------------------------------------------------------------------------
  2.  
  3. // global variables.
  4. var gCurrPage;
  5. var gFirstPage;
  6. var gLastPage;
  7. var gsFName;
  8. var gsExtName;
  9.  
  10. var gUSECACHE=true;
  11.  
  12. //-------------------------------------------------------------------------------
  13.  
  14. function OpenIndex()
  15. {
  16.     // Swap Index.htm with IndexWithCache to enable/disable cache!!
  17.  
  18.     if (gUSECACHE)
  19.         parent.contents.location = "IndexWithCache.htm";
  20.     else
  21.         parent.contents.location = "Index.htm";
  22. }
  23.  
  24. //-------------------------------------------------------------------------------
  25.  
  26. function OpenContents()
  27. {
  28.    parent.contents.location = "Contents.htm";
  29. }
  30.  
  31. //-------------------------------------------------------------------------------
  32. function OpenSearch()
  33. {
  34.    parent.contents.location = "Search.htm";
  35. }
  36.  
  37. //-------------------------------------------------------------------------------
  38. function OpenHome()
  39. {
  40.    //parent.main.location = "Home.htm";
  41.    parent.main.location = "ContactDeneba.htm"
  42. }
  43.  
  44. //-------------------------------------------------------------------------------
  45.  
  46. function updateBar(pageNum)
  47. {
  48.    var prevIcon = 0;
  49.    var nextIcon = 0;
  50.  
  51.    if(gFirstPage != gLastPage)
  52.    {
  53.       if(pageNum == gFirstPage)
  54.          nextIcon = 1;
  55.       else if(pageNum == gLastPage)
  56.          prevIcon = 1;
  57.       else if(pageNum > gFirstPage || pageNum < gLastPage)
  58.       {
  59.          prevIcon = 1;
  60.          nextIcon = 1;
  61.       }
  62.    }
  63.  
  64.     // PLTODO: fix
  65.    //document.next.src = gNextImg[nextIcon].src;
  66.    //document.prev.src = gPrevImg[prevIcon].src;
  67. }
  68.  
  69.  
  70. //-------------------------------------------------------------------------------
  71.  
  72. function goFirstPage()
  73. {
  74.    openPageAbs(gFirstPage);
  75. }
  76.  
  77. //-------------------------------------------------------------------------------
  78.  
  79. function goLastPage()
  80. {
  81.    openPageAbs(gLastPage);
  82. }
  83.  
  84. //-------------------------------------------------------------------------------
  85.  
  86. function goPrevPage()
  87. {
  88.    var pageNum = gCurrPage - 1;
  89.  
  90.    if(pageNum < gFirstPage)
  91.       return;
  92.  
  93.    openPageAbs(pageNum);
  94. }
  95.  
  96. //-------------------------------------------------------------------------------
  97.  
  98. function goNextPage()
  99. {
  100.    var pageNum = gCurrPage + 1;
  101.  
  102.    if(pageNum > gLastPage)
  103.       return;
  104.  
  105.    openPageAbs(pageNum);
  106. }
  107.  
  108. //-------------------------------------------------------------------------------
  109. // opens page if you are currenlty viewing a page in same directory...
  110. // PLNOTE: only used in links within actuall content pages to link
  111. // to other pages...
  112. function openPage(pageNum)     
  113. {
  114.    if(pageNum >= gFirstPage && pageNum <= gLastPage)
  115.    {
  116.       parent.main.location = gsRelFName + "_"  + pageNum + gsExtName;
  117.       updateContents(pageNum);
  118.       updateBar(pageNum);
  119.       gCurrPage = pageNum;
  120.    }
  121. }
  122.  
  123.  
  124. //-------------------------------------------------------------------------------
  125. function openPageAbs(pageNum)    // uses an absolute path from engine dir to navigate to page...
  126. {
  127.    if(pageNum >= gFirstPage && pageNum <= gLastPage)
  128.    {
  129.       parent.main.location = gsFName + "_"  + pageNum + gsExtName;
  130.       updateContents(pageNum);
  131.       updateBar(pageNum);
  132.       gCurrPage = pageNum;
  133.    }
  134. }
  135.  
  136. //-------------------------------------------------------------------------------
  137. function openPageAbsNoUpdateContents(pageNum)    // uses an absolute path from engine dir to navigate to page...
  138. {
  139.    if(pageNum >= gFirstPage && pageNum <= gLastPage)
  140.    {
  141.       parent.main.location = gsFName + "_"  + pageNum + gsExtName;
  142.       updateBar(pageNum);
  143.       gCurrPage = pageNum;
  144.    }
  145. }
  146.  
  147.  
  148.  
  149. //-------------------------------------------------------------------------------
  150.  
  151. function updateContents(pageNum)
  152.     {
  153.     if(parent.contents.gsName == "bookmark")
  154.         parent.contents.updateTree(pageNum);
  155.     }
  156.  
  157.