Corrected a bug ocurring in Firefox

Corrected a bug ocurring in Firefox where the dom document used when parsing has to have a proper HTML doctype specified in order for getElementById() to work properly on the document.

See http://stackoverflow.com/a/7382380