﻿function comments_writeComment(pid, giabUrl, type)
{
    url = giabUrl + 'comments/write/' + type + '/' + pid;
    winopen(url, 'popwin', 398, 224);
}
function comments_editComment(pid, cid, giabUrl, type)
{
    url = giabUrl + 'comments/edit/' + type + '/' + pid + '/comment/' + cid;
    winopen(url, 'popwin', 398, 224);
}

function comments_approveComment(pid, cid, giabUrl, type)
{
    $.get(giabUrl + 'comments/approve/' + type + '/' + pid + '/comment/' + cid, {}, comments_approveCommentCallback);
}

function comments_approveCommentCallback(data)
{
    eval(data);
}

function comments_denyComment(pid, cid, giabUrl, type)
{
    $.get(giabUrl + 'comments/deny/' + type + '/' + pid + '/comment/' + cid, {}, comments_denyCommentCallback);
}

function comments_denyCommentCallback(data)
{
    eval(data);
}

function comments_deleteComment(pid, cid, giabUrl, type)    
{
    $.get(giabUrl + 'comments/delete/' + type + '/' + pid + '/comment/' + cid, {}, comments_deleteCommentCallback);
}

function comments_deleteCommentCallback(data)
{
    eval(data);
}

function comments_getNextPage(pageNum, primaryID, giabUrl, type)
{
    $.get(giabUrl + "comments/" + type + "/" + primaryID + "/page/" + pageNum, {}, comments_getNextPageCallback);
}
function comments_getNextPageCallback(data)
{
    $("div#comments_container").html(data);
}
function comments_getPreviousPage(pageNum, primaryID, giabUrl, type)
{
    $.get(giabUrl + "comments/" + type + "/" + primaryID + "/page/" + pageNum, {}, comments_getPreviousPageCallback);
}
function comments_getPreviousPageCallback(data)
{
    $("div#comments_container").html(data);
}

