Initial code from http://code.google.com/p/jsqrencode/ and https://github.com/LazarSoft/jsqrcode