﻿function validateComment()
{
  var un = document.getElementById('UserName');
  var cm = document.getElementById('Comment');
  if (un && cm)
  {
    if (un.value == '')
    {
      alert('Введите ваше имя.');
    }
    else if (cm.value == '')
    {
      alert('Введите текст комментария.');
    }
    else
    {
      document.forms['CommentFrm'].submit();
    }
  }
  return false;
}

function submitComment(p_id)
{
  var e = document.getElementById(p_id ? ("Comment_" + p_id) : "CommentBase");
  if (e)
  {
    p_id_h = document.getElementById("ParentID");
    comm_h = document.getElementById("Comment");

    if(p_id_h && comm_h)
    {
      p_id_h.value = (p_id ? p_id : '');
      comm_h.value = e.value;
      document.forms['CommentFrm'].submit();
    }
  }
  return false;
}
