From http://www.webtoolkit.info/javascript-base64.html