Number & Currency Auto Formatting in Javascript

Hi Guys. Its been long since I have added a new post. But here I am with something that might be of use for you.
Its a very small Javascript library built by me which could be used to auto format the text that is being entered into a Textbox to correspond to American numeral system. It can be used to format the entered value on both onkeyup and onchange events.

Checkout the live working example
Enter any value here :-

The Code goes on something like this