function checkData()
 {
  if (document.form.NameEdit.value == '')
   {
    alert('The required "Name" field is empty.');
    document.form.NameEdit.focus();
    return false;
   };
  if (document.form.ImageEdit.value == '')
   {
    alert('The required "Operation Result" field is empty.');
    document.form.ImageEdit.focus();
    return false;
   };
  if (document.form.MessageMemo.value == '')
   {
    alert('The required "Text" field is empty.');
    document.form.MessageMemo.focus();
    return false;
   };
  document.form.AddButton.disabled = true;
  return true;
 };

function showPreview()
 {
  if (checkData())
   {
    document.form.AddButton.disabled = false;
    var message = removeExtraCRLF(document.form.MessageMemo.value);
    message = stringReplace(message,'\r\n','<Br>');
    message = stringReplace(message,'\n','<Br>');
    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>Message Preview</Title><Style>HTML{Font-Size:80%;}*{Font-Size:100%;}A{Color:#884600;Text-Decoration:None;}A:Active{}A:HOver{Color:#E48F4C;}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 Width="100%" Border=0 CellPadding=3 CellSpacing=0><TR BgColor="#EAEAEA"><TD NoWrap><B>'+getDateTime()+'</B></TD><TD Width="100%" NoWrap><B>'+document.form.NameEdit.value+'</B></TD></TR><TR><TD ColSpan=2>'+message+'</TD></TR></Table></Body></HTML>');
    top.PreviewWindow.document.close();
   };
 };

