function is_validated() {
	var validation_arguments = arguments;

	var validation_mode = validation_arguments[0];
	var form_name = document.forms[validation_arguments[1]]
	var form_element = form_name.elements[validation_arguments[2]];

	var valExpr = Array();
		valExpr.captcha_layout_is_not_correct		= "^[0-9]{5}$";
		valExpr.email_layout_is_not_correct			= "^[0-9a-z][+.0-9_a-z-]*@([0-9a-z][0-9a-z-]*[.])+[a-z]{2,6}$";
		valExpr.date_layout_is_not_mysql			= "^[0-9]{4}-[0-9]{2}-[0-9]{2}$";
		valExpr.password_layout_is_not_correct		= "^[0-9a-z`~!@#$%^&*()+=_-]{" + TPL.password_min_size + "," + TPL.password_and_username_max_size + "}$";
		valExpr.phone_layout_is_not_correct			= "^(([+][0-9]{1,4}[ ]?)?[(./-]?[0-9]{1,6}[)./-]?[ ]?)?([0-9]{1,3}[./ -]?)?[0-9]{1,3}[./ -]?[0-9]{1,3}$";
		valExpr.timestamp_layout_is_not_correct		= "^[0-9]{14}$";
		valExpr.username_layout_is_not_correct		= "^[0-9_a-z]{1," + TPL.password_and_username_max_size + "}$";
		valExpr.url_layout_is_not_correct			= "^http://([0-9a-z][0-9a-z-]*[.])+[a-z]{2,6}(/.*)?$";
		valExpr.search_field_layout_is_not_correct	= "^[0-9a-zą-’ _:/.-]{1,255}$";
	valExpr = (valExpr[validation_mode] !== undefined) ? new RegExp(valExpr[validation_mode], "i") : null;

	function evaluate(error_name, field_to_focus, term) {
		if (eval(term)){
			alert(TPL.error[error_name][TPL.language]);
			field_to_focus.focus();
			return false;
		}
		return true;
	}

	function queue(term) {
		for (i = 2; i < validation_arguments.length; i++) {
			form_element = form_name.elements[validation_arguments[i]];
			if (!evaluate(validation_mode, form_element, term))
				return false;
		}
		return true;
	}

	switch (validation_mode) {
		case "field_is_empty":
		case "captcha_is_not_entered":
		case "email_is_not_entered":
		case "search_field_is_empty": return queue('form_element.value == ""');

		case "user_is_not_agree": return queue('!form_element.checked');

		case "text_is_too_big": return queue('form_element.value.length > TPL.textfield_max_size');

		case "passwords_do_not_match":
			return evaluate('passwords_do_not_match',
							form_name.elements[validation_arguments[3]],
							(validation_arguments.length == 4) ? 'form_element.value != form_name.elements[validation_arguments[3]].value' : 'true');

		default: return queue('form_element.value != "" && !valExpr.test(form_element.value)');
	}
}
