Fix accidental execution of document.write() after document load

Issue: http://stackoverflow.com/questions/2360076/javascript-document-write-replaces-all-body-content-when-using-ajax

You can't use document.write once the document has completed loading.
If you do, the browser will open a new document that replaces
the current.

Same goes for using wrapping functions like jQuery.wrapInner().