What you need is called 'natural order string comparaison', and there are several implementations in javascript floating about. Here's two:
http://sourcefrog.net/projects/natsort/natcompare.js http://my.opera.com/GreyWyvern/blog/index.dml/tag/natural%20sort -- <http://forum.pspad.com/read.php?2,44912,44917> PSPad freeware editor http://www.pspad.com
