PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/Documentation/script/hs-expandcollapse.js

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