Print Preview with CSS and Javascript

I ran into a need for a print preview on my website the other day and was unable to find a quick solution, so with a little thought I whipped up a small function which does just that with CSS and Javascript. Here's what I come up with: Pretty simple theory.. just toggle the media attribute of the link tags from "print" to "all". Maybe a little dumb,.. but very practical. View Example