}
function blur_alloc(i) {
- 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);
if (i.name != 'amount' && i.name != 'charge') {
if (change<0) change = 0;
change = change-i.getAttribute('_last');
var allocations = {
'.amount': function(e) {
- e.onblur = function() {
- blur_alloc(this);
+ if(e.name == 'allocated_amount' || e.name == 'bank_amount')
+ {
+ e.onblur = function() {
+ var dec = this.getAttribute("dec");
+ price_format(this.name, get_amount(this.name), dec);
};
- e.onfocus = function() {
- focus_alloc(this);
- };
+ } else {
+ e.onblur = function() {
+ blur_alloc(this);
+ };
+ e.onfocus = function() {
+ focus_alloc(this);
+ };
+ }
}
}