This is not the most elegant way to do it (seeing as how it's much simpler using javascript) but it works.
edit: here's a much much better way