- var change = get_amount(i.name);
- price_format(i.name, change, user.pdec);
+ var change = get_amount(i.name);
+
+ if (i.name != 'amount' && i.name != 'charge' && i.name != 'discount')
+ change = Math.min(change, get_amount('maxval'+i.name.substr(6), 1))
+
+ price_format(i.name, change, user.pdec);