function validateForm(frm) {
	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) {
		var checkName = $(this).attr('name');
		var myOption = -1;
		$('[name="'+checkName+'"]').each(function(i) {
			if ($(this)[0].checked) {
				myOption = i;
				i=$('[name="'+checkName+'"]').length;
			}
		});
		if (myOption == -1) {
			erMessage += $(this).attr('id') + "\n";
			$(this).parent().next().html("At least one must be checked").addClass('error');
		}
	});

	if (!(erMessage == "")) {
		erMessage = "There are some problems in your form";
		alert(erMessage);
		return (false);
	} else {
		return (true);
	}
}

function fixMistake() {
	$('.error').html('').removeClass('error');
}