﻿/*用户提醒*/
var title = document.title;
var hasreminds = false;
$.ajax({
    url: "handler/common.ashx?action=remindcount",
    type: "get",
    cache: false,
    success: function (data) {
        if (data == "") return;
        data = eval("data=" + data);
        if (data.reminds > 0) {
            SetTitleTip(true);
            hasreminds = true;
            $("#reminds").html('<b onclick="location.href=\'usercenter.aspx?tab=reminds\'" style="cursor:pointer;">提醒(' + data.reminds + ')</b>');
            setInterval(function () {
                for (var i = 1; i < 20; i++) {
                    if (i % 2 != 0) {
                        setTimeout(function () {
                            SetTitleTip(true);
                        }, i * 1000);
                    }
                    else {
                        setTimeout(function () {
                            SetTitleTip(false);
                        }, i * 1000);
                    }
                }
            }, 45000); //check time :one minute
        }
    }
});
function SetTitleTip(withtip) {
    if (withtip) {
        document.title = "【新提醒】" + title;
    } else {
        document.title = "【　　　】" + title;
    }
}
