Drupal has a standard script to do this, see http://drupal.org/project/issues/date?status=All for instance. You might be able to pick apart the source code to adapt it to your needs.
- [jQuery] How can I freeze the title row i... Matt Wilson
- [jQuery] Re: How can I freeze the ti... Andy Matthews
- [jQuery] Re: How can I freeze th... Liam Potter
- [jQuery] Re: How can I freeze the ti... Jonathan Vanherpe (T & T NV)
- [jQuery] Re: How can I freeze the ti... JohnZ
- [jQuery] Re: How can I freeze th... Liam Potter
- [jQuery] Re: How can I freeze the ti... aquaone
- [jQuery] Re: How can I freeze the ti... Matt Kruse
- [jQuery] Re: How can I freeze th... jlcox