 function validateOnSubmit() {
    var elem;
    var errs=0;
    // execute all element validations in reverse order, so focus gets
    // set to the first one in error.

    if (!validateTelnr  (document.forms.sendmail.tel, 'inf_tel', true)) errs += 1; 
    if (!validateEmail  (document.forms.sendmail.email, 'inf_email', true)) errs += 1; 
    if (!validatePresent(document.forms.sendmail.comments,  'inf_message'))        errs += 1; 
   if (!validatePresent(document.forms.sendmail.lname,  'inf_fname'))        errs += 1; 
   if (!validatePresent(document.forms.sendmail.company,  'inf_cname'))        errs += 1; 


  if (!validatePresent(document.forms.sendmail.capcode,  'inf_code'))        errs += 1; 



    if (errs>1)  alert('Please check the form.\rThere are fields which need correction before sending');
    if (errs==1) alert('Please check the form.\rThere is a field which needs correction before sending.');

    return (errs==0);
  };

