Turned it into a jQuery plugin.