Ported to JavaScript, Added decode check for validity.

Added 'tag_encode.js', a JavaScript port of the conversion functions
that could be used as-is, or copied into a Node.js library (or
whatever).

Also, added a check (with exception thrown) if the string tag being
decoded isn't valid (checked by re-encoding it and checking that the
re-encoded string matches the original).

When testing this addition, I discovered that the '20A' and '21A' test
strings in the test program *weren't* actually valid!  Those have been
changed to valid test strings '30A' and '31A'.