function DPA(e,c){var a=new Array();var d,b;for(d=0;d<e.length+1;d++){a[d]=new Array()}a[0][0]=0;for(b=1;b<=c.length;b++){a[0][b]=a[0][b-1]-0+1}for(d=1;d<=e.length;d++){a[d][0]=a[d-1][0]-0+1;for(b=1;b<=c.length;b++){var f=a[d-1][b-1];if(e.charAt(d-1)!=c.charAt(b-1)){f++}a[d][b]=Math.min(f,Math.min(a[d-1][b]-0+1,a[d][b-1]-0+1))}}return a[e.length][c.length]}EMAIL_LIST=["163.com","126.com","139.com","188.com","2008.china.com","2008.sina.com","21cn.com","263.net","china.com","chinaren.com","citiz.net","eyou.com","foxmail.com","gmail.com","hongkong.com","hotmail.com","live.cn","live.com","mail.china.com","msn.com","my3ia.sina.com","qq.com","sina.cn","sina.com","sina.com.cn","sogou.com","sohu.com","tom.com","vip.163.com","vip.qq.com","vip.sina.com","vip.sohu.com","vip.tom.com","yahoo.cn","yahoo.com","yahoo.com.cn","yahoo.com.hk","yahoo.com.tw","yeah.net"];function email_like(c){var b=c.split("@"),g=b[1]||"",a=g.length,f;for(k=0;k<EMAIL_LIST.length;k++){var h=EMAIL_LIST[k],i=DPA(g,h);if(i<a){a=i;f=h}}if(a&&a<4){return f}}function fixemail_set(){var d=$("#email"),b=d.val(),a=$("#fixemail"),f=email_like(b);if(f){d.val(b.split("@")[0]+"@"+f)}a.fadeOut()}function fixemail_hide(a){$(a.parentNode).fadeOut();$("#password").focus()}function check_email(f){var a=$("#err_email"),d=$("#email");var c=$.trim(d.val());d.val(c);if(f){var b=email_like(c),e=c.split("@")[0];if(b){a.html('<b class="fixmail_name" style="font-weight:normal;color:#666"></b><b class="fixmail_domain"></b> <a onclick="fixemail_set();fixemail_hide(this)" href="javascript:void(0)">是</a> <b style="font-weight:normal;color:#666">/</b> <a onclick="fixemail_hide(this)" href="javascript:void(0)">否</a>');a.find(".fixmail_name").text("你是否要输入 "+e+"@");a.find(".fixmail_domain").text(b);a.fadeIn().find("a:first").focus();return}}if(!/^[_\.0-9a-zA-Z+-]+@([0-9a-zA-Z]+[0-9a-zA-Z-]*\.)+[a-zA-Z]{2,4}$/.exec(c)){a.text("请输入正确的Email地址").fadeIn();d.focus();return}return 1}function check_name(){var b=$("#err_name"),a=$("#name"),d=a.val().length,c;if(d){if(d>16){c="名号不要超过8个汉字或16个英文字符"}}else{c="请输入名号"}if(c){a.focus();b.text(c).fadeIn()}else{return 1}}function check_password(){var b=$("#err_password"),a=$("#password"),d=a.val().length,c;if(d){if(d<6){c="密码不得少于6个字符"}if(d>60){c="密码不得多于60个字符"}}else{c="请输入密码"}if(c){a.focus();b.text(c).fadeIn()}else{return 1}}function submit_form(){var a=1;a&=check_name();a&=check_password();a&=check_email();if(a){return true}return false}$(function(){$(".Pform input:first").focus();$("#email").blur(check_email).change(function(){$("#err_email").hide()});$("#name").blur(check_name).change(function(){$("#err_name").hide()});$("#password").blur(check_password).change(function(){$("#err_password").hide()})});