function commentAdded(request) {
  $('errors').style.display = "none";
  new Effect.BlindDown($('commentlist').lastChild);
  $('comment').value = '';
  $('comment').focus();
}

function failure(request) {
  $('errors').style.display = "block";
  $('errors').innerHTML = "";
  $('errors').innerHTML = request.responseText;
  new Effect.Highlight('errors');
}

function loading() {
  $('submit').style.visibility = "hidden";
  Element.show('comment_loading');
}

function complete(request) {
  Element.hide('comment_loading');
  Element.show('commentform');
  $('submit').style.visibility = "visible";

  if (request.status == 200) {commentAdded()}
  else {failure(request)};
}
