function fitUnderlay(oElement,oLay)
{var oNodes=oElement.getElementsByTagName("UL")[0].childNodes;var height=0;for(i=0;i<oNodes.length;i++)
if(oNodes[i].tagName=="LI")height+=oNodes[i].offsetHeight;var width=oNodes[0].offsetWidth;var left=0;var top=0;var oTemp=oNodes[0];while(oTemp!=null){left+=oTemp.offsetLeft;oTemp=oTemp.offsetParent;}
oTemp=oNodes[0];while(oTemp!=null){top+=oTemp.offsetTop;oTemp=oTemp.offsetParent;}
oLay.style.height=height+"px";oLay.style.width=width+"px";oLay.style.left=left+"px";oLay.style.top=top+"px";oLay.attachedMenu=oElement;}
function removeUnderlay(oLay)
{oLay.style.height="0px";oLay.attachedMenu=null;}
if(navigator.appName=="Microsoft Internet Explorer"&&navigator.appVersion.indexOf("7.")==-1){sfHover=function(){var sfEls=document.getElementById("nav").getElementsByTagName("LI");for(var i=0;i<sfEls.length;i++){sfEls[i].onmouseover=function(){this.className+=" sfhover";if(this.isMenu){var ulay=document.getElementById("underlay"+(this.subLevel+''));if(ulay.attachedMenu!=this)fitUnderlay(this,ulay);}
else if(this.subLevel<3){var ulay=document.getElementById("underlay"+((this.subLevel)+''));if(ulay.attachedMenu!=null)removeUnderlay(ulay);}}
sfEls[i].onmouseout=function(){this.className=this.className.replace(new RegExp(" sfhover\\b"),"");if(this.subLevel==0){for(i=0;i<3;i++)
removeUnderlay(document.getElementById("underlay"+(i+'')));}}
sfEls[i].subLevel=0;sfEls[i].isMenu=(sfEls[i].getElementsByTagName("UL").length>0);var oElement=sfEls[i];do
{if(oElement.id=="nav")break;else if(oElement.tagName=="UL")sfEls[i].subLevel++;if(oElement.parentNode)oElement=oElement.parentNode;else oElement=null;}while(oElement!=null);}
for(i=0;i<3;i++){oUnderlay=document.createElement("IFRAME");oUnderlay.id="underlay"+(i+'');oUnderlay.style.position="absolute";oUnderlay.style.border="0px";oUnderlay.style.top="0px";oUnderlay.style.left="0px";oUnderlay.style.width="0px";oUnderlay.style.height="0px";oUnderlay.attachedMenu=null;document.body.appendChild(oUnderlay);}}
if(window.attachEvent)window.attachEvent("onload",sfHover);}
