PageRenderTime 46ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/Documentation/script/hs-expandcollapse.js

#
JavaScript | 87 lines | 81 code | 5 blank | 1 comment | 24 complexity | 6d09c6205545d31e96d98de744d4c655 MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. function HSToggleSection(id)
  2. {
  3. var element;
  4. var img;
  5. // Find the element
  6. element = documentElement(id);
  7. img = documentElement(id+"_Image");
  8. if (element)
  9. {
  10. if (element.className=="hs-collapsed")
  11. {
  12. element.className="hs-expanded";
  13. if (img)
  14. {
  15. img.src = "images/hs-expanded.gif";
  16. }
  17. }
  18. else
  19. {
  20. element.className="hs-collapsed";
  21. if (img)
  22. {
  23. img.src = "images/hs-collapsed.gif";
  24. }
  25. };
  26. }
  27. }
  28. function HSHideOrShowAllCSections(show)
  29. {
  30. var spans
  31. var divs
  32. spans = document.getElementsByTagName("SPAN");
  33. if (spans)
  34. {
  35. for (var spanindex = 0 ; spanindex < spans.length ; spanindex++)
  36. {
  37. if ((spans[spanindex].className == "hs-collapsed" && show) || (spans[spanindex].className == "hs-expanded" && !show))
  38. {
  39. HSToggleSection(spans[spanindex].id)
  40. }
  41. }
  42. }
  43. divs = document.getElementsByTagName("DIV")
  44. if (divs)
  45. {
  46. for (var divindex = 0 ; divindex < divs.length ; divindex++)
  47. {
  48. if ((divs[divindex].className == "hs-collapsed" && show) || (divs[divindex].className == "hs-expanded" && !show))
  49. {
  50. HSToggleSection(divs[divindex].id)
  51. }
  52. }
  53. }
  54. }
  55. function HSHideAllCSections()
  56. {
  57. var HSHideAll = documentElement("HSHideAll");
  58. var HSShowAll = documentElement("HSShowAll");
  59. HSHideOrShowAllCSections(false)
  60. if (HSHideAll)
  61. {
  62. HSHideAll.style.display="none";
  63. if (HSShowAll)
  64. {
  65. HSShowAll.style.display="block";
  66. }
  67. }
  68. }
  69. function HSShowAllCSections()
  70. {
  71. var HSHideAll = documentElement("HSHideAll");
  72. var HSShowAll = documentElement("HSShowAll");
  73. HSHideOrShowAllCSections(true)
  74. if (HSShowAll)
  75. {
  76. HSShowAll.style.display="none";
  77. if (HSHideAll)
  78. {
  79. HSHideAll.style.display="block";
  80. }
  81. }
  82. }