$(document).ready(function() {



	// validate signup form on keyup and submit



	var validator = $("#customer").validate({



		onkeyup: false,



		rules: {



			account: {



				required: true,



				email: true,



				remote: "username_is_ok.php"



			},



			pwd: {



				required: true,



				spassword: true,



				minlength: 6,
				
				maxlength: 20



			},



			cofpwd: {
				required: true,
				minlength: 6,
				equalTo: "#pwd"
			},
			firstname: {
				required: true,
				minlength: 2
			},
			lastname: {
				required: true,
				minlength: 2
			},
			street_address: {
				required: true,
				minlength: 4
			},

			//suburb: {
			//	required: true
			//},			



			city: {



				required: true,



				minlength: 2



			},			


/*
			zone_id: {



				required: true



			},
*/


			postcode: {
				required: true,
				minlength: 4
			},



			zone_country_id: {



				required: true



			},



				



			phone: {

				required: true,

					minlength: 5,
					
					maxlength: 20


			},



			phone12: {



				required: true,



				phone: true



			},



			phone2: {



				phone: "m"



			},



			qq: {



				required: true,



				qq: true,



		        minlength: 5,



		 		maxlength: 11



			},



			verify_code: {



				required: true,



				remote: "verify_is_ok.php"



			}



		},



		messages: {



			account: {



				required: "The information is required ！",



				email: "Please enter a valid email address！",



				remote: jQuery.format("the account you input is already exist,please try another！")



			},



			pwd: {



				required: "The information is required！",



				spassword: "Password must be between 6-20 characters！",



				minlength: "Your password is not long enough！",
				
				maxlength: "Your password is too long ！"



			},



			cofpwd: {



				required: "Please input your password again！",



				minlength: "Your password is not long enough！",



				equalTo: "Passwords must match！"



			},



			firstname: {



				required: "The information is required！",



				minlength: "the length is not enough！"



			},



			lastname: {



				required: "The information is required！",



				minlength: "the length is not enough！"



			},



			gender: {



				required: "请选择性别"



			},



			street_address: {



				required: "The information is required！",
				minlength: "the length is not enough！"




			},



			//suburb: {



			//	required: "Pls input suburb",



			//	minlength: "Sorry，it is too short！"



			//},



			city: {



				required: "The information is required！",



				minlength: "Sorry, please fill in the correct information."



			},



			zone_id: {



				required: "The information is required！"



				},



			postcode: {
				required: "The information is required！",
				minlength: "Sorry，it is too short！"
			},
			zone_country_id: {
				required: "The information is required！"
			},



			phone: {



				required: "The information is required！",

				minlength: "the length is not enough！",
					
				maxlength: "the length is too long！"



			



			},



			phone12: {



				required: "请输入您的联系电话！",



				phone: "您输入的电话格式不规范，请检查！"



			},



			phone2: {



				phone: "您输入的手机号码格式不规范，请检查！"



			},



			qq: {



				required: "请输入您的QQ号！",



				qq: "您输入的QQ号格式不规范，请检查！"



			},



			verify_code: {



				required: "Please input verify code！",



				remote: "Incorrect code！"



			}



		},



		// the errorPlacement has to take the table layout into account



		errorPlacement: function(error, element) {

			

			



			if ( element.is(":radio") )



				error.appendTo( element.parent().next() );



			else if ( element.is(":checkbox") )



				error.appendTo ( element.next().next() );



			else

              

				error.appendTo( element.parent().next());

				//element.next().addClass("error");

				



		},



		// set this class to error-labels to indicate valid fields



		success: function(tt) {



			// set &nbsp; as text for IE



			tt.html("&nbsp;").addClass("checked");

			

		  //tt.pre().hide();

			

			

			

			//tt.hide();

			//alert(typeof(tt));

			//tt.next().addClass("checked");

			



		}



	});



});