var max_chars = 1000;

function countChars(area) {
  var num = area.value.length;
  if (num > max_chars) {
    area.value = area.value.substring(0, max_chars);
    num = max_chars;
  }

  var elem = $('remaining-symbols-num');
  if (elem) {
    elem.innerHTML = max_chars - num;
  }
}

function verifyComment() {
  var elem = $('comment');
  if (elem) {
    if (elem.value.length == 0) {
      return false;
    }
  }
  return true;
}

function deleteComment(url) {
  if (confirm('Are you sure you want to delete the comment? (Won\'t be able to restore it)')) {
    document.location.href = url;
  }
}
