function validateForm(frm) {
	$('#submitButton')[0].disabled = true;
	fixMistake();
    
	var el;
    var erMessage = "";
	
	$('.req').each(function (i) {
		if ($(this).val() == "") {
			erMessage += $(this).attr('id') + "\n";
			//$(this).parent().parent().removeClass('required').addClass('mistake');
			$(this).parent().next().html("This field must not be blank").addClass('error');
		}
	});
	
	$('.email').each(function(i) {
		if ($(this).val() == "") {
			erMessage += $(this).attr('id') + "\n";
			$(this).parent().next().html("This field must not be blank").addClass('error');
		} else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test($(this).val()))){
			erMessage += "Email address is not valid\n";
			$(this).parent().next().html("Email address is not valid").addClass('error');
		}
	});
	
	$('.check').each(function(i) {
		if ($(this)[0].checked == false) {
			erMessage += $(this).attr('id') + "\n";
			$(this).parent().next().html("These checkboxes are not checked").addClass('error');
		}
	});

	if (!(erMessage == "")) {
		erMessage = "There are some problems in your form";
		alert(erMessage);
		$('#submitButton')[0].disabled = false;
		return (false);
	} else {
		return (true);
	}
}

function fixMistake() {
	$('.error').html('').removeClass('error');
}