function currencyFormat(amount)
{
 amount += "";
 var x = amount.split('.');
 var x1 = x[0];
 var x2 = x.length > 1 ? "." + x[1] : "";
 var rgx = /(\d+)(\d{3})/;

 while (rgx.test(x1)) {
  x1 = x1.replace(rgx, "$1" + "," + "$2");
 }

 return x1 + x2;
}


function centFormat(amount) 
{
    amount -= 0;
    
    return (amount == Math.floor(amount)) ? amount + '.00' : ((amount * 10 == Math.floor(amount * 10)) ? amount + '0' : amount);
}

function RoundOff(x, y) 
{
    var scale = Math.pow(10, y);
    
    return Math.round(x * scale) / scale;
}
