1 | function getElement(elem_str)
|
---|
2 | {
|
---|
3 | var elem;
|
---|
4 | if (document.all) {
|
---|
5 | elem = eval("document.all."+elem_str);
|
---|
6 | }
|
---|
7 | else if (document.getElementById) {
|
---|
8 | elem = document.getElementById(elem_str);
|
---|
9 | }
|
---|
10 | else if (document.layers) {
|
---|
11 | elem = eval("document."+elem_str);
|
---|
12 | }
|
---|
13 |
|
---|
14 | return elem;
|
---|
15 | }
|
---|
16 |
|
---|
17 | function getAbsoluteLeft(el) {
|
---|
18 | xPos = el.offsetLeft;
|
---|
19 | tempEl = el.offsetParent;
|
---|
20 | while (tempEl != null) {
|
---|
21 | xPos += tempEl.offsetLeft;
|
---|
22 | tempEl = tempEl.offsetParent;
|
---|
23 | }
|
---|
24 | return xPos;
|
---|
25 | }
|
---|
26 |
|
---|
27 | function getAbsoluteTop(el) {
|
---|
28 | yPos = el.offsetTop;
|
---|
29 | tempEl = el.offsetParent;
|
---|
30 | while (tempEl != null) {
|
---|
31 | yPos += tempEl.offsetTop;
|
---|
32 | tempEl = tempEl.offsetParent;
|
---|
33 | }
|
---|
34 | return yPos;
|
---|
35 | }
|
---|
36 |
|
---|
37 | function getRectLeft(el)
|
---|
38 | {
|
---|
39 | var xl;
|
---|
40 |
|
---|
41 | if (document.all) {
|
---|
42 | xl = el.style.pixelLeft;
|
---|
43 | }
|
---|
44 | else if (document.getElementById) {
|
---|
45 | xl = parseInt(el.style.left);
|
---|
46 | }
|
---|
47 | else if (document.layers) {
|
---|
48 | xl = el.left;
|
---|
49 | }
|
---|
50 |
|
---|
51 | return xl;
|
---|
52 | }
|
---|
53 |
|
---|
54 | function getRectTop(el)
|
---|
55 | {
|
---|
56 | var yt;
|
---|
57 |
|
---|
58 | if (document.all) {
|
---|
59 | yt = el.style.pixelTop;
|
---|
60 | }
|
---|
61 | else if (document.getElementById) {
|
---|
62 | yt = parseInt(el.style.top);
|
---|
63 | }
|
---|
64 | else if (document.layers) {
|
---|
65 | yt = el.top;
|
---|
66 | }
|
---|
67 |
|
---|
68 | return yt;
|
---|
69 | }
|
---|
70 |
|
---|
71 | function getRectWidth(el)
|
---|
72 | {
|
---|
73 | var width;
|
---|
74 |
|
---|
75 | if (document.all) {
|
---|
76 | width = parseInt(el.style.width);
|
---|
77 | }
|
---|
78 | else if (document.getElementById) {
|
---|
79 | width = parseInt(el.style.width);
|
---|
80 | }
|
---|
81 | else if (document.layers) {
|
---|
82 | width = el.clip.width;
|
---|
83 | }
|
---|
84 |
|
---|
85 | return width;
|
---|
86 | }
|
---|
87 |
|
---|
88 | function getRectHeight(el)
|
---|
89 | {
|
---|
90 | var height;
|
---|
91 |
|
---|
92 | if (document.all) {
|
---|
93 | height = parseInt(el.style.height);
|
---|
94 | }
|
---|
95 | else if (document.getElementById) {
|
---|
96 | height = parseInt(el.style.height);
|
---|
97 | }
|
---|
98 | else if (document.layers) {
|
---|
99 | height = el.clip.height;
|
---|
100 | }
|
---|
101 |
|
---|
102 | return height;
|
---|
103 | }
|
---|
104 |
|
---|
105 | function getRectXL(el)
|
---|
106 | {
|
---|
107 | return get_rect_left(el);
|
---|
108 | }
|
---|
109 |
|
---|
110 | function getRectXR(el)
|
---|
111 | {
|
---|
112 | var xr;
|
---|
113 |
|
---|
114 | xr = get_rect_xl(el) + get_rect_width(el) -1;
|
---|
115 |
|
---|
116 | return xr;
|
---|
117 | }
|
---|
118 |
|
---|
119 | function getRectYT(el)
|
---|
120 | {
|
---|
121 | return get_rect_top(el);
|
---|
122 | }
|
---|
123 |
|
---|
124 | function getRectYB(el)
|
---|
125 | {
|
---|
126 | var yb;
|
---|
127 |
|
---|
128 | yb = get_rect_yt(el) + get_rect_height(el) -1;
|
---|
129 |
|
---|
130 | return yb;
|
---|
131 | }
|
---|
132 |
|
---|
133 |
|
---|
134 | function setRectLeft(el,xl)
|
---|
135 | {
|
---|
136 | if (document.all) {
|
---|
137 | el.style.pixelLeft = xl;
|
---|
138 | }
|
---|
139 | else if (document.getElementById) {
|
---|
140 | el.style.left = xl + "px";
|
---|
141 | }
|
---|
142 | else if (document.layers) {
|
---|
143 | el.left = xl + "px";
|
---|
144 | }
|
---|
145 | }
|
---|
146 |
|
---|
147 | function setRectTop(el,yt)
|
---|
148 | {
|
---|
149 | if (document.all) {
|
---|
150 | el.style.pixelTop = yt;
|
---|
151 | }
|
---|
152 | else if (document.getElementById) {
|
---|
153 | el.style.top = yt + "px";
|
---|
154 | }
|
---|
155 | else if (document.layers) {
|
---|
156 | el.top = yt + "px";
|
---|
157 | }
|
---|
158 | }
|
---|
159 |
|
---|
160 | function setRectWidth(el,width)
|
---|
161 | {
|
---|
162 | if (document.all) {
|
---|
163 | el.style.width = width;
|
---|
164 | }
|
---|
165 | else if (document.getElementById) {
|
---|
166 | el.style.width = width;
|
---|
167 | }
|
---|
168 | else if (document.layers) {
|
---|
169 | el.width = width;
|
---|
170 | }
|
---|
171 | }
|
---|
172 |
|
---|
173 | function setRectHeight(el,height)
|
---|
174 | {
|
---|
175 | if (document.all) {
|
---|
176 | el.style.height = height;
|
---|
177 | }
|
---|
178 | else if (document.getElementById) {
|
---|
179 | el.style.height = height;
|
---|
180 | }
|
---|
181 | else if (document.layers) {
|
---|
182 | el.height = height;
|
---|
183 | }
|
---|
184 | }
|
---|
185 |
|
---|
186 | function hideGraphic(gr)
|
---|
187 | {
|
---|
188 | if (document.all) {
|
---|
189 | gr.style.visibility = 'hidden';
|
---|
190 | }
|
---|
191 | else if (document.getElementById) {
|
---|
192 | gr.style.visibility = 'hidden';
|
---|
193 | }
|
---|
194 | else if (document.layers) {
|
---|
195 | gr.visibility = 'hide';
|
---|
196 | }
|
---|
197 | }
|
---|
198 |
|
---|
199 | function showGraphic(gr)
|
---|
200 | {
|
---|
201 | if (document.all) {
|
---|
202 | gr.style.visibility = 'visible';
|
---|
203 | }
|
---|
204 | else if (document.getElementById) {
|
---|
205 | gr.style.visibility = 'visible';
|
---|
206 | }
|
---|
207 | else if (document.layers) {
|
---|
208 | gr.visibility = 'show';
|
---|
209 | }
|
---|
210 | }
|
---|
211 |
|
---|
212 |
|
---|
213 | function browserWidth()
|
---|
214 | {
|
---|
215 | var width = 0;
|
---|
216 |
|
---|
217 | if (self.innerWidth) {
|
---|
218 | // Netscape, Mozilla ...
|
---|
219 | width = self.innerWidth;
|
---|
220 | }
|
---|
221 | else if (document.documentElement && document.documentElement.clientWidth)
|
---|
222 | {
|
---|
223 | // IE 6 if doctype used
|
---|
224 | width = document.documentElement.clientWidth;
|
---|
225 | }
|
---|
226 | else if (document.body)
|
---|
227 | {
|
---|
228 | // Other cases for IE
|
---|
229 | width = document.body.clientWidth;
|
---|
230 | }
|
---|
231 | else {
|
---|
232 | var mess = "Unable to determin width of browser";
|
---|
233 | if (navigator.appName) {
|
---|
234 | mess += " for " + navigator.appName;
|
---|
235 | }
|
---|
236 | alert(mess);
|
---|
237 | }
|
---|
238 |
|
---|
239 | return width;
|
---|
240 | }
|
---|
241 |
|
---|
242 | function browserHeight()
|
---|
243 | {
|
---|
244 |
|
---|
245 | var height = 0;
|
---|
246 |
|
---|
247 | if (self.innerWidth) {
|
---|
248 | // Netscape, Mozilla ...
|
---|
249 | height = self.innerHeight;
|
---|
250 | }
|
---|
251 | else if (document.documentElement && document.documentElement.clientWidth)
|
---|
252 | {
|
---|
253 | // IE 6 if doctype used
|
---|
254 | height = document.documentElement.clientHeight;
|
---|
255 | }
|
---|
256 | else if (document.body)
|
---|
257 | {
|
---|
258 | // Other cases for IE
|
---|
259 | height = document.body.clientHeight;
|
---|
260 | }
|
---|
261 | else {
|
---|
262 | var mess = "Unable to determin height of browser";
|
---|
263 | if (navigator.appName) {
|
---|
264 | mess += " for " + navigator.appName;
|
---|
265 | }
|
---|
266 | alert(mess);
|
---|
267 | }
|
---|
268 |
|
---|
269 | return height;
|
---|
270 | }
|
---|
271 |
|
---|
272 | function loadUrl(url,elem_str)
|
---|
273 | {
|
---|
274 | var elem = getElement(elem_str);
|
---|
275 |
|
---|
276 | xmlhttp.open("GET",url,true);
|
---|
277 |
|
---|
278 | xmlhttp.onreadystatechange=function() {
|
---|
279 | if (xmlhttp.readyState==4) {
|
---|
280 | elem.innerHTML = xmlhttp.responseText;
|
---|
281 | }
|
---|
282 | }
|
---|
283 |
|
---|
284 | xmlhttp.setRequestHeader('Accept','message/x-formresult')
|
---|
285 | xmlhttp.send(null)
|
---|
286 |
|
---|
287 | return false
|
---|
288 | }
|
---|