';
addHtml= addHtml+'';
addHtml= addHtml+'
';
if(form_type==2){
jQuery("#mb_comment_reply"+comment_index).html("");
comment_index = 0;
comment_pid = 0;
comment_action = "";
}else{
if(comment_index!=0) jQuery("#mb_comment_reply"+comment_index).html("");
comment_index = idx;
comment_pid = pid;
comment_action = action;
jQuery("#mb_comment_reply"+comment_index).html(addHtml);
}
}
}
function sendCommentDataHandler(response, state){
if(response.state == "success"){
comment_index = 0;
comment_pid = 0;
comment_action = "";
jQuery(".cmt-input-box input[type='text']").val("");
jQuery(".cmt-input-box input[type='password']").val("");
jQuery(".cmt-input-box textarea").val("");
if(send_action =="write"){
jQuery("#mb_comment_write_box").html(jQuery("#mb_comment_write_box").html());
}
if(comment_load) hidePopupBox();
comment_load = true;
var comment_items = "";
var comment_item = "";
var select_index = comment_page+1;
var fn_pid = 'pid';
var fn_parent_pid = 'parent_pid';
var fn_reply = 'reply';
var fn_is_secret = 'is_secret';
jQuery.each(response.data, function(key,value){
if(parseInt(value[fn_reply])>0){
reply_class = ' cmt-reply-item';
reply_sign = '

';
} else {
reply_class = "";
reply_sign = "";
}
if(value[fn_is_secret]=="1"){
reply_sign = reply_sign+'

';
}
comment_item = "";
comment_item = comment_item+'
';
comment_item = comment_item+''+reply_sign+value['user_name']+''+value['reg_date']+'
';comment_item = comment_item+''+value['content']+'
';
comment_item = comment_item+'';
if(value['secret_type']!='lock'){if(value['mode']=='list'){comment_item = comment_item+''; }if(value['delete_type']=='user'){comment_item = comment_item+''; }else if(value['delete_type']=='guest'){comment_item = comment_item+''; }if(value['modify_type']=='user' || value['modify_type']=='guest' ){comment_item = comment_item+''; }if(reply_class==''){ if(value['reply_type']=='user' || value['reply_type']=='guest'){comment_item = comment_item+'';}}}
comment_item = comment_item+'
';
comment_item = comment_item+'';
select_index = select_index+1;
comment_items = comment_items+comment_item;
});
if(comment_page==0)
jQuery("#comment_list_box").html(comment_items);
else
jQuery("#comment_list_box").append(comment_items);
comment_page = select_index-1;
comment_page_total = parseInt(response.total_count);
if(comment_page_total==0){
jQuery("#comment_list_box").hide();
}else{
jQuery("#comment_list_box").show();
}
jQuery(".cmt-count-box").show();
jQuery("#mb_comment_totalcount").html(comment_page_total);
if(comment_page>=comment_page_total) jQuery("#comment_add_list").hide();
else jQuery("#comment_add_list").show();
}else{
comment_page = comment_temp;
showAlertPopup(response);
}
}