Try this:

code:

kDelimiter = '.'; // switch to comma for american style

RoundToQuarter = function(x)
{
return Math.round(x*4)/4;
}

EncodeCurrency = function(x)
{
var ix = Math.floor(x);
var fx = x - ix;
fx = String(fx*100+100).substr(1);

if (ix >= 1000) {
ix = String(ix);
var len = ix.length;
var ngroups = 1 + Math.floor((len-4)/3);
var ox = '';
while (ngroups--)
{
ox = kDelimiter + ix.substr(len-3,3) + ox;
ix = ix.substr(0,len-3);
len -= 3;
}
ix += ox;
}
return ix + '.' + fx;
}

x = Math.random()*10000000+Math.random();
trace(x);

x = RoundToQuarter(x);
trace('nearest quarter:' + x);

trace('denars: ' + EncodeCurrency(x));