Hexadecimal exercise and math util func for converting to hex

I wrote an exercise for converting decimal to hexadecimal by starting with the decimal to binary exercise (http://sandcastle.khanacademy.org/media/castles/smenks13:binaryNumbers/exercises/binary_numbers.html) and generalizing the graphie code.
I don't know the state of the binary exercises, but my generalized code might be useful for the binary - I made constants for alignment, number of digits, and base so that it can be more easily adjusted.

Several things still need work though:
1) I don't actually think the sliding-on-a-line interface works as well for hexadecimal as it does for binary. I'm thinking just <input>s would be better, but I couldn't see how to inject arbitary HTML into a graphie.
2) The spacing could be better, I don't quite have my head around the graphie axis system.
3) I wasn't sure what type the answer should be -- a hexadecimal number can have lower-case or upper-case letters, so it should really be a case-insensitive string. What's best for that?

Thanks!