$(document).ready(function () {

    // flickering cursor
    if ($("#flickering_cursor").length) {
        $(".plate-bg").blur(function () {
            if ($(".plate-bg").val() == "") {
                $("#flickering_cursor").show();
            }
        });
        $(".plate-bg").focus(function () {
            $("#flickering_cursor").hide();
        });
    }


    if ($(".label_help").length) {
        $(".label_help").click(function () {
            $("#lbox").show();

            $("#lbox #close").unbind("click");
            $("#lbox #close").click(function () {
                $("#lbox").hide();
            });
            $("#lbox #next").unbind("click");
            $("#lbox #next").click(function () {
                $("#lbox").hide();
            });
        });
    }
    // smoothing chat area
    var offsetY = $("#right-col").offset().top;
    $(window).scroll(function () {
        if ($(window).scrollTop() < ($("#content-col").scrollTop() + $("#content-col").height() - 200)) {
            if ($(window).scrollTop() > (offsetY + 25)) {
                $("#floating").animate({ marginTop: ($(window).scrollTop() - (offsetY + 25)) + 'px' }, { queue: false, duration: 250, easing: 'easeInOutSine' });
            } else {
                $("#floating").animate({ marginTop: 0 }, { queue: false, duration: 250, easing: 'easeInOutSine' });
            }
        }
    });
});
