I could help with the sorting, if you wanted it. For a site I made a few months ago the tables needed to be sortable, so I looked into the feature and found a free to use javascript file that implemented sorting. I'll go look for the site right now, actually.
Edit: Well, that didn't take long to find. It's a fairly easy to use resource, the only issue that I could see is getting the javascript passed to the browser. I'm not sure how easy KoLMafia makes it to pass .js files, if it's even possible, and if it's not then the entire .js library would need passed in the html, which is ugly. Anyway, here's the site:
http://www.kryogenix.org/code/browser/sorttable/
Edit again: Oh, and for anybody interested in my javascript alert issue, turns out that \' works perfectly well for the apostrophe. Turns out I never tried escaping it -_-. I'm still curious as to whether it's possible to get customizable pop-up pages for individual items in the relay browser, though.