/**
 * Ajax lista megjelenítő
 */
function showComment(type,record,story_id) {
    jQuery('.show_comments').css('opacity','0.2');
    jQuery.ajax({
        type: "POST",
        url: "/Comment/getCommentList",
        data: "record="+record+"&story_id="+story_id+"&type="+type,
        success: function(data){
            if(data.error==0) {
                jQuery('.show_comments').html(data.html);
            }
            jQuery('.show_comments').css('opacity','1');
        }
    });
}
/**
 * Komment mentése
 */
function commentSubmit(type) {
    jQuery('.new_comment').css('opacity','0.2');
    if(ajax!=true){
        var params = jQuery('#comment_form').serialize()+'&type='+type;
        jQuery('#comment_form').validator({
            url: '/Comment/commentSave',
            errorplace: 'comment_error',
            params: params,
            onSuccess: function(){
                location.reload();
            }
        });
    }
    jQuery('.new_comment').css('opacity','1');
}
/**
 * Előzmény komment megjelenítése
 */
function showCommentDialog(type,comment_id) {
    jQuery.ajax({
        type: 'POST',
        url: '/Comment/getComment',
        data: 'comment_id='+comment_id+'&type='+type,
        success: function(ret) {
            if(ret.error==0) {
                jQuery('#comment_dialog').html(ret.html);
                jQuery('#comment_dialog').dialog({
                    title: ret.title
                });
                jQuery('#comment_dialog').dialog('open');
            }
        }
    });    
}
/**
 * Moderálás visszavonás
 */
function moderate_cancel(type,id) {
    if(ajax!=true) {
        ajax = true;
        jQuery.ajax({
            type: 'POST',
            url: '/Comment/moderatecancel',
            data: {
                comment_id: id,
                type: type
            },
            success: function(ret) {
                if(ret.error==0) {
                    location.reload();
                }
                ajax = false;
            }
            
        });
    }
}
