$(document).ready(function() {
  //  applicant_phone_number_required.php has embedded script, so don't bother with this...
  if (document.getElementById('background-auth')) { return; }
  
  /* SUBMIT THE FORM */
	var $validationSummary = $('<div/>').addClass('validation-summary js-hide error').appendTo('div.actions');
	
	$('#theform').submit(function(event) {
		event.preventDefault();
      var errors = FM.validate('theform');
      if (errors.length) {
        errors = '<div>' + errors.join('</div><div>') + '</div>';
        $validationSummary.html(errors).fadeIn();
      } else {
        $validationSummary.empty().hide();
        this.submit();
      }

	});
	
});

