Jquery.dynamic_truncate is a project mainly written in JavaScript, it's free.
Truncates a string by size of its containers width