Bugfixes

This fixes 4 bugs.  

One an unreported bug where a variable could be undefined. 

The second is bug 2989, where timing out would cause the text in PG editor to be html encoded.  
(This was caused by overzealous encoding in ContentGenerator.  CGI already auto encodes html emitted by form generating functions, so removing the encoding doesn't expose anything.)

The third is an old include for a jquery script we dont have and would break things if we did have it. 

The fourth is an xss fix for mathview.