document.writeln("<script>");
document.writeln("Validator = {");
document.writeln("Require : \/.+\/,");
document.writeln("Email : \/^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$\/,");
document.writeln("Phone : \/^((\\(\\d{2,3}\\))|(\\d{3}\\-))?(\\(0\\d{2,3}\\)|0\\d{2,3}-)?[1-9]\\d{6,7}(\\-\\d{1,4})?$\/,");
document.writeln("Mobile : \/^((\\(\\d{2,3}\\))|(\\d{3}\\-))?1(3|5)\\d{9}$\/,");
document.writeln("Url : \/^http:\\\/\\\/[A-Za-z0-9]+\\.[A-Za-z0-9]+[\\\/=\\?%\\-&_~`@[\\]\\\':+!]*([^<>\\\"\\\"])*$\/,");
document.writeln("IdCard : \"this.IsIdCard(value)\",");
document.writeln("Currency : \/^\\d+(\\.\\d+)?$\/,");
document.writeln("Number : \/^\\d+$\/,");
document.writeln("Zip : \/^[1-9]\\d{5}$\/,");
document.writeln("QQ : \/^[1-9]\\d{4,8}$\/,");
document.writeln("Integer : \/^[-\\+]?\\d+$\/,");
document.writeln("Double : \/^[-\\+]?\\d+(\\.\\d+)?$\/,");
document.writeln("English : \/^[A-Za-z]+$\/,");
document.writeln("Chinese : \/^[\\u0391-\\uFFE5]+$\/,");
document.writeln("Username : \/^[a-z]\\w{3,}$\/i,");
document.writeln("UnSafe : \/^(([A-Z]*|[a-z]*|\\d*|[-_\\~!@#\\$%\\^&\\*\\.\\(\\)\\[\\]\\{\\}<>\\?\\\\\\\/\\\'\\\"]*)|.{0,5})$|\\s\/,");
document.writeln("IsSafe : function(str){return !this.UnSafe.test(str);},");
document.writeln("SafeString : \"this.IsSafe(value)\",");
document.writeln("Filter : \"this.DoFilter(value, getAttribute(\'accept\'))\",");
document.writeln("Limit : \"this.limit(value.length,getAttribute(\'min\'), getAttribute(\'max\'))\",");
document.writeln("LimitB : \"this.limit(this.LenB(value), getAttribute(\'min\'), getAttribute(\'max\'))\",");
document.writeln("Date : \"this.IsDate(value, getAttribute(\'min\'), getAttribute(\'format\'))\",");
document.writeln("Repeat : \"value == document.getElementsByName(getAttribute(\'to\'))[0].value\",");
document.writeln("Range : \"getAttribute(\'min\') < (value|0) && (value|0) < getAttribute(\'max\')\",");
document.writeln("Compare : \"this.compare(value,getAttribute(\'operator\'),getAttribute(\'to\'))\",");
document.writeln("Custom : \"this.Exec(value, getAttribute(\'regexp\'))\",");
document.writeln("Group : \"this.MustChecked(getAttribute(\'name\'), getAttribute(\'min\'), getAttribute(\'max\'))\",");
document.writeln("ErrorItem : [document.forms[0]],");
document.writeln("ErrorMessage : [\"\\t\\t\\t\\t\"],");
document.writeln("Validate : function(theForm, mode){");
document.writeln("var obj = theForm || event.srcElement;");
document.writeln("var count = obj.elements.length;");
document.writeln("this.ErrorMessage.length = 1;");
document.writeln("this.ErrorItem.length = 1;");
document.writeln("this.ErrorItem[0] = obj;");
document.writeln("for(var i=0;i<count;i++){");
document.writeln("with(obj.elements[i]){");
document.writeln("var _dataType = getAttribute(\"dataType\");");
document.writeln("if(typeof(_dataType) == \"object\" || typeof(this[_dataType]) == \"undefined\") continue;");
document.writeln("this.ClearState(obj.elements[i]);");
document.writeln("if(getAttribute(\"require\") == \"false\" && value == \"\") continue;");
document.writeln("switch(_dataType){");
document.writeln("case \"IdCard\" :");
document.writeln("case \"Date\" :");
document.writeln("case \"Repeat\" :");
document.writeln("case \"Range\" :");
document.writeln("case \"Compare\" :");
document.writeln("case \"Custom\" :");
document.writeln("case \"Group\" :");
document.writeln("case \"Limit\" :");
document.writeln("case \"LimitB\" :");
document.writeln("case \"SafeString\" :");
document.writeln("case \"Filter\" :");
document.writeln("if(!eval(this[_dataType])) {");
document.writeln("this.AddError(i, getAttribute(\"msg\"));");
document.writeln("}");
document.writeln("break;");
document.writeln("default :");
document.writeln("if(!this[_dataType].test(value)){");
document.writeln("this.AddError(i, getAttribute(\"msg\"));");
document.writeln("}");
document.writeln("break;");
document.writeln("}");
document.writeln("}");
document.writeln("}");
document.writeln("if(this.ErrorMessage.length > 1){");
document.writeln("mode = mode || 1;");
document.writeln("var errCount = this.ErrorItem.length;");
document.writeln("switch(mode){");
document.writeln("case 2 :");
document.writeln("for(var i=1;i<errCount;i++)");
document.writeln("this.ErrorItem[i].style.color = \"red\";");
document.writeln("case 1 :");
document.writeln("alert(this.ErrorMessage.join(\"\\n\"));");
document.writeln("this.ErrorItem[1].focus();");
document.writeln("break;");
document.writeln("case 3 :");
document.writeln("for(var i=1;i<errCount;i++){");
document.writeln("try{");
document.writeln("var span = document.createElement(\"SPAN\");");
document.writeln("span.id = \"__ErrorMessagePanel\";");
document.writeln("span.style.color = \"red\";");
document.writeln("this.ErrorItem[i].parentNode.appendChild(span);");
document.writeln("span.innerHTML = this.ErrorMessage[i].replace(\/\\d+:\/,\"*\");");
document.writeln("}");
document.writeln("catch(e){alert(e.description);}");
document.writeln("}");
document.writeln("this.ErrorItem[1].focus();");
document.writeln("break;");
document.writeln("default :");
document.writeln("alert(this.ErrorMessage.join(\"\\n\"));");
document.writeln("break;");
document.writeln("}");
document.writeln("return false;");
document.writeln("}");
document.writeln("return true;");
document.writeln("},");
document.writeln("limit : function(len,min, max){");
document.writeln("min = min || 0;");
document.writeln("max = max || Number.MAX_VALUE;");
document.writeln("return min <= len && len <= max;");
document.writeln("},");
document.writeln("LenB : function(str){");
document.writeln("return str.replace(\/[^\\x00-\\xff]\/g,\"**\").length;");
document.writeln("},");
document.writeln("ClearState : function(elem){");
document.writeln("with(elem){");
document.writeln("if(style.color == \"red\")");
document.writeln("style.color = \"\";");
document.writeln("var lastNode = parentNode.childNodes[parentNode.childNodes.length-1];");
document.writeln("if(lastNode.id == \"__ErrorMessagePanel\")");
document.writeln("parentNode.removeChild(lastNode);");
document.writeln("}");
document.writeln("},");
document.writeln("AddError : function(index, str){");
document.writeln("this.ErrorItem[this.ErrorItem.length] = this.ErrorItem[0].elements[index];");
document.writeln("this.ErrorMessage[this.ErrorMessage.length] = this.ErrorMessage.length + \":\" + str;");
document.writeln("},");
document.writeln("Exec : function(op, reg){");
document.writeln("return new RegExp(reg,\"g\").test(op);");
document.writeln("},");
document.writeln("compare : function(op1,operator,op2){");
document.writeln("switch (operator) {");
document.writeln("case \"NotEqual\":");
document.writeln("return (op1 != op2);");
document.writeln("case \"GreaterThan\":");
document.writeln("return (op1 > op2);");
document.writeln("case \"GreaterThanEqual\":");
document.writeln("return (op1 >= op2);");
document.writeln("case \"LessThan\":");
document.writeln("return (op1 < op2);");
document.writeln("case \"LessThanEqual\":");
document.writeln("return (op1 <= op2);");
document.writeln("default:");
document.writeln("return (op1 == op2);");
document.writeln("}");
document.writeln("},");
document.writeln("MustChecked : function(name, min, max){");
document.writeln("var groups = document.getElementsByName(name);");
document.writeln("var hasChecked = 0;");
document.writeln("min = min || 1;");
document.writeln("max = max || groups.length;");
document.writeln("for(var i=groups.length-1;i>=0;i--)");
document.writeln("if(groups[i].checked) hasChecked++;");
document.writeln("return min <= hasChecked && hasChecked <= max;");
document.writeln("},");
document.writeln("DoFilter : function(input, filter){");
document.writeln("return new RegExp(\"^.+\\.(?=EXT)(EXT)$\".replace(\/EXT\/g, filter.split(\/\\s*,\\s*\/).join(\"|\")), \"gi\").test(input);");
document.writeln("},");
document.writeln("IsIdCard : function(number){");
document.writeln("var date, Ai;");
document.writeln("var verify = \"10x98765432\";");
document.writeln("var Wi = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];");
document.writeln("var area = [\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'北京\',\'天津\',\'河北\',\'山西\',\'内蒙古\',\'\',\'\',\'\',\'\',\'\',\'辽宁\',\'吉林\',\'黑龙江\',\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'上海\',\'江苏\',\'浙江\',\'安微\',\'福建\',\'江西\',\'山东\',\'\',\'\',\'\',\'河南\',\'湖北\',\'湖南\',\'广东\',\'广西\',\'海南\',\'\',\'\',\'\',\'重庆\',\'四川\',\'贵州\',\'云南\',\'西藏\',\'\',\'\',\'\',\'\',\'\',\'\',\'陕西\',\'甘肃\',\'青海\',\'宁夏\',\'新疆\',\'\',\'\',\'\',\'\',\'\',\'台湾\',\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'香港\',\'澳门\',\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'\',\'国外\'];");
document.writeln("var re = number.match(\/^(\\d{2})\\d{4}(((\\d{2})(\\d{2})(\\d{2})(\\d{3}))|((\\d{4})(\\d{2})(\\d{2})(\\d{3}[x\\d])))$\/i);");
document.writeln("if(re == null) return false;");
document.writeln("if(re[1] >= area.length || area[re[1]] == \"\") return false;");
document.writeln("if(re[2].length == 12){");
document.writeln("Ai = number.substr(0, 17);");
document.writeln("date = [re[9], re[10], re[11]].join(\"-\");");
document.writeln("}");
document.writeln("else{");
document.writeln("Ai = number.substr(0, 6) + \"19\" + number.substr(6);");
document.writeln("date = [\"19\" + re[4], re[5], re[6]].join(\"-\");");
document.writeln("}");
document.writeln("if(!this.IsDate(date, \"ymd\")) return false;");
document.writeln("var sum = 0;");
document.writeln("for(var i = 0;i<=16;i++){");
document.writeln("sum += Ai.charAt(i) * Wi[i];");
document.writeln("}");
document.writeln("Ai += verify.charAt(sum%11);");
document.writeln("return (number.length ==15 || number.length == 18 && number == Ai);");
document.writeln("},");
document.writeln("IsDate : function(op, formatString){");
document.writeln("formatString = formatString || \"ymd\";");
document.writeln("var m, year, month, day;");
document.writeln("switch(formatString){");
document.writeln("case \"ymd\" :");
document.writeln("m = op.match(new RegExp(\"^((\\\\d{4})|(\\\\d{2}))([-.\/])(\\\\d{1,2})\\\\4(\\\\d{1,2})$\"));");
document.writeln("if(m == null ) return false;");
document.writeln("day = m[6];");
document.writeln("month = m[5]*1;");
document.writeln("year = (m[2].length == 4) ? m[2] : GetFullYear(parseInt(m[3], 10));");
document.writeln("break;");
document.writeln("case \"dmy\" :");
document.writeln("m = op.match(new RegExp(\"^(\\\\d{1,2})([-.\/])(\\\\d{1,2})\\\\2((\\\\d{4})|(\\\\d{2}))$\"));");
document.writeln("if(m == null ) return false;");
document.writeln("day = m[1];");
document.writeln("month = m[3]*1;");
document.writeln("year = (m[5].length == 4) ? m[5] : GetFullYear(parseInt(m[6], 10));");
document.writeln("break;");
document.writeln("default :");
document.writeln("break;");
document.writeln("}");
document.writeln("if(!parseInt(month)) return false;");
document.writeln("month = month==0 ?12:month;");
document.writeln("var date = new Date(year, month-1, day);");
document.writeln("return (typeof(date) == \"object\" && year == date.getFullYear() && month == (date.getMonth()+1) && day == date.getDate());");
document.writeln("function GetFullYear(y){return ((y<30 ? \"20\" : \"19\") + y)|0;}");
document.writeln("}");
document.writeln("}");
document.writeln("<\/script>");












