$(document).ready(function() {
	$('form').submit(function() {
		var msg = ''
		$(this).find('input,textarea').each(function() {
			if($(this).attr('required')) {
				if($(this).val() == '') msg += $('label[for="' + $(this).attr('id') + '"]').html() + ', ';
			}
		});
		if(msg != '') {
			$(this).find('fieldset p.err').remove();
			$(this).find('fieldset').prepend('<p class="err">The following fields are required: ' + msg + '</p>');
			return false;
		}
		return true;
	});
});