$(function () {
    $.getheartbeatdata();
    window.setInterval(function () {
        $.getheartbeatdata();
    }, 60000);
})

$.getheartbeatdata = function() {
    $.ajax({
        url: contentPath + "/Home/HeartBeatData/",
        type: "get",
        dataType: "json",
        async: false,
        success: function(data) {
            refreshMail(data.shortMsg);
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
            $.dialogMsg(errorThrown, -1);
        }
    });
}

//刷新邮件数量
function refreshMail(data) {
    if (data.count > 0) {
        $(".header_right").find(".message").addClass("newInfo");
    } else {
        $(".header_right").find(".message").removeClass("newInfo");
    }
}