var validatorMap=new Hash({required:["本项必填",function(b,a){return a!=null&&a!=""&&a.trim()!=""}],number:["请录入数值",function(b,a){return a==null||a==""||!isNaN(a)&&!/^\s+$/.test(a)}],params1:["参数名中不能含有单引号或双引号",function(b,a){return !/(?:\"|\')/.test(a)}],params2:["参数组名称中不能含有单引号或双引号",function(b,a){return !/(?:\"|\')/.test(a)}],msn:["请输入MSN",function(b,a){return a==null||a==""||/\S+@\S+/.test(a)}],skype:["请输入Skype",function(b,a){return a==null||a==""||!/\W/.test(a)||/^[a-zA-Z0-9]+$/.test(a)}],digits:["请录入整数",function(b,a){return a==null||a==""||!/[^\d]/.test(a)}],unsignedint:["请录入正整数",function(b,a){return a==null||a==""||(!/[^\d]/.test(a)&&a>0)}],unsigned:["请输入大于等于0的数值",function(b,a){return a==null||a==""||(!isNaN(a)&&!/^\s+$/.test(a)&&a>=0)}],positive:["请输入大于0的数值",function(b,a){return a==null||a==""||(!isNaN(a)&&!/^\s+$/.test(a)&&a>0)}],alpha:["请录入英文字母",function(b,a){return a==null||a==""||/^[a-zA-Z]+$/.test(a)}],alphaint:["请录入英文字母或者数字",function(b,a){return a==null||a==""||!/\W/.test(a)||/^[a-zA-Z0-9]+$/.test(a)}],space:["请确认录入不包含空格",function(b,a){return/^\S+$/.test(a)}],alphanum:["请录入英文字母、中文及数字",function(b,a){return a==null||a==""||!/\W/.test(a)||/^[\u4e00-\u9fa5a-zA-Z0-9]+$/.test(a)}],date:["请录入日期格式yyyy-mm-dd",function(b,a){return a==null||a==""||/^(19|20)[0-9]{2}-([1-9]|0[1-9]|1[012])-([1-9]|0[1-9]|[12][0-9]|3[01])+$/.test(a)}],email:["请录入正确的Email地址",function(b,a){return a==null||a==""||/^([a-zA-Z0-9]+[_|\-\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/.test(a)}],mobile:["请录入正确的手机号码",function(b,a){return a==null||a==""||/^1[3|4|5|7|8][0-9]\d{8}$/.test(a)}],tel:["请录入正确的固话号码",function(b,a){return a==null||a==""||/^\d{3,4}-\d{7,8}(?:$|-\d{4,6}$)/.test(a)}],text:["",function(b,a){return true}],select:["",function(b,a){return true}],radio:["",function(b,a){return true}],checkbox:["",function(b,a){return true}],url:["请录入正确的网址",function(b,a){return a==null||a==""||/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*)(:(\d+))?\/?/i.test(a)}],area:["请选择完整的地区",function(b,a){return b.getElements("select").every(function(d){var c=d.getValue();return c!=""&&c!="_NULL_"})}],requiredcheckbox:["必须选择一项",function(b){var a=b.getParent().getElements("input[type=checkbox]");a.removeEvents("change").addEvent("change",function(){if(validator.test(b.form,b)){validator.removeCaution(b)}});return a.some(function(c){return c.checked})}]});var validator=new Abstract({test:function(b,g){b=b||$(document.body);g=$(g);if(g.get("type")=="hidden"){if(g.getParent()&&!g.getParent().isDisplay()){return true}}else{if(!g.isDisplay()&&g.get("vtype")!="checkForm"){return true}}this.bindBlurWithValidator(b,g);var l=[],j=g.get("required"),f=g.get("vtype"),k=g.get("caution");var d=b?b.get("extra"):false;if(f&&f.contains("&&")){f=f.split("&&")}if(j){l.include("required")}if(!!f){l.include(f)}l=l.flatten();var a=l.every(function(o){var p=true;var n=validatorMap.get(o)||window[o];if(!n){return p}var q=k||n[0];var m=n[1];if($type(m)=="function"){p=m(g,g.getValue())}if(!p){this.showCaution(g,q)}return p},this);if(!a){return false}if(d&&extra_validator){var i=extra_validator[d];if(!i){return true}var e=i[f];if(!e){return true}var h=e[0];var c=e[1];if(!c(b,(g.getVlaue?g.getVlaue():g))){this.showCaution(g,h);return false}}return true},showCaution:function(a,c){var b=$(a).getNext();if(b&&b.get("name")&&b.get("name").contains("validationMsgBox")){return}if(!c||c.trim()==""){return}new Element("div",{"class":"x-vali-error",name:"validationMsgBox",html:c}).injectAfter(a)},removeCaution:function(a){var b=$(a).getNext();if(b&&b.get("name")&&b.get("name").contains("validationMsgBox")){return b.remove()}},bindBlurWithValidator:function(c,a){var b=$$(a,a.getFormElements());b.removeEvents("blur").addEvent("blur",function(){this.removeCaution(a);this.test(c,a)}.bind(this))}});