$(document).ready(function() {
	/** Applying the SEND_MAIL_SUBMIT_BT class to a dom element,
		turns this element into a submit button.
	*/
	$(".SEND_MAIL_SUBMIT_BT").click(function(){
		$(this).parents('form:first').submit();		
	});
	/** Defines the error container based on 'errorContainer' class name. */
	var container = $('div.errorContainer');
	/** Defines the form to validate based on 'SEND_MAIL_CHECK' class */
	var formToValidate = $('.SEND_MAIL_CHECK').eq(0);
	
	var validator = formToValidate.validate({
		errorContainer: container,
		errorLabelContainer: $("ol", container),
		wrapper: 'li',
		meta: "validate"
	});
	
	$(".cancel").click(function() {
		validator.resetForm();
	});
});
