function putCommentForm()
{
    var button = document.getElementById('commentButtonToggle');
    var comment_form = document.getElementById('comment_form');
    
    if (comment_form_visible)
    {
        comment_form.style.display = 'none';
        button.innerHTML = lang_comment_form_show;
        comment_form_visible = 0;
    }
    else
    {
        comment_form.style.display = '';
        button.innerHTML = lang_comment_form_hide;
        comment_form_visible = 1;
    }
}

function validateComment()
{
    var author = document.getElementById('comment_author_field');
    var comment = document.getElementById('comment_field');

    if (author.value.length > 50 && comment_form_visible && comment.value.length > 200)
    {
        if (confirm(lang_comment_author_too_long) && confirm(lang_comment_too_long))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    else if (author.value.length > 50 && comment_form_visible)
    {
        return confirm(lang_comment_author_too_long);
    }
    else if (comment.value.length > 200 && comment_form_visible)
    {
        return confirm(lang_comment_too_long);
    }
    else
    {
        if (!comment_form_visible)
        {
            author.value = '';
            comment.value = '';
        }
        return true;
    }
}
