1 function focus_alloc(i) {
3 i.setAttribute('_last', get_amount(i.name));
6 function blur_alloc(i) {
7 var change = get_amount(i.name);
8 price_format(i.name, change, user.pdec);
9 if(change<0) change = 0;
10 change = change-i.getAttribute('_last');
11 var total = get_amount('total_allocated', 1)+change;
12 var left = get_amount('left_to_allocate', 1)-change;
14 price_format('left_to_allocate', left, user.pdec, 1, 1);
15 price_format('total_allocated', total, user.pdec, 1, 1);
18 function allocate_all(doc) {
19 var amount = get_amount('amount'+doc);
20 var unallocated = get_amount('un_allocated'+doc);
21 var total = get_amount('total_allocated', 1);
22 var left = get_amount('left_to_allocate', 1);
23 total -= (amount-unallocated);
24 left += (amount-unallocated);
31 price_format('amount'+doc, amount, user.pdec);
32 price_format('left_to_allocate', left, user.pdec, 1,1);
33 price_format('total_allocated', total, user.pdec, 1, 1);
36 function allocate_none(doc) {
37 amount = get_amount('amount'+doc);
38 left = get_amount('left_to_allocate', 1);
39 total = get_amount('total_allocated', 1);
40 price_format('left_to_allocate',amount+left, user.pdec, 1, 1);
41 price_format('amount'+doc, 0, user.pdec);
42 price_format('total_allocated', total-amount, user.pdec, 1, 1);
46 '.amount': function(e) {
47 e.onblur = function() {
50 e.onfocus = function() {
56 Behaviour.register(allocations);