I had the same problem, where it just didn't do what i wanted.
I fixed it myself in the enclosed project. I also wanted to create a javascript that would have all logic in client actions so i could debug it.
Its also better understandable that way. The Javascript only creates the component and the events.
Ofcourse i do hope you get an answer that will explain how to use the Input Mask library.