var TITEMS = [ 
 ["About Contact Manager", "cm-about.html", "9"],
 ["Using the Contact Manager", "using.html", "2",
  ["Access Contact Manager", "cm-accessing.html", "11"],
  ["Contact List", "cm-list.html", "11"],
  ["Campaigns", "cm-campaign.html", "11"],
  ["New Contact", "cm-newcontact.html", "11"],
  ["Admin", "admin.html", "11"],
  ["Contact Reports", "cm-reports.html", "11"],
  ["Contact Sync", "cm-sync.html", "11"],
  ["Track Time", "TrackTime.html", "11"]
 ],
 ["Using Account Manager", "amusing.html", "2",
  ["Access Account Manager", "am-accessing.html", "11"],
  ["Account List", "am-list.html", "11"],
  ["Opportunities", "am-opps.html", "11"],
  ["New Account", "am-newaccount.html", "11"],
  ["Admin", "admin.html", "11"],
  ["Account Reports", "am-reports.html", "11"],
  ["Account Sync", "am-sync.html", "11"]
 ],
 ["Administration of Manager", "admin.html", "2",
  ["Configure  Fixed Fields", "cm-fixedfields.html", "11"],
  ["Configure User-Defined Fields", "cm-udfs.html", "11"],
  ["Configure Child Objects", "cm-childobjects.html", "11"],
  ["Configure Section Names", "cm-sectionnames.html", "11"],
  ["Pulblish Contact Input Form", "cm-publish.html", "11"],
  ["Position  Fields", "cm-position.html", "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 "";
}

