
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 (!validateEmail  (document.forms.frmcontact.frm_email, 		'error_email', 		true)) errs += 1; 
    	if (!validatePresent(document.forms.frmcontact.frm_name,  		'error_name'))        	errs += 1; 
	if (!validatePresent(document.forms.frmcontact.frm_message,  		'error_message'))        	errs += 1;

	if (errs>0)  alert(fieldsMandatory);

    	return (errs==0);
}

