$dec = get_qty_dec($stock_id);
return number_format2($number, $dec);
}
+
// and get_qty_dec
function get_qty_dec($stock_id=null)
{
// Maximum precision format. Strips trailing unsignificant digits.
//
function maxprec_format($number) {
- return number_format2($number, null);
+ return number_format2($number, 'max');
}
function exrate_format($number) {
// seek element by id if there is no elemnt with given name
objElement = document.getElementsByName(id)[0] || document.getElementById(id);
if(cmd=='as') {
- eval("objElement.setAttribute('"+property+"',"+data+");");
+ eval("objElement.setAttribute('"+property+"','"+data+"');");
} else if(cmd=='up') {
// if(!objElement) alert('No element "'+id+'"');
if(objElement) {
num = num.substring(0,num.length-(4*i+3))+user.ts+
num.substring(num.length-(4*i+3));
num = ((sign)?'':'-') + num;
- if(dec!=0) num = num + user.ds + cents;
+ if(dec!=0 && (!max || cents!=0))
+ num = num + user.ds + cents;
if(label)
el.innerHTML = num;
else