// ----------------------------------------------------------------------
//
//		VALIDATION CODE
//
// ----------------------------------------------------------------------

    function validateOnSubmit(vehicle_state) {
        var elem;
        var errs = 0;
        // execute all element validations in reverse order, so focus gets
        // set to the first one in error.
	
        if (!validatePresent(document.forms.applyform.name, 'inf_name')) errs += 1;
        if (!validateEmail(document.forms.applyform.email, 'inf_email', true)) errs += 1;
        if (!validatePresent(document.forms.applyform.phone, 'inf_phone')) errs += 1;
        if (!validatePresent(document.forms.applyform.question, 'inf_question')) errs += 1;
        if (errs > 1) alert('There are fields which need correction before sending');
        if (errs == 1) alert('There is a field which needs correction before sending');
	
	return (errs==0);
    };
    

