var TITEMS = [ 
 ["Introduction", "./html/introduction.htm", "1",
  ["What is ISO Commander?", "./html/what_is_iso_commander_.htm", "11"]
 ],
 ["Using ISO Commander", "./html/using_iso_commander.htm", "1",
  ["Quick start", "./html/quick_start.htm", "1",
   ["Copy CD disc into ISO image", "./html/copy_cd_disc_into_iso_image.htm", "11"],
   ["Open CD disc as an image", "./html/open_cd_disc_as_an_image.htm", "11"],
   ["Delete and add file(s) and/or folder(s)", "./html/delete_and_add_file(s)_and_or_folder(s).htm", "11"],
   ["Find in the image", "./html/find_in_the_image.htm", "11"]
  ],
  ["Program interface", "./html/program_interface.htm", "1",
   ["Main window", "./html/main_window.htm", "11"],
   ["Menu", "./html/menu.htm", "11"],
   ["Toolbar", "./html/toolbar.htm", "11"],
   ["Program preferences", "./html/program_preferences.htm", "11"],
   ["File/folder info", "./html/file_folder_info.htm", "11"],
   ["ISO info", "./html/iso_info.htm", "11"]
  ]
 ],
 ["Common information", "./html/common_information.htm", "1",
  ["License", "./html/license.htm", "11"],
  ["How to buy ISO Commander", "./html/how_to_buy_iso_commander.htm", "11"]
 ],
 ["Technical information", "./html/technical_information.htm", "1",
  ["Some words about bootable discs", "./html/some_words_about_bootable_discs.htm", "11"],
  ["F.A.Q.", "./html/f_a_q_.htm", "11"],
  ["Glossary ", "./html/glossary.htm", "11"]
 ]
];


function arr_flatten (x) {
   var y = []; if (x == null) return y;
   for (var i=0; i<x.length; i++) {
      if (typeof(x[i]) == "object") {
         var flat = arr_flatten(x[i]);
         for (var j=0; j<flat.length; j++)
             y[y.length]=flat[j];
      } else {
         if ((i%3==0) && (x[i+1] != null))
          y[y.length]=x[i+1];
      }
   }
   return y;
}

function arr_findNext (url, cnt)
{
   var y = arr_flatten(TITEMS);
   for (var i = 0; i<y.length; i++) {
     if (y[i] == url) {
       ni = i + cnt;
       if (ni < 0) ni = 0;
       if (ni > y.length-1) ni = y.length-1;

       return y[ni];
     }
   }
   return "";
}
