I haven't tried to follow this code, but others may find this interesting: http://blog.stevenlevithan.com/archives/javascript-roman-numeral-converter