﻿//Page init
$.readyOrDone(function () {
    //menu2
    menu2Timer();

    // calendar popup
    $(".sml").mouseover(function () {
        if ($(this).find(".PopupContainer").length) {
            var bHeight = $("#CalendarBox", window.parent.document).height();
            var content = $(this).find(".PopupContent").html();
            var popup = $("#CalendarBox .Popup", window.parent.document);
            var xpos = $(this).offset().left - 177;
            var ypos = $(this).offset().top;
            ypos = bHeight - ypos - 0;
            popup.find(".content").html(content);
            popup.css({ left: xpos + "px", bottom: ypos + "px" });
            popup.show();
        }
    });

    $(".sml").mouseout(function () {
        var popup = $("#CalendarBox .Popup", window.parent.document);
        popup.hide();
    });
});

//css hover submenu display is too fast, so the menu2 will now use a timer.
function menu2Timer() {
    $("#Menu2 .Level0 > li").live("mouseover", function() {
        var that = this;
        setTimeout(function() { $(that).find("> .SubMenus").css("visibility", "visible") }, 500);
    });
}
