var Comment = new Object();
//shows the comment form
Comment.showForm = function() {
	$( '#commentFormDiv' ).show();
	$( '#comment' ).hide();
}
//adds the new comment - sends the request to the server with the comment
Comment.addNewComment = function() {
	$('#commentErrors').hide();
	$.post( '/ajax/comment/add/', { poll:$( '#poll' ).val(), cont:$( '#cont' ).val(), who:$( '#who' ).val() }, Comment.refreshPage );
}
//refreshes the page
Comment.refreshPage = function(data) {
	if( $(data).find('state').text()=="invalid" ) {
		$('#commentErrors').show();
	} else {
		$( '#commentFormDiv' ).hide();
		document.location = document.location;
	}
}