$(function(){
    var surl = location.href;
    var surl2 = $(".wz a:eq(1)").attr("href");
    $("#nav ul li a").each(function() {
        if ($(this).attr("href")==surl || $(this).attr("href")==surl2) $(this).parent().addClass("on");
    });
    $("#nav ul li").hover(function() {
        $(this).addClass("hover").siblings().removeClass("hover");
        $(this).find("#nav ul li a").addClass("hover");
        $(this).find("#nav ul li ul").show();
    }, function() {
        //$(this).css("background-color","#f5f5f5");
        $(this).find("#nav ul li ul").hide();
        //$(this).find(".nav a").removeClass("hover");
        $(this).removeClass("hover");
        $(this).find("#nav ul li a").removeClass("hover");
    });
    $('#left-menu').sidr({
        name: 'sidr-left',
        side: 'right'
    });
});

zbp.plugin.unbind("comment.reply", "system");
zbp.plugin.on("comment.reply", "tx_qiye6", function(id) {
    var i = id;
    $("#inpRevID").val(i);
    var frm = $('#divCommentPost'),
        cancel = $("#cancel-reply");

    frm.before($("<div id='temp-frm' style='display:none'>")).addClass("reply-frm");
    $('#AjaxComment' + i).before(frm);

    cancel.show().click(function() {
        var temp = $('#temp-frm');
        $("#inpRevID").val(0);
        if (!temp.length || !frm.length) return;
        temp.before(frm);
        temp.remove();
        $(this).hide();
        frm.removeClass("reply-frm");
        return false;
    });
    try {
        $('#txaArticle').focus();
    } catch (e) {}
    return false;
});

zbp.plugin.on("comment.get", "tx_qiye6", function (logid, page) {
    $('span.commentspage').html("提交中...");
});
zbp.plugin.on("comment.got", "tx_qiye6", function (logid, page) {
    $("#cancel-reply").click();
});
zbp.plugin.on("comment.postsuccess", "tx_qiye6", function () {
    $("#cancel-reply").click();
});