function showFormComente()
{

    document.getElementById("comente").style.display = (document.getElementById("comente").style.display == 'none') ? '' : 'none';
}

function comentar()
{
    var objEditor = CKEDITOR.instances["comentario"];
    var q = objEditor.getData();

    if (q != '')
    {
	var rand = Math.ceil( Math.random() * 100000);

	$.post('ajax/post/list_comment.php', {rand: rand, postId: $('#postId').val(), comentario: q},
		function(resposta)
		{
                    alert("Comentario enviado com sucesso.");
                    objEditor.setData("");

                    showFormComente();
                    
                    $('#comentarios').html(resposta);
		}
	);
    }
    else
    {
        alert("Preencha o campo com o comentario.");
    }
}

function paginacao(pag)
{
	var rand = Math.ceil( Math.random() * 100000);

	$.post('ajax/post/list_comment.php', {pagina: pag, rand: rand, postId: $('#postId').val()},
		function(resposta)
		{
			$('#comentarios').html(resposta);
		}
	);
}

