<script type="text/javascript">
function formatCurrency(usFormat) {
usFormat = usFormat.toString().replace(/\$|\,/g,'');
if(isNaN(usFormat))
usFormat = "0";
sign = (usFormat == (usFormat = Math.abs(usFormat)));
usFormat = Math.floor(usFormat*100+0.50000000001);
cents = usFormat%100;
usFormat = Math.floor(usFormat/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((usFormat.length-(1+i))/3); i++)
usFormat = usFormat.substring(0,usFormat.length-(4*i+3))+','+
usFormat.substring(usFormat.length-(4*i+3));
return (((sign)?'':'-') + '$' + usFormat + '.' + cents);
}
</script>
|