if (!GetMessageCount) {
    var GetMessageCount = {};
}

$(document).ready(
    function () {
        GetMessageCount.FindMessage();
    }
);

    GetMessageCount.FindMessage = function () {
        $.ajax({
            //处理ajax请求
            url: 'FindNewMessage.ashx',
            data: { Uid: GetSession('oaUserID') },
            cache: false,
            //回调函数返回未读短信数目
            success: function (response) {
                if (response != "") {
                    $('#messageCount').html('(' + response + ')');
                    $("#imgMessage")[0].src = "Images/Desktop/alert.gif";
                }
                else {
                    $('#messageCount').html('');
                    $("#imgMessage")[0].src = "Images/Desktop/message.png";
                }
            },
            error: function (data) {
                parent.location.href = 'Login.aspx'
            }
        });
        //每隔10 秒递归调用一次，刷新未读短信数目
        window.setTimeout(GetMessageCount.FindMessage, 10000);
    }



    function GetSession(value) {
        var temp;
        jQuery.ajax({
            type: "POST",
            url: "GetSession.aspx",
            async: false,      //是否ajax同步
            data: "s=" + value,
            success: function (msg) {
                temp = msg;
            }
        });
        return temp;
    }