function checkData()
 {
  if (document.form.NameEdit.value == '')
   {
    alert('Не заполнено обязательное поле "Имя".');
    document.form.NameEdit.focus();
    return false;
   };
  if (document.form.ImageEdit.value == '')
   {
    alert('Не заполнено обязательное поле "Результат операции".');
    document.form.ImageEdit.focus();
    return false;
   };
  if (document.form.MessageMemo.value == '')
   {
    alert('Не заполнено обязательное поле "Текст".');
    document.form.MessageMemo.focus();
    return false;
   };
  document.form.AddButton.disabled = true;
  return true;
 };

function showPreview()
 {
  if (checkData())
   {
    document.form.AddButton.disabled = false;
    top.PreviewWindow = window.open('','PreviewWindow','width=640,height=480,resizable=yes,menubar=no,toolbar=no,location=no,directories=no,scrollbars=yes,status=no');
    top.PreviewWindow.document.write('<HTML><Head><Title>Предпросмотр комментария</Title><Style>HTML{Font-Size:80%;}*{Font-Size:100%;}A{Color:#285CB3;Text-Decoration:None;}A:Active{}A:HOver{Color:#4C69E4;}A:Visited{}BlockQuote{Border-Left:1px Solid Gray;Color:Gray;Padding-Left:1em;}Body{Font-Family:Arial,Helvetica,Sans-Serif,Times;Background-Color:White;}</Style></Head><Body OnLoad="self.focus();"><Table Border=0 CellPadding=3 CellSpacing=0 Width=100%><TR BgColor=#EEEEEE><TD><NoBr><B>'+getDateTime()+'</B></NoBr></TD><TD Width=100%><NoBr><B>'+document.form.NameEdit.value+'</B></NoBr></TD></TR><TR><TD ColSpan=2>'+stringReplace(removeExtraCRLF(document.form.MessageMemo.value),'\r\n','<Br>')+'</TD></TR></Table></Body></HTML>');
    top.PreviewWindow.document.close();
   };
 };
