I'm not too experienced with javascript - if I'm using IE only I can get around just fine, but I haven't really had a lot of experience sniffing out other browsers and trying to create different code branches to create the same effect on a particular browser.

In this case I've got a series of layers that correspond to some links. When someone mouses over the link, the layer becomes visible. When someone mouses out, I want the layer to fade out.

Code:
//fades the layer out
ie5  = (document.all && document.getElementById);
ns6 = (!document.all && document.getElementById);

//starts opacity at 100% and function stopper to 0
lopac = 100;
breaker=0;

//fades the layer out while opacity is greater than 0 and while function stopper is 0
function fadeOut(layerval)
{

	if(lopac > 0)
	{
	if(breaker==0)
	 {
		opac2-=10;
		if(ie5) document.getElementById('layerval').filters.alpha.opacity = lopac;
		else if (!ie5)
		 {
		  document.getElementById('layerval').style.MozOpacity = lopac/100;
		 }
		setTimeout('fadeOut()', 50);
 	 }
    else document.getElementById('layer1').filters.alpha.opacity = 100;
	}

}
It works perfectly in IE, but I want to get in working in Netscape and Mozilla. I've tried altering the code in many ways (ignore the rudimentary attempt at detection, which I've removed to test Netscape/Mozilla) but the function doesn't seem to work with Netscape and Mozilla. The layer will go visible when mousing over, and then just stay there... hurray. Nothing I've tried will animate the opacity. Can anyone help me?