$(document).ready(function () {
    $(".sel").change(function () {
        var a = $(this).find("select option:selected").text();
        $(this).find("span").text(a)
    });
    $(".menu_m ul li").has("ul").addClass("lev2");
    $(".menu_m ul li").hover(function () {
        $(this).addClass("hover")
    }, function () {
        $(this).removeClass("hover")
    });
    $("#auth").fancybox()
});
$(function () {
    $(".pic a").fancybox({
        titlePosition: "inside"
    })
});
jQuery.fn.extend({
    changer: function () {
        var a = this;
        var b = setInterval(function () {
            $(a).children(":nth-child(1)").fadeIn(300).delay(2e3).fadeOut(2e3).appendTo(a)
        }, 5e3)
    }
});
$(document).ready(function () {
    $(".zn_qz,.close").click(function () {
        if ($(".zn_q").hasClass("close_zn")) {
            $(".zn_q").animate({
                right: "+=234px"
            });
            $(".zn_q").toggleClass("open_zn close_zn")
        } else {
            $(".zn_q").animate({
                right: "-=234px"
            });
            $(".zn_q").toggleClass("open_zn close_zn")
        }
        return false
    });
    $("a.title, title").live("click", function () {
        var a = $(this).html();
        var b = $(this).attr("href");
        if ($("div.zn_qi p a").html().length > 0) {
            $("div.zn_qi p a").each(function () {
                if ($(this).html() == a) {
                    $(this).parent().remove();
                    var c = $("div.zn_qi").html();
                    $.post("/queue.php", {
                        queue: c
                    }, function (a) {
                        location.href = b
                    })
                }
            });
            return false
        }
    });
    $(".plus_btn").click(function () {
        var a = $(this).parent().children("a.title").attr("href");
        var b = $(this).parent().children("a.title").text();
        var c = '<p style="padding:5px;"><a href=' + a + ' class="title">' + b + "</a><a href='#' class='delete_zn' style='margin-left:10px; text-decoration: none;' title=\"Удалить из списка\">[X]</a></p>";
        var d = '<a href="' + a + '" class="title">' + b + '</a><a href="#" class="delete_zn" style="margin-left:10px; text-decoration: none;" title="Удалить из списка">[X]</a>';
        $("div.zn_qi p").each(function () {
            if ($(this).html() == d) {
                c = ""
            }
        });
        $("div.zn_qi").append(c);
        var e = $("div.zn_qi").html();
        $.post("/queue.php", {
            queue: e
        });
        return false
    });
    $(".delete_zn").live("click", function () {
        $(this).parent().remove();
        var a = $("div.zn_qi").html();
        $.post("/queue.php", {
            queue: a
        });
        return false
    })
})
  
