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