I have a javascript function that works well with positive number but when input the negative number it alert `NaN`:

```
function formatMoney(number) {
        number = parseFloat(number.toString().match(/^\d+\.?\d{0,2}/));
        //Seperates the components of the number
        var components = (Math.floor(number * 100) / 100).toString().split(".");
        //Comma-fies the first part
        components [0] = components [0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
        //Combines the two sections
        return components.join(".");
    }
alert(formatMoney(-11));

```

Here is the example in jsFiddle
<http://jsfiddle.net/longvu/wRYsU/>

thanks for any help