 $(document).ready(function(){
 	
 	
	jQuery.validator.addMethod("pass", function( value, element ) {
		var result = this.optional(element) || value.length >= 8 && /\d/.test(value) && /[a-z]/i.test(value);
		if (!result) {
			//element.value = "";
			var validator = this;
			setTimeout(function() {
				validator.blockFocusCleanup = true;
				//element.focus();
				validator.blockFocusCleanup = false;
			}, 1);
		}
		return result;
	}, "Your password must be at least 8 characters long and contain at least one number and one character");
	
	
	$("#member_form").validate({
		rules: {
    		password_confirm: {
      			equalTo: "#password"
    		}
  		}
	});
	
	jQuery.validator.addMethod("search", function( value, element ) {
		var result = this.optional(element) || value.length >= 3 && /\d/.test(value) && /[a-z]/i.test(value);
		if (!result) {
			element.value = "";
			var validator = this;
			setTimeout(function() {
				validator.blockFocusCleanup = true;
				element.focus();
				validator.blockFocusCleanup = false;
			}, 1);
		}
		return result;
	}, "3 letters required");
	
});



