HFS includes a function for getting file names... Try using it in your onclick. You'll find it in the standard lib.js.
function getItemName(el) {
if (typeof el == 'undefined')
return false;
// we handle elements, not jquery sets
if (el.jquery)
if (el.size())
el = el[0];
else
return false;
// take the url, and ignore any #anchor part
var s = el.getAttribute('href') || el.getAttribute('value');
s = s.split('#')[0];
// remove protocol and hostname
var i = s.indexOf('://');
if (i > 0)
s = s.slice(s.indexOf('/',i+3));
// current folder is specified. Remove it.
if (s.indexOf(HFS.folder) == 0)
s = s.slice(HFS.folder.length);
// folders have a trailing slash that's not truly part of the name
if (s.slice(-1) == '/')
s = s.slice(0,-1);
// it is encoded
s = (decodeURIComponent || unescape)(s);
return s;
} // getItemName