﻿jQuery(document).ready(function() {
    if (jQuery("#TopLevelNavi").length == 0) return;

    if (jQuery.browser.msie && (jQuery.browser.version == "7.0" || jQuery.browser.version == "6.0")) {
        jQuery("#TopLevelNavi div.subL").css("margin-top", "50px");
        jQuery("#TopLevelNavi div.subL").css("margin-left", "-235px");
    }

    jQuery("#TopLevelNavi ul:first").css({ "border": "none", "background-image": "none", "width": "0", "height": "0" });
    function flip(control, status) {
        var imgSRC = control.attr("src");
        if (imgSRC.indexOf("-over") < 0 && status)
            control.attr("src", imgSRC.replace(".gif", "-over.gif"));
        else if (!status) control.attr("src", imgSRC.replace("-over.gif", ".gif"));
    }

    jQuery("#TopLevelNavi div.firstL").hover(function() {
        if (jQuery(this).find("div.subL:first").css("display") == "none")
            jQuery(this).find("div.subL:first").css("display", "block");
        flip(jQuery(this).find("img:first"), true);
    });

    jQuery("#TopLevelNavi div.subL").mouseleave(function() {
        jQuery(this).hide();
        flip(jQuery(this).prev().find("img:first"), false);
    });

    jQuery("#TopLevelNavi div.firstL").mouseleave(function() {
        jQuery(this).find("div.subL").hide();
        flip(jQuery(this).find("img:first"), false);
    });
});