Fix browser compatibility issues. Works in IE7.

These are some issues we've fixed on our local fork of OpenspendingJS for http://data.gov.uk, as we have a firm requirement on IE7 compatibility. Sending these fixes upstream as they are pretty trivial and very helpful to some :-)