What does this javascript function do

I have taken over a website, and I can work out what most things do, but this script is on almost every page and I can't work out what its doing. I can remove it and the page seems to work fine so some advice on its function would be brilliant.

<!-- #BeginEditable "style" -->
<script type="text/javascript"><!--//--><![CDATA[//><!--
sfHover = function() {
	var sfEls = document.getElementById("nav4").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
//--><!]]></script>
<!-- #EndEditable -->

Open in new window

LVL 15
ChloesDadAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

carlmdCommented:
It is used for dropdown menus.

Take a look at:

http://www.htmldog.com/articles/suckerfish/dropdowns/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ChloesDadAuthor Commented:
We do have dropdown menus on the site, but they appear to be functioning perfectly without this code.

I have found code in out common css that sets up the hover, the article mentions that IE doesn't support this, but I am testing on IE11, Is it only earlier versions of IE that didn't support this and hence need the JavaScript code?
0
carlmdCommented:
Chances are you are correct about the earlier versions. If the code you are looking at is years old, then it makes that even more likely, since IE has had significant changes over the past several years.
0
ChloesDadAuthor Commented:
Thanks, it is quite old. Either way, I can put the function into our PageHeader file which is included on every page, rather than having it directly on every page.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.