

function OnCommentVote(id, vote) {
    var e = get('comment-' + id + '-votes');
    var v = parseInt(e.innerHTML) + vote;
    e.innerHTML     = (v > 0 ? '+' + v : v);
    e.className     = (v == 0 ? '' : (v > 0 ? 'positive' : 'negative'));
    e.style.display = (v ? 'inline' : 'none');
    ajax.exec('cmd', 'vote', 'id', id, 'vote', vote);
}
function ShowCommentForm(parent) {
    var d = get('comments-form');
    var f = document.comments_form;

    f.ParentId.value = parent;
    f.Content.value  = '';

    if (parent) {
        var p = get('comment-' + parent);
        d.style.marginLeft = '62px';
    } else {
        var p = get('comments');
        d.style.marginLeft = 0;
    }
    p.appendChild(d);
    d.style.display = 'block';
    f.submit.focus();
    f.Content.focus();
}
function SubmitCommentForm(f) {
    if (f.Content.value == '') {

    } else {
        var r = ajax.load('cmd', 'comment', 'ParentId', f.ParentId.value, 'SourceTable', f.SourceTable.value, 'SourceId', f.SourceId.value, 'Content', f.Content.value);
        location.href = location.href;
    }
    get('comments-form').style.display = 'none';
}
