function checkFillContent(value)
{
	if (value == '') {
		alert("Заполните поле комментарий");
		return false;
	}
	return true;
}

function saveComment(pid, type)
{
	var content = document.getElementById('comment_content_' + pid).value;

	var login = document.getElementById('comment_login_' + pid).value;


	if (checkFillContent(content)) {
		xajax_run('xcomments','saveComment', pid,
			content, 
			type, 
			login, 
			document.getElementById('comment_pass_'+pid).value);
	}
}

function changeCommentNode(id)
{
	if (document.getElementById('comment_child_' + id).style.display == 'none') {
		openSubComments(id);
	} else {
		closeSubComments(id);
	}
}

function openSubComments(id)
{
	if (document.getElementById('comment_child_' + id).innerHTML == '') {
		xajax_run('xcomments','showSubComments', id);
		document.getElementById('comment_child_' + id).style.display = 'block';
	} else {
		document.getElementById('comment_child_' + id).style.display = 'block';
	}
	document.getElementById('comment_img_' + id).src = "images/xcomments/minus.gif";
}

function closeSubComments(id)
{
	document.getElementById('comment_child_' + id).style.display = 'none'; 
    document.getElementById('comment_img_' + id).src = "images/xcomments/plus.gif";
}
