<!--
// Programmer:  David Zientara
// Company:     Oxberry LLC
// Date:        January 30, 2004
// Description: Oxberry.com web site
// File name:   parse.js
// (1) Parse the full path of a file, retrieving
// only the filename
// (2) Get the file extension of a file
//-->

function get_filename_from_path( file_path )
{
   var idx = file_path.length-1;
   var return_string = new String("");

   while ( file_path.charAt(idx) != '/' && idx >= 0  )
   {     
      return_string = file_path.charAt(idx) + return_string;
      idx--;
   }

   return return_string;
}

function get_file_extension( file_path )
{
   var idx;
   var return_string = new String("");

   file_path = get_filename_from_path( file_path );
   idx = file_path.length-1;

   while ( file_path.charAt(idx) != '.' && idx >= 0 )
   {      
      return_string = file_path.charAt(idx) + return_string;
      idx--;
   }
   return_string = return_string.toLowerCase();

   return return_string;
}
