

/* This funcrtion reads the Skipto notaion of your url,
   which is a simple CGI like Mecanisum you can use that
   doesn't require CGI to work, since most browsers simply
   ingnore any "html bookmarks" (Named Ancor tags, not 
   browser based bookmarks) that are not located. We can
   then lookup the requested bookbark and use it. */

function GetHtmlBookmark()
{
  return location.hash.substring(1);
}


/* This functions finds the first instance. 
   An incorrect lookup returns -1, which
   should casue script death.
*/

function rFindFirst(aDB, aFeild, aValue)
{
  for (i = 0; i < aDB.length; i++)
  {
    if (aDB[i][aFeild] == aValue) 
    {
      return i;
    }
  }
  return -1;
} 



/* This functions finds the first instance.  
   An incorrect lookup returns 0, which
   should NOT casue script death.
*/
function FindFirst(aDB, aFeild, aValue)
{
  Safe = rFindFirst(aDB, aFeild, aValue);
  if (Safe == -1)
  {
    Safe = 0;
  }
  return Safe;
}





/* This functions finds the Last instance 
   If an incorrect lookup returns -1, which
   should casue script death.
*/

function rFindLast(aDB, aFeild, aValue)
{
  for (i = aDB.length-1; i >= 0; i--)
  {
    if (aDB[i][aFeild] == aValue) 
    {
      return i;
    }
  }
  return -1;
}


/* This functions finds the Last instance  
   An incorrect lookup returns 0, which
   should NOT casue script death.
*/
function FindLast(aDB, aFeild, aValue)
{
  Safe = rFindLast(aDB, aFeild, aValue);
  if (Safe == -1)
  {
    Safe = 0;
  }
  return Safe;
}
 