validator={require:/.+/,email:/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,phone:/^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/,mobile:/^((\(\d{2,3}\))|(\d{3}\-))?1(3|5|7|8)\d{9}$/,url:/^http:\/\/[a-za-z0-9]+\.[a-za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/,idcard:"this.isidcard(value)",currency:/^\d+(\.\d+)?$/,number:/^\d+$/,zip:/^\d{6}$/,qq:/^[1-9]\d{4,11}$/,integer:/^[-\+]?\d+$/,double:/^[-\+]?\d+(\.\d+)?$/,english:/^[a-za-z]+$/,chinese:/^[\u0391-\uffe5]+$/,username:/^[a-z]\w{3,}$/i,unsafe:/^(([a-z]*|[a-z]*|\d*|[-_\~!@#\$%\^&\*\.\(\)\[\]\{\}<>\?\\\/\'\"]*)|.{0,5})$|\s/,issafe:function(a){return !this.unsafe.test(a)},safestring:"this.issafe(value)",filter:"this.dofilter(value, getattribute('accept'))",limit:"this.limit(value.length,getattribute('min'), getattribute('max'))",limitb:"this.limit(this.lenb(value), getattribute('min'), getattribute('max'))",date:"this.isdate(value, getattribute('min'), getattribute('format'))",repeat:"value == document.getelementsbyname(getattribute('to'))[0].value",range:"getattribute('min') < (value|0) && (value|0) < getattribute('max')",compare:"this.compare(value,getattribute('operator'),getattribute('to'))",custom:"this.exec(value, getattribute('regexp'))",group:"this.mustchecked(getattribute('name'), getattribute('min'), getattribute('max'))",erroritem:[document.forms[0]],errormessage:[t("以下原因导致提交失败")+":\t\t\t\t"],validate:function(theform,mode){var obj=theform||event.srcelement;var count=obj.elements.length;this.errormessage.length=1;this.erroritem.length=1;this.erroritem[0]=obj;for(var i=0;i(((\n)|(.))*)$/)).test(value)){this.adderror(i,getattribute("msghtml"));this.clearstate(obj.elements[i])}else{var _datatype=getattribute("datatype");if(typeof(_datatype)=="object"||typeof(this[_datatype])=="undefined"){continue}this.clearstate(obj.elements[i]);if(getattribute("require")=="false"&&value==""){continue}switch(_datatype){case"idcard":case"date":case"repeat":case"range":case"compare":case"custom":case"group":case"limit":case"limitb":case"safestring":case"filter":if(!eval(this[_datatype])){this.adderror(i,getattribute("msg"))}break;default:if(!this[_datatype].test(value)){this.adderror(i,getattribute("msg"))}else{if(getattribute("allowhtml")=="1"&&(new regexp(/^(((\n)|(.))*)<(((\n)|(.))*)>(((\n)|(.))*)$/)).test(value)){this.adderror(i,getattribute("msghtml"))}}break}}}}if(this.errormessage.length>1){mode=mode||1;var errcount=this.erroritem.length;switch(mode){case 2:for(var i=1;ib);case"greaterthanequal":return(a>=b);case"lessthan":return(a=0;b--){if(c[b].checked){e++}}return a<=e&&e<=f},dofilter:function(a,b){return new regexp("^.+.(?=ext)(ext)$".replace(/ext/g,b.split(/\s*,\s*/).join("|")),"gi").test(a)},isidcard:function(a){var i,d;var h="10x98765432";var g=[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2];var c=["","","","","","","","","","","","北京","天津","河北","山西","内蒙古","","","","","","辽宁","吉林","黑龙江","","","","","","","","上海","江苏","浙江","安微","福建","江西","山东","","","","河南","湖北","湖南","广东","广西","海南","","","","重庆","四川","贵州","云南","西藏","","","","","","","陕西","甘肃","青海","宁夏","新疆","","","","","","台湾","","","","","","","","","","香港","澳门","","","","","","","","","国外"];var b=a.match(/^(\d{2})\d{4}(((\d{2})(\d{2})(\d{2})(\d{3}))|((\d{4})(\d{2})(\d{2})(\d{3}[x\d])))$/i);if(b==null){return false}if(b[1]>=c.length||c[b[1]]==""){return false}if(b[2].length==12){d=a.substr(0,17);i=[b[9],b[10],b[11]].join("-")}else{d=a.substr(0,6)+"19"+a.substr(6);i=["19"+b[4],b[5],b[6]].join("-")}if(!this.isdate(i,"ymd")){return false}var e=0;for(var f=0;f<=16;f++){e+=d.charat(f)*g[f]}d+=h.charat(e%11);return(a.length==15||a.length==18&&a==d)},isdate:function(g,f){f=f||"ymd";var e,d,a,b;switch(f){case"ymd":e=g.match(new regexp("^((\\d{4})|(\\d{2}))([-./])(\\d{1,2})\\4(\\d{1,2})$"));if(e==null){return false}b=e[6];a=e[5]*1;d=(e[2].length==4)?e[2]:c(parseint(e[3],10));break;case"dmy":e=g.match(new regexp("^(\\d{1,2})([-./])(\\d{1,2})\\2((\\d{4})|(\\d{2}))$"));if(e==null){return false}b=e[1];a=e[3]*1;d=(e[5].length==4)?e[5]:c(parseint(e[6],10));break;default:break}if(!parseint(a)){return false}a=a==0?12:a;var h=new date(d,a-1,b);return(typeof(h)=="object"&&d==h.getfullyear()&&a==(h.getmonth()+1)&&b==h.getdate());function c(i){return((i<30?"20":"19")+i)|0}}};