1 | function toggleDiv(id) { |
---|
2 | $(divId).toggle(); |
---|
3 | } |
---|
4 | |
---|
5 | function showDiv(id) { |
---|
6 | Effect.Appear(id,{duration:0.4,queue:'end'}); |
---|
7 | } |
---|
8 | |
---|
9 | function toggleBranch(divId, imageId, openImgUrl, closedImgUrl) { |
---|
10 | |
---|
11 | $(divId).toggle(); |
---|
12 | |
---|
13 | if( $(divId).visible() ) { |
---|
14 | $(imageId).src= openImgUrl; |
---|
15 | } |
---|
16 | else { |
---|
17 | $(imageId).src= closedImgUrl; |
---|
18 | } |
---|
19 | |
---|
20 | // return false; |
---|
21 | } |
---|
22 | |
---|
23 | function showElement(id) { |
---|
24 | try { |
---|
25 | if (typeof Effect != "undefined" && typeof Effect.Appear != "undefined") { |
---|
26 | if ($(id) && Element.visible(id) == false) |
---|
27 | Effect.Appear(id,{duration:0.4,queue:'end'}); |
---|
28 | } else { |
---|
29 | var el = document.getElementById(id) |
---|
30 | if (el && el.style.display == 'none') { |
---|
31 | el.style.display = 'block'; |
---|
32 | } |
---|
33 | } |
---|
34 | } catch (err) {alert(err)} |
---|
35 | return false; |
---|
36 | } |
---|
37 | |
---|
38 | function hideElement(id) { |
---|
39 | if (typeof Effect != "undefined" && typeof Effect.Fade != "undefined") { |
---|
40 | if ($(id) && Element.visible(id)) |
---|
41 | Effect.Fade(id,{duration:0.4,queue:'end'}); |
---|
42 | } else { |
---|
43 | var el = document.getElementById(id) |
---|
44 | if (el && el.style.display != 'none') { |
---|
45 | el.style.display = 'none'; |
---|
46 | } |
---|
47 | } |
---|
48 | return false; |
---|
49 | } |
---|
50 | |
---|
51 | function clearFilterPane(id) { |
---|
52 | var form = document.getElementById(id) |
---|
53 | |
---|
54 | for (var i = 0; i < form.elements.length; i++) { |
---|
55 | var el = form.elements[i] |
---|
56 | if (el.type == 'select-one') { |
---|
57 | el.selectedIndex = 0 |
---|
58 | } else if (el.type == 'text' || el.type == 'textarea') { |
---|
59 | form.elements[i].value = '' |
---|
60 | } |
---|
61 | } |
---|
62 | } |
---|
63 | |
---|
64 | function filterOpChange(id, controlId) { |
---|
65 | // id should be of the form op.propertyName |
---|
66 | if (id.slice(0, 10) == 'filter.op.') { |
---|
67 | var prop = id.substring(10) |
---|
68 | var el = document.getElementById(id) |
---|
69 | var selection = el.options[el.selectedIndex] |
---|
70 | if (el) { |
---|
71 | if (el.type == 'select-one') { |
---|
72 | if (selection.value == 'Between') { |
---|
73 | showElement('between-span-'+prop) |
---|
74 | } else { |
---|
75 | hideElement('between-span-'+prop) |
---|
76 | } |
---|
77 | } |
---|
78 | |
---|
79 | var containerName = prop+'-container' |
---|
80 | if (selection.value == 'IsNull' || selection.value == 'IsNotNull') { |
---|
81 | hideElement(controlId); |
---|
82 | // Take care of date picker fields we created. |
---|
83 | if (document.getElementById(containerName)) hideElement(containerName) |
---|
84 | } else { |
---|
85 | showElement(controlId); |
---|
86 | // Take care of date picker fields. |
---|
87 | if (document.getElementById(containerName)) showElement(containerName) |
---|
88 | } |
---|
89 | } |
---|
90 | } |
---|
91 | } |
---|
92 | |
---|
93 | function selectDefaultOperator(id) { |
---|
94 | var dropdown = document.getElementById(id) |
---|
95 | if (dropdown && dropdown.selectedIndex <= 0) { |
---|
96 | dropdown.selectedIndex = 1 |
---|
97 | } |
---|
98 | } |
---|