Fixes for JavaScript in member booking with set limit
[mailer.git] / templates / de / html / js / js_surfbar_member_book.tpl
1 var limit       = document.getElementById('limit');
2 var span        = document.getElementById('span_limit');
3 var limited_no  = document.getElementById('limited_no');
4 var limited_yes = document.getElementById('limited_yes');
5
6 var old_limit   = 0;
7
8 function focusLimitedNo () {
9         if ((limit.value > 0) && (limit.value != '-')) {
10                 old_limit = limit.value;
11         }
12         limited_no.focus();
13         limited_yes.blur();
14         limit.disabled = true;
15         limit.setAttribute('class', 'disabled');
16         limit.value = '-';
17         return true;
18 }
19
20 function focusLimitedYes () {
21         limit.disabled = false;
22         limit.setAttribute('class', 'form_field');
23         limit.style.textAlign = 'left';
24         if (old_limit > 0) {
25                 limit.value = old_limit;
26         } else {
27                 limit.value = '';
28         }
29         limit.focus();
30         return true;
31 }
32
33 function changeLimited () {
34         if ((limit.value == '') || (limit.value == 0)) {
35                 focusLimitedNo();
36         }
37         return true;
38 }
39
40 function focusLimit () {
41         limited_yes.focus();
42         limited_no.blur();
43         limit.focus();
44         if (limit.value == '-') {
45                 limit.value = '';
46         }
47         return true;
48 }
49
50 function blurLimit () {
51         if ((limit.value == '') || (limit.value == 0)) {
52                 limit.value = '-';
53         }
54         return true;
55 }
56
57 function submitForm () {
58         if (limit.value == '-') {
59                 limit.value = 0;
60         }
61         return true;
62 }
63
64 function resetForm () {
65         old_limit = 0;
66         focusLimitedNo();
67         return true;
68 }
69
70 focusLimitedNo();