home *** CD-ROM | disk | FTP | other *** search
/ Mega Guia 2004 June / Mega Guia: 2004-06.iso / _files / full / Fotofinish / setup.exe / HELPINDEX.JS < prev    next >
Encoding:
JavaScript  |  2004-03-31  |  1.9 KB  |  81 lines

  1. /*************************************************************************
  2.  
  3.     chm2web Help Index Library 1.01
  4.     Copyright (c) 2002-2003 A!K Research Labs (http://www.aklabs.com)  
  5.     http://chm2web.aklabs.com - HTML Help Conversion Utility
  6.  
  7.     Tested with: Internet Explorer 5, Opera 6, Mozilla 1.2, NN6
  8.  
  9.     ATTENTION! You can use this library only with web help system 
  10.                generated by chm2web software.  
  11.                
  12. **************************************************************************/
  13.  
  14.  
  15. function Startup()
  16. {
  17.   for (var i = 0; i < HelpIndex.length; i++)
  18.   {
  19.     var e = document.createElement("OPTION");
  20.     e.text = HelpIndex[i][0];
  21.     e.value = i;
  22.     document.forms[0].indexlist[document.forms[0].indexlist.length] = e;
  23.   }
  24. }
  25.  
  26. var oldS = "";
  27.  
  28. function SelectMatch(str)
  29. {
  30.   top.indexquery=str;
  31.  
  32.   var s = str.toUpperCase();
  33.   
  34.   if ((s == "") || (s == oldS))
  35.     return false;
  36.  
  37.   oldS = s;
  38.  
  39.   var re = new RegExp("^"+s, "i");
  40.  
  41.   var h = Math.floor(document.forms[0].indexlist.length/100);
  42.   var start = h*100;
  43.   var end = document.forms[0].indexlist.length - 1;
  44.  
  45.   if (h > 0)
  46.     for (var i = 0; i <= h; i++)
  47.       if (s < document.forms[0].indexlist[i*100].text.toUpperCase())
  48.       {
  49.         start = (i - 1)*100;
  50.         if (start < 0)
  51.           start = 0;
  52.         end = i*100;
  53.         break;
  54.       }
  55.  
  56.   for (var i = start; i <= end; i++) 
  57.     if (document.forms[0].indexlist[i].text.match(re))
  58.     {
  59.       document.forms[0].indexlist[i].selected = true;
  60.       return true;
  61.     }
  62.  
  63.   return false;
  64. }
  65.  
  66. function ShowMatch()
  67. {
  68.   var str = HelpIndex[document.forms[0].indexlist[document.forms[0].indexlist.selectedIndex].value][1];
  69.   if (str.substr(0, 3) == "@@@") {
  70.      str = str.substr(3); oldS = "";
  71.      SelectMatch(str);
  72.      return true;
  73.   };
  74.  
  75.   if (document.forms[0].indexlist.selectedIndex >= 0) {
  76.     open(str, "content");
  77.     return true;
  78.   } else 
  79.     return false;
  80. }
  81.