added thumbnail preview for Publish/Edit form

Also simplified some of the jQuery class toggling code.