var cwarn = '#ff8', cdef = '#fff';

function mark(elem)
  {
  elem.focus();
  if (elem.style)
    elem.style.backgroundColor = cwarn;
  }

function unmarkall()
  {
  with(document.pmform)
    if (elements[0].style)
      for (var i=0; i<elements.length; ++i)
        elements[i].style.backgroundColor = cdef;
  }

function chkfrm()
  {
  with(document.pmform) {
    // Avoid empty cmt
    if (pmcmt.value == "")
      pmcmt.value = pmlink.value;
    // Confirm empty MeSH filters
    unmarkall();
    if ((h1 = pmtag01.value == "MH" && pmfilt01.value == "") || pmtag02.value == "MH" && pmfilt02.value == "") {
      if (h1)
        mark(pmfilt01)
      else
        mark(pmfilt02);
      if (!confirm(str01))
        return false;
      }
    // Confirm empty link restrictor
    unmarkall();
    if (pmlink.value == "" && pmfmt.value == "") {
      mark(pmlink);
      if (!confirm(str04))
        return false;
      }
    // Check file
    unmarkall();
    if (pmfile.value == "") {
      mark(pmfile);
      alert(str03);
      return false;
      }
    // Inform on affiliations
    if (pmtag01.value == "AD" || pmtag02.value == "AD") {
      alert(str05);
      }
    }
  return true;
  }

function help()
  {
  window.open('','help','width=500,height=400,resizable=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,toolbar=0');
  void(0); // Bei href=javascript: zwingend, bei onclick nicht
  }
