
sfHover = function() {
    var sfEls = document.getElementById("sub_nav").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);

function getElementPosition(elemID) {
    var offsetTrail = document.getElementById(elemID);
    var offsetLeft = 0;
    var offsetTop = 0;
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTop += offsetTrail.offsetTop;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 &&
        typeof document.body.leftMargin != "undefined") {
        offsetLeft += document.body.leftMargin;
        offsetTop += document.body.topMargin;
    }
    return {left:offsetLeft, top:offsetTop};
}
           
function respositionNav() {
    var left = getElementPosition('sub_nav_area2').left;
    //var top = getElementPosition('sub_nav_area2').top;
    var top = 85;
    document.getElementById('sub_nav_area').style.left=left+"px";
    document.getElementById('sub_nav_area').style.top=top+"px";
    $('topLevelMenu').style.display="block";
}

// load the subnav into a properly positioned div
if ($('sub_nav_area_hidden') && $('sub_nav_area')) {
    $('sub_nav_area').innerHTML = $('sub_nav_area_hidden').innerHTML;
}

if (document.getElementById('sub_nav_area') && document.getElementById('sub_nav_area2')) {
    respositionNav();
} else {
    Event.observe(window, 'load', respositionNav);
}

if (sat_main_nav_page_section_id != null && $('topnav_' + sat_main_nav_page_section_id) 
     && $('subnav_' + sat_main_nav_page_section_id)) {
            openMenu(sat_main_nav_page_section_id);
}            

window.onresize = function() {
    respositionNav();
}

