]> git.sur5r.net Git - openldap/blob - contrib/php3-tool/javascript/expandable-outlines.js
Remove DOS comment.
[openldap] / contrib / php3-tool / javascript / expandable-outlines.js
1         var bV=parseInt(navigator.appVersion);
2         NS4=(document.layers) ? true : false;
3         IE4=((document.all)&&(bV>=4))?true:false;
4         ver4 = (NS4 || IE4) ? true : false;
5         function expandIt(){return}
6         function expandAll(){return}
7         isExpanded = false;
8
9         function getIndex(el) {
10                 ind = null;
11                 for (i=0; i<document.layers.length; i++) {
12                         whichEl = document.layers[i];
13                         if (whichEl.id == el) {
14                                 ind = i;
15                                 break;
16                         }
17                 }
18                 return ind;
19         }
20
21         function arrange() {
22                 nextY = document.layers[firstInd].pageY + document.layers[firstInd].document.height;
23                 for (i=firstInd+1; i<document.layers.length; i++) {
24                         whichEl = document.layers[i];
25                         if (whichEl.visibility != "hide") {
26                                 whichEl.pageY = nextY;
27                                 nextY += whichEl.document.height;
28                         }
29                 }
30         }
31
32         function initIt(){
33                 if (NS4) {
34                         for (i=0; i<document.layers.length; i++) {
35                                 whichEl = document.layers[i];
36                                 if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";
37                         }
38                         arrange();
39                 }
40                 else {
41                         tempColl = document.all.tags("div");
42                         for (i=0; i<tempColl.length; i++) {
43                                 if (tempColl(i).className == "child") tempColl(i).style.display = "none";
44                         }
45                 }
46         }
47
48         function expandIt(el) {
49                 if (!ver4) return;
50                 if (IE4) {expandIE(el)} else {expandNS(el)}
51         }
52
53         function expandIE(el) { 
54                 whichEl = eval(el + "Child");
55                 whichIm = event.srcElement;
56                 if (whichEl.style.display == "none") {
57                         whichEl.style.display = "block";
58                         whichIm.src = "true.gif";               
59                 }
60                 else {
61                         whichEl.style.display = "none";
62                         whichIm.src = "false.gif";
63                 }
64         }
65
66         function expandNS(el) {
67                 whichEl = eval("document." + el + "Child");
68                 whichIm = eval("document." + el + "Parent.document.images['imEx']");
69                 if (whichEl.visibility == "hide") {
70                         whichEl.visibility = "show";
71                         whichIm.src = "true.gif";
72                 }
73                 else {
74                         whichEl.visibility = "hide";
75                         whichIm.src = "false.gif";
76                 }
77                 arrange();
78         }
79
80         function showAll() {
81                 for (i=firstInd; i<document.layers.length; i++) {
82                         whichEl = document.layers[i];
83                         whichEl.visibility = "show";
84                 }
85         }
86
87         function expandAll(isBot) {
88                 newSrc = (isExpanded) ? "false.gif" : "true.gif";
89         
90                 if (NS4) {
91                 document.images["imEx"].src = newSrc;
92                         for (i=firstInd; i<document.layers.length; i++) {
93                                 whichEl = document.layers[i];
94                                 if (whichEl.id.indexOf("Parent") != -1) {
95                                         whichEl.document.images["imEx"].src = newSrc;
96                                 }
97                                 if (whichEl.id.indexOf("Child") != -1) {
98                                         whichEl.visibility = (isExpanded) ? "hide" : "show";
99                                 }
100                         }
101         
102                         arrange();
103                         if (isBot && isExpanded) scrollTo(0,document.layers[firstInd].pageY);
104                 }
105                 else {
106                         divColl = document.all.tags("div");
107                         for (i=0; i<divColl.length; i++) {
108                                 if (divColl(i).className == "child") {
109                                         divColl(i).style.display = (isExpanded) ? "none" : "block";
110                                 }
111                         }
112                         imColl = document.images.item("imEx");
113                         for (i=0; i<imColl.length; i++) {
114                                 imColl(i).src = newSrc;
115                         }
116                 }
117         
118                 isExpanded = !isExpanded;
119         }
120
121 with (document) {
122         write("<style type='text/css'>");
123         if (NS4) {
124                 write(".parent {position:absolute; visibility:hidden}");
125                 write(".child {position:absolute; visibility:hidden}");
126                 write(".regular {position:absolute; visibility:hidden}")
127         }
128         else {
129                 write(".child {display:none}")
130         }
131         write("</style>\n");
132 }
133 onload = initIt;