| 387 |
rajveer |
1 |
/*
|
|
|
2 |
* @(#)iehover-fix.js
|
|
|
3 |
*
|
|
|
4 |
* This source is part of the FLEXCUBE Software System and is copyrighted by i-flex solutions limited.
|
|
|
5 |
*
|
|
|
6 |
* All rights reserved. No part of this work may be reproduced, stored in a retrieval system,
|
|
|
7 |
* adopted or transmitted in any form or by any means, electronic, mechanical,
|
|
|
8 |
* photographic, graphic, optic recording or otherwise, translated in any language or
|
|
|
9 |
* computer language, without the prior written permission of i-flex solutions limited.
|
|
|
10 |
*
|
|
|
11 |
* i-flex solutions limited.
|
|
|
12 |
* 10-11, SDF I, SEEPZ, Andheri (East),
|
|
|
13 |
* Mumbai - 400 096.
|
|
|
14 |
* India
|
|
|
15 |
*
|
|
|
16 |
* Copyright ©2008 by i-flex solutions limited.
|
|
|
17 |
*/
|
|
|
18 |
|
|
|
19 |
// Created a long, long time ago by Tanny O'Haley
|
|
|
20 |
// Update history.
|
|
|
21 |
// 24 Oct 2006 - Added to http://tanny.ica.com
|
|
|
22 |
// 14 Jul 2006 - Modified the way the iframe is added to the DOM. I no longer use
|
|
|
23 |
// innerHTML but use DOM methods.
|
|
|
24 |
// 15 Sep 2006 - Added a check to see if the target element onmouseout is contained
|
|
|
25 |
// in the onmouseout element. If it is then I dont' remove the
|
|
|
26 |
// sfhover class. I made use of the Microsoft proprietary
|
|
|
27 |
// obj.contains() method.
|
|
|
28 |
// Added check to make sure that the sfhover class is not already in
|
|
|
29 |
// the li element.
|
|
|
30 |
//
|
|
|
31 |
|
|
|
32 |
sfHover = function() {
|
|
|
33 |
// Support the standard nav without a class of nav.
|
|
|
34 |
var el = document.getElementById("nav");
|
|
|
35 |
if(!/\bnav\b/.test(el.className) && el.tagName == "UL")
|
|
|
36 |
setHover(el);
|
|
|
37 |
|
|
|
38 |
// Find all unordered lists.
|
|
|
39 |
var ieNavs = document.getElementsByTagName('ul');
|
|
|
40 |
for(i=0; i<ieNavs.length; i++) {
|
|
|
41 |
var ul = ieNavs[i];
|
|
|
42 |
// If they have a class of nav add the menu hover.
|
|
|
43 |
if(/\bnav\b/.test(ul.className))
|
|
|
44 |
setHover(ul);
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
function setHover(nav) {
|
|
|
50 |
var ieULs = nav.getElementsByTagName('ul');
|
|
|
51 |
if (navigator.appVersion.substr(22,3)!="5.0") {
|
|
|
52 |
// IE script to cover <select> elements with <iframe>s
|
|
|
53 |
for (j=0; j<ieULs.length; j++) {
|
|
|
54 |
var ieMat=document.createElement('iframe');
|
|
|
55 |
if(document.location.protocol == "https:")
|
|
|
56 |
ieMat.src="//0";
|
|
|
57 |
else if(window.opera != "undefined")
|
|
|
58 |
ieMat.src="";
|
|
|
59 |
else
|
|
|
60 |
ieMat.src="javascript:false";
|
|
|
61 |
ieMat.scrolling="no";
|
|
|
62 |
ieMat.frameBorder="0";
|
|
|
63 |
ieMat.style.width=ieULs[j].offsetWidth+"px";
|
|
|
64 |
ieMat.style.height=ieULs[j].offsetHeight+"px";
|
|
|
65 |
ieMat.style.zIndex="-1";
|
|
|
66 |
ieULs[j].insertBefore(ieMat, ieULs[j].childNodes[0]);
|
|
|
67 |
ieULs[j].style.zIndex="101";
|
|
|
68 |
}
|
|
|
69 |
// IE script to change class on mouseover
|
|
|
70 |
var ieLIs = nav.getElementsByTagName('li');
|
|
|
71 |
for (var i=0; i<ieLIs.length; i++) if (ieLIs[i]) {
|
|
|
72 |
// Add a sfhover class to the li.
|
|
|
73 |
ieLIs[i].onmouseover=function() {
|
|
|
74 |
if(!/\bsfhover\b/.test(this.className))
|
|
|
75 |
this.className+=" sfhover";
|
|
|
76 |
}
|
|
|
77 |
ieLIs[i].onmouseout=function() {
|
|
|
78 |
if(!this.contains(event.toElement))
|
|
|
79 |
this.className=this.className.replace(' sfhover', '');
|
|
|
80 |
}
|
|
|
81 |
}
|
|
|
82 |
} else {
|
|
|
83 |
// IE 5.0 doesn't support iframes so hide the select statements on hover and show on mouse out.
|
|
|
84 |
// IE script to change class on mouseover
|
|
|
85 |
var ieLIs = document.getElementById('nav').getElementsByTagName('li');
|
|
|
86 |
for (var i=0; i<ieLIs.length; i++) if (ieLIs[i]) {
|
|
|
87 |
ieLIs[i].onmouseover=function() {this.className+=" sfhover";hideSelects();}
|
|
|
88 |
ieLIs[i].onmouseout=function() {this.className=this.className.replace(' sfhover', '');showSelects()}
|
|
|
89 |
}
|
|
|
90 |
}
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
// If IE 5.0 hide and show the select statements.
|
|
|
94 |
function hideSelects(){
|
|
|
95 |
var oSelects=document.getElementsByTagName("select");
|
|
|
96 |
for(var i=0;i<oSelects.length;i++)
|
|
|
97 |
oSelects[i].className+=" hide";
|
|
|
98 |
}
|
|
|
99 |
|
|
|
100 |
function showSelects(){
|
|
|
101 |
var oSelects=document.getElementsByTagName("select");
|
|
|
102 |
for(var i=0;i<oSelects.length;i++)
|
|
|
103 |
oSelects[i].className=oSelects[i].className.replace(" hide","");
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
// Run this only for IE.
|
|
|
107 |
if (window.attachEvent) window.attachEvent('onload', sfHover);
|
|
|
108 |
// end
|