formatting money with jquery
<p>I wrote this little snippet that should format money but its failing on the period for some reason. It keeps adding them every time ...any idea why and is there a better way of doing this</p>

<pre><code>$(".dollar").blur(function() {
    var curval = $(this).val(); 
    if ($(this).val().indexOf("$") != 0) {
        $(this).val("$" + $(this).val());
    } 
    if ($(this).val().indexOf(".") != 0){
        $(this).val($(this).val() + ".00");
    }
});
</code></pre>
