summaryrefslogtreecommitdiff
path: root/UI/payments/javascript/maximize_minimize.js
blob: 073484546963bbce9f87b6640782205246f502ed (plain)
  1. /******************************************************
  2.     CopyLeft DAVID MORA RODRIGUEZ
  3. CRISTIAN CEBALLOS
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  15. ********************************************************/
  16. // This function should not be called directly
  17. function maximize(element) {
  18. try {
  19. var obj = document.getElementById(element);
  20. obj.style.visibility = 'visible';
  21. obj.style.height = "60px";
  22. }
  23. catch(err) { alert("ERROR ON maximize: "+err); }
  24. }
  25. // This funciton should not be called directly
  26. function minimize(element) {
  27. try {
  28. var obj2 = document.getElementById(element);
  29. obj2.style.visibility = 'hidden';
  30. obj2.style.height = '0px';
  31. }
  32. catch(err) { alert("ERROR ON minimize: " + err); }
  33. }
  34. /* This is the handler for maximize_minimize, it is intended to be called
  35. directly this will call maximize and minimize */
  36. function maximize_minimize(element, state, img, plusimage, minusimage) {
  37. try {
  38. var obj = document.getElementById(element);
  39. var obj3 = document.getElementById(state);
  40. if ( obj.style.visibility == 'hidden' ) {
  41. img.src = minusimage;
  42. maximize(element);
  43. obj3.value = 'visible';
  44. } else {
  45. img.src = plusimage;
  46. minimize(element);
  47. obj3.value ='hidden';
  48. }
  49. } catch (err) { alert("ERROR ON maximize_minimize: " + err);}
  50. }
  51. /* This function gets the form state and set it invisible */
  52. /* Container is the element that contains the tagname elements, all of them must match the same criteria */
  53. function maximize_minimize_on_load (container, plusimage, minusimage) {
  54. var table = document.getElementById(container);
  55. var cells = table.getElementsByTagName("input");
  56. var regex = new RegExp("topaystate_");
  57. try{
  58. for (var i = 0; i < cells.length; i++) {
  59. var extra_info = cells[i].id.replace(regex,"div_topay_");
  60. var img = document.getElementById(cells[i].id.replace(regex,"button_topay_"));
  61. if (cells[i].value == '' || cells[i].value == "hidden") {
  62. maximize_minimize(extra_info , cells[i].id, img, plusimage, minusimage);
  63. }
  64. }
  65. } catch (err) { alert("ERROR ON maximize_minimize_on_load: " + err) }
  66. }