Printing Contents of a DIV

Say I have an element containing some text that I'd like to make available for printing:

With this JavaScript function I can print the contents of the (selected) div tag.

So, with jQuery I can retrieve the div's content and print it:

That's it!

Important: Remember that for the PrintSelected() function to work well in IE, the window name (second param) needs to have no spaces in it, otherwise it'll chock and the popup window won't open...

This is good:

This is bad: