$(document).ready(function(){

	$.validator.methods.strlen= function(value,element,param){
       var  str =$(element).val();
       var  len =0;
       for(var i=0;i<str.length;i++){
          if(str.charCodeAt(i)>255){
             len +=2;
          }
          else{
             len +=1;
          }
       }
       return (len -param)<=0;
	}
    $("#Form1").validate({
		event: "keyup",
		rules: {
			txtName: {
				required: true,
				maxlength:50
			},
			txtTel: {
				required: true,
				maxlength:50
			},
			txtSort: {
				required: true,
				number:true,
				range: [0,999999]
			}
		},		
		messages: {
			txtName: {
				required: "请输入快递公司名称",
				maxlength: "最大长度只能在25个汉字(50个字符)以内"
			},
			txtTel: {
			    required: "请输入快递公司电话",
				strlen: "最大长度只能在25个汉字(50个字符)以内"
			},
			txtSort: {
				required: "请输入序号,",
				range: "请输入序号(1-999999)"
			}
		},
		debug:"false",
		submitHandler:function(form){
			form.submit();
		}
	});
});

