(function (a) { a.fn.vTicker = function (b) { var c = { speed: 700, pause: 4000, showItems: 3, animation: "", mousePause: true, isPaused: false, direction: "up", height: 0 }; var b = a.extend(c, b); moveUp = function (g, d, e) { if (e.isPaused) { return } var f = g.children("ul"); var h = f.children("li:first").clone(true); if (e.height > 0) { d = f.children("li:first").height() } f.animate({ top: "-=" + d + "px" }, e.speed, function () { a(this).children("li:first").remove(); a(this).css("top", "0px") }); if (e.animation == "fade") { f.children("li:first").fadeOut(e.speed); if (e.height == 0) { f.children("li:eq(" + e.showItems + ")").hide().fadeIn(e.speed) } } h.appendTo(f) }; moveDown = function (g, d, e) { if (e.isPaused) { return } var f = g.children("ul"); var h = f.children("li:last").clone(true); if (e.height > 0) { d = f.children("li:first").height() } f.css("top", "-" + d + "px").prepend(h); f.animate({ top: 0 }, e.speed, function () { a(this).children("li:last").remove() }); if (e.animation == "fade") { if (e.height == 0) { f.children("li:eq(" + e.showItems + ")").fadeOut(e.speed) } f.children("li:first").hide().fadeIn(e.speed) } }; return this.each(function () { var f = a(this); var e = 0; f.css({ overflow: "hidden", position: "relative" }).children("ul").css({ position: "absolute", margin: 0, padding: 0 }).children("li").css({ margin: 0, padding: 0 }); if (b.height == 0) { f.children("ul").children("li").each(function () { if (a(this).height() > e) { e = a(this).height() } }); f.children("ul").children("li").each(function () { a(this).height(e) }); f.height(e * b.showItems) } else { f.height(b.height) } var d = setInterval(function () { if (b.direction == "up") { moveUp(f, e, b) } else { moveDown(f, e, b) } }, b.pause); if (b.mousePause) { f.bind("mouseenter", function () { b.isPaused = true }).bind("mouseleave", function () { b.isPaused = false }) } }) } })(jQuery);
function openmessage() {
    $("#toolbarMsg dd").toggle();
    $("#toolbarMsg").toggleClass("active_right");
}
function opengift() {
    $("#toolbarPrize dd").toggle();
    $("#toolbarPrize").toggleClass("active_right");
}
function openserver() {
    $("#toolbarEntrance dd").toggle();
    $("#toolbarEntrance").toggleClass("active_right", 10);
}

$(document).ready(function () {
    $("#game_frame").height($(window).height() - 32)
    $(window).resize(function () {
        $("#game_frame").height($(window).height() - 32);
    });
    $(function () {
        $("#toolbarToggle").click(function () {
            $(this).toggleClass("toolbar_off", 10).toggleClass("toolbar_on", 10)
            $("#toolbar").toggleClass("toolbar_min").toggleClass("toolbar_max")
        })
    })


    $("#toolbarMsg_newmessage").click(function () { openmessage(); })
    $("#line_small_cloas").click(function () { openmessage(); })
    $(".line_small em").click(function () { openmessage(); })


    $("#toolbarPrize").click(function () { opengift(); })
    $("#toolbarEntrance").click(function () { openserver(); })

    $('#toolbarNotification').vTicker({
        speed: 500,
        pause: 3000,
        showItems: 2,
        animation: 'fade',
        mousePause: false,
        height: 0,
        direction: 'up'
    });
})



var READ_MESSAGE_TIME = 3*60*1000; //三分钟
//window.setInterval(function () {
//    $.ajax({
//        url: "/api/message/message.ashx",
//        dataType: "JSONP",
//        callback: "callback",
//        error: function (a, b, c) { alert(c) },
//        success: function (msg) {
//       
//            if (msg.Has==true) {
//                $("#toolbarMsg_newmessage").css("display", "inline-block")
//                $("#no_message").css("display", "block");
//                $("#toolbarMsg_messagelist").html('<li class="noborder"><img class="picture" src="' + msg.Img + '"><p><em>' + msg.Title + '</em><br>' + msg.Html + '</p><span>' + msg.Date + '</span></li>');
//            }
//        }
//    });
//}, READ_MESSAGE_TIME);