(function(){function r(r){if(!t[r]&&n[r]!=-1){t[r]=!0;var u=$(".cdml_comment_list .comlist"+r);$.ajax({url:"/ajax/schoolcomment/"+i,data:{type:r,pid:n[r]+1},success:function(t){if($(t).length==0){n[r]=-1;return}n[r]=n[r]+1;u.append(t)},error:function(){layer.msg("数据加载失败,请稍候再试")},complete:function(){t[r]=!1}})}}var i=$(".studyinfo_article").data("id"),n=[1,0,0,0,0],t=[!1,!1,!1,!1,!1];$(".cdml_comment_list .comment_type li").click(function(){var t=$(this).data("type");n[t]==0&&r(t);$(this).addClass("cur").siblings(".cur").removeClass("cur");$(".cdml_comment_list .comlist"+t).show().siblings().hide()});$(".comment_list").on("click",".btn_praise",function(){if($(this).hasClass("upvoted")){layer.msg("请勿重复提交");return}var n=$(this);n.addClass("upvoted");$.ajax({url:"/ajax/commentupvote/"+$(this).data("id"),data:{courseId:$(this).data("courseid")},type:"post",dataType:"json",success:function(t){if(!t.success){layer.msg(t.msg);n.removeClass("upvoted");return}$("em",n).html(parseInt($("em",n).text())+1);layer.msg("提交成功")},error:function(){layer.msg("提交失败,请稍候再试");n.removeClass("upvoted")}})}).on("click",".imgdiv a,.btn_consult",function(){askQuestion({id:i,mid:$(this).data("memberid"),sex:$(this).data("sex"),type:1})});$(window).scroll(function(){if($(window).scrollTop()+800>=$(document).height()){var n=$(".cdml_comment_list .comment_type li.cur").data("type");r(n)}});$(".c_list .c_product .infodiv .info_imglist .min-img").on("mouseover mouseout",function(n){n.type=="mouseover"?$(this).siblings(".max-img").show():n.type=="mouseout"&&$(this).siblings(".max-img").hide()})})()