var formHtml = '<form action="" method="post" id="answerForm">';
	formHtml += '<input type="hidden" name="parentId" id="answerParentId" value="0" />';
	formHtml += '<div>Текст комментария:<br/><textarea name="comment" rows="6" cols="40"></textarea></div>';
	formHtml += '<div><input type="submit" value="добавить комментарий"/></div></form>';

Comments = function ()  {
	this.currParentId = 0;
};

Comments.prototype.showForm = function( parentId, postId ) {
	if ( this.currParentId != 0 )
		document.getElementById( 'frm-' + this.currParentId ).innerHTML = '';
	this.currParentId = parentId;
	document.getElementById( 'frm-' + this.currParentId ).innerHTML = formHtml;
	document.getElementById( 'answerForm' ).action = '/comments/posts/' + postId + '/add';
	document.getElementById( 'answerParentId' ).value = parentId;
};

var comments = new Comments();
