##// END OF EJS Templates
HTML select tags are no longer hidden with IE7 when showing navigation drop-down menu....
Jean-Philippe Lang -
r497:10a49d476d93
parent child
Show More
@@ -1,556 +1,556
1 //*****************************************************************************
1 //*****************************************************************************
2 // Do not remove this notice.
2 // Do not remove this notice.
3 //
3 //
4 // Copyright 2000-2004 by Mike Hall.
4 // Copyright 2000-2004 by Mike Hall.
5 // See http://www.brainjar.com for terms of use.
5 // See http://www.brainjar.com for terms of use.
6 //*****************************************************************************
6 //*****************************************************************************
7
7
8 //----------------------------------------------------------------------------
8 //----------------------------------------------------------------------------
9 // Emulation de la fonction push pour IE5.0
9 // Emulation de la fonction push pour IE5.0
10 //----------------------------------------------------------------------------
10 //----------------------------------------------------------------------------
11 if(!Array.prototype.push){Array.prototype.push=function(){for(var i=0;i<arguments.length;i++)this[this.length]=arguments[i];};};
11 if(!Array.prototype.push){Array.prototype.push=function(){for(var i=0;i<arguments.length;i++)this[this.length]=arguments[i];};};
12
12
13 //----------------------------------------------------------------------------
13 //----------------------------------------------------------------------------
14 // Code to determine the browser and version.
14 // Code to determine the browser and version.
15 //----------------------------------------------------------------------------
15 //----------------------------------------------------------------------------
16
16
17 function Browser() {
17 function Browser() {
18
18
19 var ua, s, i;
19 var ua, s, i;
20
20
21 this.isIE = false; // Internet Explorer
21 this.isIE = false; // Internet Explorer
22 this.isOP = false; // Opera
22 this.isOP = false; // Opera
23 this.isNS = false; // Netscape
23 this.isNS = false; // Netscape
24 this.version = null;
24 this.version = null;
25 //-- debut ajout ci ----
25 //-- debut ajout ci ----
26 this.isIE5mac = false; // Internet Explorer 5 mac
26 this.isIE5mac = false; // Internet Explorer 5 mac
27 //-- fin ajout ci ----
27 //-- fin ajout ci ----
28
28
29 ua = navigator.userAgent;
29 ua = navigator.userAgent;
30
30
31 //-- debut ajout ci ----
31 //-- debut ajout ci ----
32 if (ua.indexOf("Opera")==-1 && ua.indexOf("MSIE 5")>-1 && ua.indexOf("Mac")>-1) {
32 if (ua.indexOf("Opera")==-1 && ua.indexOf("MSIE 5")>-1 && ua.indexOf("Mac")>-1) {
33 this.isIE5mac = true;
33 this.isIE5mac = true;
34 this.version = "";
34 this.version = "";
35 return;
35 return;
36 }
36 }
37 //-- fin ajout ci ----
37 //-- fin ajout ci ----
38
38
39 s = "Opera";
39 s = "Opera";
40 if ((i = ua.indexOf(s)) >= 0) {
40 if ((i = ua.indexOf(s)) >= 0) {
41 this.isOP = true;
41 this.isOP = true;
42 this.version = parseFloat(ua.substr(i + s.length));
42 this.version = parseFloat(ua.substr(i + s.length));
43 return;
43 return;
44 }
44 }
45
45
46 s = "Netscape6/";
46 s = "Netscape6/";
47 if ((i = ua.indexOf(s)) >= 0) {
47 if ((i = ua.indexOf(s)) >= 0) {
48 this.isNS = true;
48 this.isNS = true;
49 this.version = parseFloat(ua.substr(i + s.length));
49 this.version = parseFloat(ua.substr(i + s.length));
50 return;
50 return;
51 }
51 }
52
52
53 // Treat any other "Gecko" browser as Netscape 6.1.
53 // Treat any other "Gecko" browser as Netscape 6.1.
54
54
55 s = "Gecko";
55 s = "Gecko";
56 if ((i = ua.indexOf(s)) >= 0) {
56 if ((i = ua.indexOf(s)) >= 0) {
57 this.isNS = true;
57 this.isNS = true;
58 this.version = 6.1;
58 this.version = 6.1;
59 return;
59 return;
60 }
60 }
61
61
62 s = "MSIE";
62 s = "MSIE";
63 if ((i = ua.indexOf(s))) {
63 if ((i = ua.indexOf(s))) {
64 this.isIE = true;
64 this.isIE = true;
65 this.version = parseFloat(ua.substr(i + s.length));
65 this.version = parseFloat(ua.substr(i + s.length));
66 return;
66 return;
67 }
67 }
68 }
68 }
69
69
70 var browser = new Browser();
70 var browser = new Browser();
71
71
72 //----------------------------------------------------------------------------
72 //----------------------------------------------------------------------------
73 // Code for handling the menu bar and active button.
73 // Code for handling the menu bar and active button.
74 //----------------------------------------------------------------------------
74 //----------------------------------------------------------------------------
75
75
76 var activeButton = null;
76 var activeButton = null;
77
77
78
78
79 function buttonClick(event, menuId) {
79 function buttonClick(event, menuId) {
80
80
81 var button;
81 var button;
82
82
83 // Get the target button element.
83 // Get the target button element.
84
84
85 if (browser.isIE)
85 if (browser.isIE)
86 button = window.event.srcElement;
86 button = window.event.srcElement;
87 else
87 else
88 button = event.currentTarget;
88 button = event.currentTarget;
89
89
90 // Blur focus from the link to remove that annoying outline.
90 // Blur focus from the link to remove that annoying outline.
91
91
92 button.blur();
92 button.blur();
93
93
94 // Associate the named menu to this button if not already done.
94 // Associate the named menu to this button if not already done.
95 // Additionally, initialize menu display.
95 // Additionally, initialize menu display.
96
96
97 if (button.menu == null) {
97 if (button.menu == null) {
98 button.menu = document.getElementById(menuId);
98 button.menu = document.getElementById(menuId);
99 if (button.menu.isInitialized == null)
99 if (button.menu.isInitialized == null)
100 menuInit(button.menu);
100 menuInit(button.menu);
101 }
101 }
102
102
103 // Set mouseout event handler for the button, if not already done.
103 // Set mouseout event handler for the button, if not already done.
104
104
105 if (button.onmouseout == null)
105 if (button.onmouseout == null)
106 button.onmouseout = buttonOrMenuMouseout;
106 button.onmouseout = buttonOrMenuMouseout;
107
107
108 // Exit if this button is the currently active one.
108 // Exit if this button is the currently active one.
109
109
110 if (button == activeButton)
110 if (button == activeButton)
111 return false;
111 return false;
112
112
113 // Reset the currently active button, if any.
113 // Reset the currently active button, if any.
114
114
115 if (activeButton != null)
115 if (activeButton != null)
116 resetButton(activeButton);
116 resetButton(activeButton);
117
117
118 // Activate this button, unless it was the currently active one.
118 // Activate this button, unless it was the currently active one.
119
119
120 if (button != activeButton) {
120 if (button != activeButton) {
121 depressButton(button);
121 depressButton(button);
122 activeButton = button;
122 activeButton = button;
123 }
123 }
124 else
124 else
125 activeButton = null;
125 activeButton = null;
126
126
127 return false;
127 return false;
128 }
128 }
129
129
130 function buttonMouseover(event, menuId) {
130 function buttonMouseover(event, menuId) {
131
131
132 var button;
132 var button;
133 //-- debut ajout ci ----
133 //-- debut ajout ci ----
134 if (!browser.isIE5mac) {
134 if (!browser.isIE5mac) {
135 //-- fin ajout ci ----
135 //-- fin ajout ci ----
136
136
137 //-- debut ajout ci ----
137 //-- debut ajout ci ----
138 cicacheselect();
138 cicacheselect();
139 //-- fin ajout ci ----
139 //-- fin ajout ci ----
140
140
141 // Activates this button's menu if no other is currently active.
141 // Activates this button's menu if no other is currently active.
142
142
143 if (activeButton == null) {
143 if (activeButton == null) {
144 buttonClick(event, menuId);
144 buttonClick(event, menuId);
145 return;
145 return;
146 }
146 }
147
147
148 // Find the target button element.
148 // Find the target button element.
149
149
150 if (browser.isIE)
150 if (browser.isIE)
151 button = window.event.srcElement;
151 button = window.event.srcElement;
152 else
152 else
153 button = event.currentTarget;
153 button = event.currentTarget;
154
154
155 // If any other button menu is active, make this one active instead.
155 // If any other button menu is active, make this one active instead.
156
156
157 if (activeButton != null && activeButton != button)
157 if (activeButton != null && activeButton != button)
158 buttonClick(event, menuId);
158 buttonClick(event, menuId);
159 //-- debut ajout ci ----
159 //-- debut ajout ci ----
160 }
160 }
161 //-- fin ajout ci ----
161 //-- fin ajout ci ----
162
162
163 }
163 }
164
164
165 function depressButton(button) {
165 function depressButton(button) {
166
166
167 var x, y;
167 var x, y;
168
168
169 // Update the button's style class to make it look like it's
169 // Update the button's style class to make it look like it's
170 // depressed.
170 // depressed.
171
171
172 button.className += " menuButtonActive";
172 button.className += " menuButtonActive";
173
173
174 // Set mouseout event handler for the button, if not already done.
174 // Set mouseout event handler for the button, if not already done.
175
175
176 if (button.onmouseout == null)
176 if (button.onmouseout == null)
177 button.onmouseout = buttonOrMenuMouseout;
177 button.onmouseout = buttonOrMenuMouseout;
178 if (button.menu.onmouseout == null)
178 if (button.menu.onmouseout == null)
179 button.menu.onmouseout = buttonOrMenuMouseout;
179 button.menu.onmouseout = buttonOrMenuMouseout;
180
180
181 // Position the associated drop down menu under the button and
181 // Position the associated drop down menu under the button and
182 // show it.
182 // show it.
183
183
184 x = getPageOffsetLeft(button);
184 x = getPageOffsetLeft(button);
185 y = getPageOffsetTop(button) + button.offsetHeight - 1;
185 y = getPageOffsetTop(button) + button.offsetHeight - 1;
186
186
187 // For IE, adjust position.
187 // For IE, adjust position.
188
188
189 if (browser.isIE) {
189 if (browser.isIE) {
190 x += button.offsetParent.clientLeft;
190 x += button.offsetParent.clientLeft;
191 y += button.offsetParent.clientTop;
191 y += button.offsetParent.clientTop;
192 }
192 }
193
193
194 button.menu.style.left = x + "px";
194 button.menu.style.left = x + "px";
195 button.menu.style.top = y + "px";0
195 button.menu.style.top = y + "px";0
196 button.menu.style.visibility = "visible";
196 button.menu.style.visibility = "visible";
197 }
197 }
198
198
199 function resetButton(button) {
199 function resetButton(button) {
200
200
201 // Restore the button's style class.
201 // Restore the button's style class.
202
202
203 removeClassName(button, "menuButtonActive");
203 removeClassName(button, "menuButtonActive");
204
204
205 // Hide the button's menu, first closing any sub menus.
205 // Hide the button's menu, first closing any sub menus.
206
206
207 if (button.menu != null) {
207 if (button.menu != null) {
208 closeSubMenu(button.menu);
208 closeSubMenu(button.menu);
209 button.menu.style.visibility = "hidden";
209 button.menu.style.visibility = "hidden";
210 }
210 }
211 }
211 }
212
212
213 //----------------------------------------------------------------------------
213 //----------------------------------------------------------------------------
214 // Code to handle the menus and sub menus.
214 // Code to handle the menus and sub menus.
215 //----------------------------------------------------------------------------
215 //----------------------------------------------------------------------------
216
216
217 function menuMouseover(event) {
217 function menuMouseover(event) {
218
218
219 var menu;
219 var menu;
220 //-- debut ajout ci ----
220 //-- debut ajout ci ----
221 if (!browser.isIE5mac) {
221 if (!browser.isIE5mac) {
222 //-- fin ajout ci ----
222 //-- fin ajout ci ----
223 //-- debut ajout ci ----
223 //-- debut ajout ci ----
224 cicacheselect();
224 cicacheselect();
225 //-- fin ajout ci ----
225 //-- fin ajout ci ----
226
226
227 // Find the target menu element.
227 // Find the target menu element.
228 if (browser.isIE)
228 if (browser.isIE)
229 menu = getContainerWith(window.event.srcElement, "DIV", "menu");
229 menu = getContainerWith(window.event.srcElement, "DIV", "menu");
230 else
230 else
231 menu = event.currentTarget;
231 menu = event.currentTarget;
232
232
233 // Close any active sub menu.
233 // Close any active sub menu.
234
234
235 if (menu.activeItem != null)
235 if (menu.activeItem != null)
236 closeSubMenu(menu);
236 closeSubMenu(menu);
237 //-- debut ajout ci ----
237 //-- debut ajout ci ----
238 }
238 }
239 //-- fin ajout ci ----
239 //-- fin ajout ci ----
240 }
240 }
241
241
242 function menuItemMouseover(event, menuId) {
242 function menuItemMouseover(event, menuId) {
243
243
244 var item, menu, x, y;
244 var item, menu, x, y;
245 //-- debut ajout ci ----
245 //-- debut ajout ci ----
246 cicacheselect();
246 cicacheselect();
247 //-- fin ajout ci ----
247 //-- fin ajout ci ----
248
248
249 // Find the target item element and its parent menu element.
249 // Find the target item element and its parent menu element.
250
250
251 if (browser.isIE)
251 if (browser.isIE)
252 item = getContainerWith(window.event.srcElement, "A", "menuItem");
252 item = getContainerWith(window.event.srcElement, "A", "menuItem");
253 else
253 else
254 item = event.currentTarget;
254 item = event.currentTarget;
255 menu = getContainerWith(item, "DIV", "menu");
255 menu = getContainerWith(item, "DIV", "menu");
256
256
257 // Close any active sub menu and mark this one as active.
257 // Close any active sub menu and mark this one as active.
258
258
259 if (menu.activeItem != null)
259 if (menu.activeItem != null)
260 closeSubMenu(menu);
260 closeSubMenu(menu);
261 menu.activeItem = item;
261 menu.activeItem = item;
262
262
263 // Highlight the item element.
263 // Highlight the item element.
264
264
265 item.className += " menuItemHighlight";
265 item.className += " menuItemHighlight";
266
266
267 // Initialize the sub menu, if not already done.
267 // Initialize the sub menu, if not already done.
268
268
269 if (item.subMenu == null) {
269 if (item.subMenu == null) {
270 item.subMenu = document.getElementById(menuId);
270 item.subMenu = document.getElementById(menuId);
271 if (item.subMenu.isInitialized == null)
271 if (item.subMenu.isInitialized == null)
272 menuInit(item.subMenu);
272 menuInit(item.subMenu);
273 }
273 }
274
274
275 // Set mouseout event handler for the sub menu, if not already done.
275 // Set mouseout event handler for the sub menu, if not already done.
276
276
277 if (item.subMenu.onmouseout == null)
277 if (item.subMenu.onmouseout == null)
278 item.subMenu.onmouseout = buttonOrMenuMouseout;
278 item.subMenu.onmouseout = buttonOrMenuMouseout;
279
279
280 // Get position for submenu based on the menu item.
280 // Get position for submenu based on the menu item.
281
281
282 x = getPageOffsetLeft(item) + item.offsetWidth;
282 x = getPageOffsetLeft(item) + item.offsetWidth;
283 y = getPageOffsetTop(item);
283 y = getPageOffsetTop(item);
284
284
285 // Adjust position to fit in view.
285 // Adjust position to fit in view.
286
286
287 var maxX, maxY;
287 var maxX, maxY;
288
288
289 if (browser.isIE) {
289 if (browser.isIE) {
290 maxX = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) +
290 maxX = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) +
291 (document.documentElement.clientWidth != 0 ? document.documentElement.clientWidth : document.body.clientWidth);
291 (document.documentElement.clientWidth != 0 ? document.documentElement.clientWidth : document.body.clientWidth);
292 maxY = Math.max(document.documentElement.scrollTop, document.body.scrollTop) +
292 maxY = Math.max(document.documentElement.scrollTop, document.body.scrollTop) +
293 (document.documentElement.clientHeight != 0 ? document.documentElement.clientHeight : document.body.clientHeight);
293 (document.documentElement.clientHeight != 0 ? document.documentElement.clientHeight : document.body.clientHeight);
294 }
294 }
295 if (browser.isOP) {
295 if (browser.isOP) {
296 maxX = document.documentElement.scrollLeft + window.innerWidth;
296 maxX = document.documentElement.scrollLeft + window.innerWidth;
297 maxY = document.documentElement.scrollTop + window.innerHeight;
297 maxY = document.documentElement.scrollTop + window.innerHeight;
298 }
298 }
299 if (browser.isNS) {
299 if (browser.isNS) {
300 maxX = window.scrollX + window.innerWidth;
300 maxX = window.scrollX + window.innerWidth;
301 maxY = window.scrollY + window.innerHeight;
301 maxY = window.scrollY + window.innerHeight;
302 }
302 }
303 maxX -= item.subMenu.offsetWidth;
303 maxX -= item.subMenu.offsetWidth;
304 maxY -= item.subMenu.offsetHeight;
304 maxY -= item.subMenu.offsetHeight;
305
305
306 if (x > maxX)
306 if (x > maxX)
307 x = Math.max(0, x - item.offsetWidth - item.subMenu.offsetWidth
307 x = Math.max(0, x - item.offsetWidth - item.subMenu.offsetWidth
308 + (menu.offsetWidth - item.offsetWidth));
308 + (menu.offsetWidth - item.offsetWidth));
309 y = Math.max(0, Math.min(y, maxY));
309 y = Math.max(0, Math.min(y, maxY));
310
310
311 // Position and show the sub menu.
311 // Position and show the sub menu.
312
312
313 item.subMenu.style.left = x + "px";
313 item.subMenu.style.left = x + "px";
314 item.subMenu.style.top = y + "px";
314 item.subMenu.style.top = y + "px";
315 item.subMenu.style.visibility = "visible";
315 item.subMenu.style.visibility = "visible";
316
316
317 // Stop the event from bubbling.
317 // Stop the event from bubbling.
318
318
319 if (browser.isIE)
319 if (browser.isIE)
320 window.event.cancelBubble = true;
320 window.event.cancelBubble = true;
321 else
321 else
322 event.stopPropagation();
322 event.stopPropagation();
323 }
323 }
324
324
325 function closeSubMenu(menu) {
325 function closeSubMenu(menu) {
326
326
327 if (menu == null || menu.activeItem == null)
327 if (menu == null || menu.activeItem == null)
328 return;
328 return;
329
329
330 // Recursively close any sub menus.
330 // Recursively close any sub menus.
331
331
332 if (menu.activeItem.subMenu != null) {
332 if (menu.activeItem.subMenu != null) {
333 closeSubMenu(menu.activeItem.subMenu);
333 closeSubMenu(menu.activeItem.subMenu);
334 menu.activeItem.subMenu.style.visibility = "hidden";
334 menu.activeItem.subMenu.style.visibility = "hidden";
335 menu.activeItem.subMenu = null;
335 menu.activeItem.subMenu = null;
336 }
336 }
337 removeClassName(menu.activeItem, "menuItemHighlight");
337 removeClassName(menu.activeItem, "menuItemHighlight");
338 menu.activeItem = null;
338 menu.activeItem = null;
339 }
339 }
340
340
341
341
342 function buttonOrMenuMouseout(event) {
342 function buttonOrMenuMouseout(event) {
343
343
344 var el;
344 var el;
345
345
346 // If there is no active button, exit.
346 // If there is no active button, exit.
347
347
348 if (activeButton == null)
348 if (activeButton == null)
349 return;
349 return;
350
350
351 // Find the element the mouse is moving to.
351 // Find the element the mouse is moving to.
352
352
353 if (browser.isIE)
353 if (browser.isIE)
354 el = window.event.toElement;
354 el = window.event.toElement;
355 else if (event.relatedTarget != null)
355 else if (event.relatedTarget != null)
356 el = (event.relatedTarget.tagName ? event.relatedTarget : event.relatedTarget.parentNode);
356 el = (event.relatedTarget.tagName ? event.relatedTarget : event.relatedTarget.parentNode);
357
357
358 // If the element is not part of a menu, reset the active button.
358 // If the element is not part of a menu, reset the active button.
359
359
360 if (getContainerWith(el, "DIV", "menu") == null) {
360 if (getContainerWith(el, "DIV", "menu") == null) {
361 resetButton(activeButton);
361 resetButton(activeButton);
362 activeButton = null;
362 activeButton = null;
363 //-- debut ajout ci ----
363 //-- debut ajout ci ----
364 cimontreselect();
364 cimontreselect();
365 //-- fin ajout ci ----
365 //-- fin ajout ci ----
366 }
366 }
367 }
367 }
368
368
369
369
370 //----------------------------------------------------------------------------
370 //----------------------------------------------------------------------------
371 // Code to initialize menus.
371 // Code to initialize menus.
372 //----------------------------------------------------------------------------
372 //----------------------------------------------------------------------------
373
373
374 function menuInit(menu) {
374 function menuInit(menu) {
375
375
376 var itemList, spanList;
376 var itemList, spanList;
377 var textEl, arrowEl;
377 var textEl, arrowEl;
378 var itemWidth;
378 var itemWidth;
379 var w, dw;
379 var w, dw;
380 var i, j;
380 var i, j;
381
381
382 // For IE, replace arrow characters.
382 // For IE, replace arrow characters.
383
383
384 if (browser.isIE) {
384 if (browser.isIE) {
385 menu.style.lineHeight = "2.5ex";
385 menu.style.lineHeight = "2.5ex";
386 spanList = menu.getElementsByTagName("SPAN");
386 spanList = menu.getElementsByTagName("SPAN");
387 for (i = 0; i < spanList.length; i++)
387 for (i = 0; i < spanList.length; i++)
388 if (hasClassName(spanList[i], "menuItemArrow")) {
388 if (hasClassName(spanList[i], "menuItemArrow")) {
389 spanList[i].style.fontFamily = "Webdings";
389 spanList[i].style.fontFamily = "Webdings";
390 spanList[i].firstChild.nodeValue = "4";
390 spanList[i].firstChild.nodeValue = "4";
391 }
391 }
392 }
392 }
393
393
394 // Find the width of a menu item.
394 // Find the width of a menu item.
395
395
396 itemList = menu.getElementsByTagName("A");
396 itemList = menu.getElementsByTagName("A");
397 if (itemList.length > 0)
397 if (itemList.length > 0)
398 itemWidth = itemList[0].offsetWidth;
398 itemWidth = itemList[0].offsetWidth;
399 else
399 else
400 return;
400 return;
401
401
402 // For items with arrows, add padding to item text to make the
402 // For items with arrows, add padding to item text to make the
403 // arrows flush right.
403 // arrows flush right.
404
404
405 for (i = 0; i < itemList.length; i++) {
405 for (i = 0; i < itemList.length; i++) {
406 spanList = itemList[i].getElementsByTagName("SPAN");
406 spanList = itemList[i].getElementsByTagName("SPAN");
407 textEl = null;
407 textEl = null;
408 arrowEl = null;
408 arrowEl = null;
409 for (j = 0; j < spanList.length; j++) {
409 for (j = 0; j < spanList.length; j++) {
410 if (hasClassName(spanList[j], "menuItemText"))
410 if (hasClassName(spanList[j], "menuItemText"))
411 textEl = spanList[j];
411 textEl = spanList[j];
412 if (hasClassName(spanList[j], "menuItemArrow"))
412 if (hasClassName(spanList[j], "menuItemArrow"))
413 arrowEl = spanList[j];
413 arrowEl = spanList[j];
414 }
414 }
415 if (textEl != null && arrowEl != null) {
415 if (textEl != null && arrowEl != null) {
416 textEl.style.paddingRight = (itemWidth
416 textEl.style.paddingRight = (itemWidth
417 - (textEl.offsetWidth + arrowEl.offsetWidth)) + "px";
417 - (textEl.offsetWidth + arrowEl.offsetWidth)) + "px";
418 // For Opera, remove the negative right margin to fix a display bug.
418 // For Opera, remove the negative right margin to fix a display bug.
419 if (browser.isOP)
419 if (browser.isOP)
420 arrowEl.style.marginRight = "0px";
420 arrowEl.style.marginRight = "0px";
421 }
421 }
422 }
422 }
423
423
424 // Fix IE hover problem by setting an explicit width on first item of
424 // Fix IE hover problem by setting an explicit width on first item of
425 // the menu.
425 // the menu.
426
426
427 if (browser.isIE) {
427 if (browser.isIE) {
428 w = itemList[0].offsetWidth;
428 w = itemList[0].offsetWidth;
429 itemList[0].style.width = w + "px";
429 itemList[0].style.width = w + "px";
430 dw = itemList[0].offsetWidth - w;
430 dw = itemList[0].offsetWidth - w;
431 w -= dw;
431 w -= dw;
432 itemList[0].style.width = w + "px";
432 itemList[0].style.width = w + "px";
433 }
433 }
434
434
435 // Mark menu as initialized.
435 // Mark menu as initialized.
436
436
437 menu.isInitialized = true;
437 menu.isInitialized = true;
438 }
438 }
439
439
440 //----------------------------------------------------------------------------
440 //----------------------------------------------------------------------------
441 // General utility functions.
441 // General utility functions.
442 //----------------------------------------------------------------------------
442 //----------------------------------------------------------------------------
443
443
444 function getContainerWith(node, tagName, className) {
444 function getContainerWith(node, tagName, className) {
445
445
446 // Starting with the given node, find the nearest containing element
446 // Starting with the given node, find the nearest containing element
447 // with the specified tag name and style class.
447 // with the specified tag name and style class.
448
448
449 while (node != null) {
449 while (node != null) {
450 if (node.tagName != null && node.tagName == tagName &&
450 if (node.tagName != null && node.tagName == tagName &&
451 hasClassName(node, className))
451 hasClassName(node, className))
452 return node;
452 return node;
453 node = node.parentNode;
453 node = node.parentNode;
454 }
454 }
455
455
456 return node;
456 return node;
457 }
457 }
458
458
459 function hasClassName(el, name) {
459 function hasClassName(el, name) {
460
460
461 var i, list;
461 var i, list;
462
462
463 // Return true if the given element currently has the given class
463 // Return true if the given element currently has the given class
464 // name.
464 // name.
465
465
466 list = el.className.split(" ");
466 list = el.className.split(" ");
467 for (i = 0; i < list.length; i++)
467 for (i = 0; i < list.length; i++)
468 if (list[i] == name)
468 if (list[i] == name)
469 return true;
469 return true;
470
470
471 return false;
471 return false;
472 }
472 }
473
473
474 function removeClassName(el, name) {
474 function removeClassName(el, name) {
475
475
476 var i, curList, newList;
476 var i, curList, newList;
477
477
478 if (el.className == null)
478 if (el.className == null)
479 return;
479 return;
480
480
481 // Remove the given class name from the element's className property.
481 // Remove the given class name from the element's className property.
482
482
483 newList = new Array();
483 newList = new Array();
484 curList = el.className.split(" ");
484 curList = el.className.split(" ");
485 for (i = 0; i < curList.length; i++)
485 for (i = 0; i < curList.length; i++)
486 if (curList[i] != name)
486 if (curList[i] != name)
487 newList.push(curList[i]);
487 newList.push(curList[i]);
488 el.className = newList.join(" ");
488 el.className = newList.join(" ");
489 }
489 }
490
490
491 function getPageOffsetLeft(el) {
491 function getPageOffsetLeft(el) {
492
492
493 var x;
493 var x;
494
494
495 // Return the x coordinate of an element relative to the page.
495 // Return the x coordinate of an element relative to the page.
496
496
497 x = el.offsetLeft;
497 x = el.offsetLeft;
498 if (el.offsetParent != null)
498 if (el.offsetParent != null)
499 x += getPageOffsetLeft(el.offsetParent);
499 x += getPageOffsetLeft(el.offsetParent);
500
500
501 return x;
501 return x;
502 }
502 }
503
503
504 function getPageOffsetTop(el) {
504 function getPageOffsetTop(el) {
505
505
506 var y;
506 var y;
507
507
508 // Return the x coordinate of an element relative to the page.
508 // Return the x coordinate of an element relative to the page.
509
509
510 y = el.offsetTop;
510 y = el.offsetTop;
511 if (el.offsetParent != null)
511 if (el.offsetParent != null)
512 y += getPageOffsetTop(el.offsetParent);
512 y += getPageOffsetTop(el.offsetParent);
513
513
514 return y;
514 return y;
515 }
515 }
516
516
517 //-- debut ajout ci ----
517 //-- debut ajout ci ----
518 function cicacheselect(){
518 function cicacheselect(){
519 if (browser.isIE) {
519 if (browser.isIE && browser.version < 7) {
520 oSelects = document.getElementsByTagName('SELECT');
520 oSelects = document.getElementsByTagName('SELECT');
521 if (oSelects.length > 0) {
521 if (oSelects.length > 0) {
522 for (i = 0; i < oSelects.length; i++) {
522 for (i = 0; i < oSelects.length; i++) {
523 oSlt = oSelects[i];
523 oSlt = oSelects[i];
524 if (oSlt.style.visibility != 'hidden') {oSlt.style.visibility = 'hidden';}
524 if (oSlt.style.visibility != 'hidden') {oSlt.style.visibility = 'hidden';}
525 }
525 }
526 }
526 }
527 oSelects = document.getElementsByName('masquable');
527 oSelects = document.getElementsByName('masquable');
528 if (oSelects.length > 0) {
528 if (oSelects.length > 0) {
529 for (i = 0; i < oSelects.length; i++) {
529 for (i = 0; i < oSelects.length; i++) {
530 oSlt = oSelects[i];
530 oSlt = oSelects[i];
531 if (oSlt.style.visibility != 'hidden') {oSlt.style.visibility = 'hidden';}
531 if (oSlt.style.visibility != 'hidden') {oSlt.style.visibility = 'hidden';}
532 }
532 }
533 }
533 }
534 }
534 }
535 }
535 }
536
536
537 function cimontreselect(){
537 function cimontreselect(){
538 if (browser.isIE) {
538 if (browser.isIE && browser.version < 7) {
539 oSelects = document.getElementsByTagName('SELECT');
539 oSelects = document.getElementsByTagName('SELECT');
540 if (oSelects.length > 0) {
540 if (oSelects.length > 0) {
541 for (i = 0; i < oSelects.length; i++) {
541 for (i = 0; i < oSelects.length; i++) {
542 oSlt = oSelects[i];
542 oSlt = oSelects[i];
543 if (oSlt.style.visibility != 'visible') {oSlt.style.visibility = 'visible';}
543 if (oSlt.style.visibility != 'visible') {oSlt.style.visibility = 'visible';}
544 }
544 }
545 }
545 }
546 oSelects = document.getElementsByName('masquable');
546 oSelects = document.getElementsByName('masquable');
547 if (oSelects.length > 0) {
547 if (oSelects.length > 0) {
548 for (i = 0; i < oSelects.length; i++) {
548 for (i = 0; i < oSelects.length; i++) {
549 oSlt = oSelects[i];
549 oSlt = oSelects[i];
550 if (oSlt.style.visibility != 'visible') {oSlt.style.visibility = 'visible';}
550 if (oSlt.style.visibility != 'visible') {oSlt.style.visibility = 'visible';}
551 }
551 }
552 }
552 }
553 }
553 }
554 }
554 }
555
555
556 //-- fin ajout ci ----
556 //-- fin ajout ci ----
General Comments 0
You need to be logged in to leave comments. Login now