var _gg_uacct="UA-4429972-13";if(typeof(IDo)==="undefined"){IDo=$=function(id){return document.getElementById("id");};IDo.extra=function(f,t){for(var i in f){t[i]=f[i];}};IDo.Ajax=function(){};IDo.log=function(str){try{console.log(str)}catch(e){}};}var WN_Register=(function(){var cache={};_blockMsg=IDo.MsgBox.getAlertInstance("注册申请提交中，请稍后...",'',null,false).extra({className:"regOptLoad optDef"}).setButtons();var ajax=new $.Ajax("/register/register.do","post",null,"text/json").extra({$onSuccessed:function(){_blockMsg.close();this.blockFlag=false;var url=this.backData["url"];if(url){url=decodeURIComponent(url);}else{url="/success.html";}location.replace(url);},$onFailed:function(){_blockMsg.close();this.blockFlag=false;var code=this.backData["code"]*1;var url=this.backData["url"];if(url){url=decodeURIComponent(url);location.replace(url);}var _errFun=function(){switch(code){case 20008:WN_Register.get("verify").ipt.value='';WN_Register.get("verify").ipt.focus();break;}};IDo.MsgBox.alert(this.backData["des"],"",_errFun,_errFun);WN_Register.loadVerifyImg();},blockFlag:false});var accAjax=new $.scriptLoader("http://register.woniu.com/direct/PassportCheck.do",{"method":"validateAccount","jsoncallback":"WN_Register.accBack"}).extra({$onSuccessed:function(para){if(para){this.result=para;}para=para||this.result;var acc=getCache("account");if(para["result"].toUpperCase()=="Y"){acc.pass=true;acc.check();}else{var ret="该帐号已被其他用户使用，请重新选择";acc.pass=ret;acc.check();}}});var nickAjax=new $.Ajax("/register/validateNickName.do","Post",null,"text/json").extra({$onSuccessed:function(){var nick=getCache("nickName");nick.pass=true;nick.check();var extra=getCache("extra");extra.pass=undefined;},$onFailed:function(){var nick=getCache("nickName");nick.pass=this.backData["des"]||"该昵称已被占用，请重新选择";nick.check();var extra=getCache("extra");extra.pass=undefined;}});var _defTip=document.createElement("div");function getCache(nm){return cache[nm];}return{get:getCache,getRegAjax:function(){return ajax;},getAccAjax:function(){return accAjax;},accBack:function(dt){accAjax.$onSuccessed(dt);},getNickAjax:function(){return nickAjax;},regFun:function(hand,fun){if(window.attachEvent){hand.attachEvent("on"+hand,fun);}else{hand.addEventListener(hand,fun,false);}},submit:function(){ajax.asyncAsk();},Item:function(_key,_ipt,_tip,_keepCache){this.childs=[];this.key=_key;this.ipt=typeof(_ipt)=="string"?$(_ipt):_ipt;this.tip=(_ipt&&typeof(_tip)=="string")?$(_tip):(_tip||_defTip);this.tip.def=this.tip.innerHTML;this.keepCache=_keepCache===false?false:true;this.pass=undefined;this.bindEvent();cache[_key]=this;}}})();WN_Register.Item.prototype={extra:function(o){for(var i in o){this[i]=o[i];}return this;},add:function(_item){if(_item instanceof(WN_Register.Item)){this.childs.push(_item);}return this;},get:function(nm){nm=nm||"ipt";return this.ipt;},syncVerify:function(){var ret;var childs=this.childs;for(var i in childs){ret=childs[i].check();if(!childs[i].keepCache){childs[i].pass=undefined};if(ret!==true){break;}}return ret||true;},check:function(recheckFlag){if(recheckFlag==true){this.pass=undefined;}var ret;if(this.pass===undefined){ret=this.$verify();}else{ret=this.pass;}this.pass=ret;this.pass===true?this.$onSuccessed():(this.pass===false||typeof this.pass=="string"?this.$onFailed(ret):this.$onCheck());return ret;},$verify:function(_callBack){throw new Error("未实现");},$onSuccessed:function(){var showPassFlag=this.ipt.value.length>0;this.tip.innerHTML=showPassFlag?"&nbsp;":"";this.tip.className=showPassFlag?"commonRegTcTs right":"commonRegTcTs";$.log(this.tip.id,this.pass);if(this.$cbSucc){this.$cbSucc();}},$onFailed:function(_r){this.tip.innerHTML=_r||"x";this.tip.className="commonRegTcTs wrong";this.doBlink();this.ipt.select();$.log(this.tip.id,this.pass);if(this.$cbFail){this.$cbFail();}},$onCheck:function(){this.pass=null;this.tip.innerHTML="检测中...";this.tip.className="commonRegTcTs";$.log(this.tip.id,this.pass);if(this.$cbCheck){this.$cbCheck();}},$tip:function(str){this.tip.style.display="";if(!this.ipt.value.length){this.tip.innerHTML=this.tip.def;this.tip.className="commonRegTcTs";}else if(this.pass===undefined){var _str=this.tip.def||str;this.tip.innerHTML=_str;}else{}},bindEvent:function(){var me=this;if(!this.ipt)return;this.ipt.onfocus=function(){me.$tip();};var tag=this.ipt.type.toLowerCase();if(tag=="checkbox"||tag=="radio"){this.ipt.onclick=function(){me.check(true);};}else{this.ipt.onchange=function(){me.check(true);};}if(this.blurFun){this.ipt.onblur=this.blurFun.bind(this);}if(this.tip){this.tip.style.display="none";}return this;},doBlink:function(){WN_PlatForm.gameOptTips(this.ipt);}};$.extra({___focusTip:function(){},___changeVerify:function(){this.$verify();}},WN_Register);$.extra({init:function(){this.initForm();this.loadVerifyImg();},getParas:function(){var basic=$.$("#ipt{account password rpwd spreadName verify}").vals();basic.password2=basic.rpwd;var extra=$.$("#ipt{email nickName realName identity}").vals();var sex=$("ipt.sex_1").checked?"1":"0";var all=$.extra(basic,extra,true);all.sex=sex;for(var _a in all){all[_a]=(all[_a]+"").trim();}return all;},initForm:function(){var account=new WN_Register.Item("account","ipt.account","tip.account").extra({$verify:function(){var val=this.ipt.value;var flag=Reg_Verify.account(val);if(flag==true){WN_Register.getAccAjax().ask({account:val,userName:val});}else{return flag;}}});var password=new WN_Register.Item("password","ipt.password","tip.password",false).extra({$verify:function(){var rv=$("ipt.rpwd").value;var v=this.ipt.value;if(rv.length&&v.length){WN_Register.get("rpwd").check(true);}return Reg_Verify.password(v,$("ipt.account").value,rv);},blurFun:function(){if(this.pass==true||this.pass==false){this.check(true);}}}).bindEvent();var rpwd=new WN_Register.Item("rpwd","ipt.rpwd","tip.rpwd",false).extra({$verify:function(){return Reg_Verify.rpwd(this.ipt.value,$("ipt.password").value);},blurFun:function(){if(this.pass==true||this.pass==false){this.check(true);}},$cbFail:function(){}}).bindEvent();var extra=new WN_Register.Item("extra","ipt.extra",null,false).extra({$verify:function(){var ret=false;var dom=$("reg.extraMore");if(this.ipt.checked){if(dom.offsetHeight<100){dom.style.display="";WNSNS.expandDom(dom,0,254,'y',function(){dom.style.overflow="";});}ret=this.syncVerify();}else{if(dom.offsetHeight>100){dom.style.overflow="hidden";WNSNS.collapseDom(dom,254,0,'y',function(){dom.style.display="none";});}ret=true;}return ret;},$onSuccessed:function(){$.info("pass extra");},$onFailed:function(){},$onCheck:function(){this.pass=undefined;}});var verify=new WN_Register.Item("verify","ipt.verify","tip.verify").extra({$verify:function(){return Reg_Verify.verify(this.ipt.value);}});var agree=new WN_Register.Item("agree","ipt.agree","tip.agree").extra({$verify:function(){return this.ipt.checked?true:"请选择接受协议";}});this.form=new WN_Register.Item(null,null,null,false).extra({$verify:function(){return this.syncVerify();},$onSuccessed:function(){$.info("pass all");var regAjax=WN_Register.getRegAjax();if(regAjax.blockFlag==true){return;}var postVars=WN_Register.getParas();var extraVars=WN_Register.getExtraParas();$.extra(extraVars,postVars);regAjax.blockFlag=true;regAjax.asyncAsk(postVars,true);this.pass=undefined;_blockMsg.open();},$onFailed:function(){this.pass=undefined;},$onCheck:function(){this.pass=undefined;}}).add(account).add(password).add(rpwd).add(extra).add(verify).add(agree);var email=new WN_Register.Item("email","ipt.email","tip.email").extra({$verify:function(){return Reg_Verify.email(this.ipt.value);}});var nickName=new WN_Register.Item("nickName","ipt.nickName","tip.nickName").extra({$verify:function(){var val=this.ipt.value.trim();var flag=Reg_Verify.nickName(val);if(flag==true&&val.length>0){WN_Register.getNickAjax().asyncAsk({nickName:val},true);}else{return flag;}}});var sex0=new WN_Register.Item("sex","ipt.sex_0","tip.sex").extra({$verify:function(){return Reg_Verify.sex(this.ipt.value);}});var sex1=new WN_Register.Item("sex","ipt.sex_1","tip.sex").extra({$verify:function(){return Reg_Verify.sex(this.ipt.value);}});var realName=new WN_Register.Item("realName","ipt.realName","tip.realName",false).extra({$verify:function(){return Reg_Verify.realName(this.ipt.value,$("ipt.identity").value);},blurFun:function(){if(this.pass==true||this.pass==false){this.check(true);}}}).bindEvent();var identity=new WN_Register.Item("identity","ipt.identity","tip.identity",false).extra({$verify:function(){return Reg_Verify.identity(this.ipt.value,$("ipt.realName").value);},blurFun:function(){if(this.pass==true||this.pass==false){this.check(true);}}}).bindEvent();extra.add(email).add(nickName).add(sex1).add(sex0).add(realName).add(identity);},loadVerifyImg:function(){var verifyImg=$("reg.verifyImg");if(!verifyImg.onclick){var verifyLink=$("reg.verifyLink");verifyImg.onclick=function(){var src="/register/ImageCode?paramName=RandomImage&t="+new Date().getTime();setTimeout(function(){verifyImg.style.backgroundImage='url(0)'.replace('0',src);$("ipt.verify").select();},50);};verifyLink.onclick=function(){verifyImg.onclick();}};verifyImg.onclick();},check:function(){this.form.check();}},WN_Register);$.extra({getExtraParas:function(){var extraParas={};var fromUrl=$.getQuery("fromurl")||$.getQuery("fromUrl");if(fromUrl){var matcher=fromUrl.match(/(?:\w*)\.([a-zA-Z0-9]+)(\.\w+)+/i);if(matcher){extraParas.fromUrl=fromUrl;var gnm=matcher[1].toLowerCase();extraParas.gid=WN_Register.getGid8GNM(gnm);}}var inviteInfo=$.getQuery("inviteInfo")||$.getCookie("inviteInfo")||"";var paras={sid:$.getQuery("sid"),subSid:$.getQuery("subSid"),pid:$.getQuery("pid"),rid:$.getQuery("rid"),spreaderId:$.getQuery("spreaderId"),"goto":document.referrer,"inviteInfo":inviteInfo};$.extra(paras,extraParas);return extraParas;},getGid8GNM:function(nm){var gid=0;var GDict={"vc":1,"5jq":4,"tz":7,"aoa":3,"aoa2":13,"9y":10,"ho":9,"dg":12};return GDict[nm]||gid;}},WN_Register);Reg_Verify={trim:function(s){return(s||"").replace(/^\s+|\s+$/,"");},account:function(v,tp){v=this.trim(v);tp=this.trim(tp);var ret;if(!v){return"请输入帐号"}if(v.length<6){return"帐号至少为6位，由英文、数字或下划线组成"}if(/^\d+$/.test(v)){return"帐号不能全为数字"}if(v.length>25){return"帐号不能多于25个字符"}if(/^woniu/i.test(v)){return"帐号不能以'woniu'开头"}if(/^snail/i.test(v)){return"帐号不能以'snail'开头"}if(/^gm/i.test(v)){return"帐号不能以'gm'开头"}if(/^d1xn/i.test(v)){return"帐号不能以'd1xn'开头"}if(/^dixn/i.test(v)){return"帐号不能以'dixn'开头"}if(/^dlxn/i.test(v)){return"帐号不能以'dlxn'开头"}if(/^dyxn/i.test(v)){return"帐号不能以'dyxn'开头"}if(!(/^\w{6,25}$/.test(v)||/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(v))){return"帐号只能是英文、数字、下划线的组合（不能为全角字符）或有效电子邮箱"}return true;},password:function(v,acc){acc=this.trim(acc);if(!v){return"请输入密码"}if(v==acc){return"帐号和密码不能相同"}if(v.length<6){return"密码至少为6位"}if(v.length>20){return"密码不能多于20个字符"}if(!/^[0-9a-zA-Z]{6,20}$/.test(v)){return"密码只能使用英文(区分大小写)数字"}if(/^(\w)\1*$/.test(v)){return"密码不能是完全相同的字母或数字"}for(var i=1,c=[v.charCodeAt(0)],cd=[v.charCodeAt(0)],cu=[v.charCodeAt(0)];i<v.length;i+=1){cd[i]=cd[i-1]-1;cu[i]=cu[i-1]+1;c[i]=v.charCodeAt(i);}c=c.join(":");if(c==cd.join(":")||c==cu.join(":")){return"你不能使用该密码，非常容易被猜测！"}return true;},rpwd:function(a,b){if(!a){return"请输入确认密码";}if(a!=b){return'两次密码输入不一致';}return true;},verify:function(v){if(!v){return"请输入验证码";}if(!/^[0-9a-zA-Z]{4}$/.test(v)){return"验证码格式不正确";}return true;},email:function(v){v=this.trim(v);if(!v){return true}if(!v){return"请输入您的电子邮箱";}if(!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(v)||v.length<6||v.length>25){return"邮箱格式不正确，请确认后重新输入";}return true;},mobile:function(v){v=this.trim(v);if(!v){return true;}else if(!/^(13[0-9]|15[0|3|6|7|8|9]|18[8|9])\d{8}$/.test(v)||v.length<6||v.length>25){return"您的手机号格式不正确，请重新填写";}return true;},realName:function(v,i){var identity=this.trim(i);v=this.trim(v);if(!v&&!i){return true;}if(identity&&!i){return"请输入您的真实姓名";}if(!/^[\u4E00-\u9FA5]{2,}$/.test(v)){return"请输入您的真实姓名";}return true;},identity:function(v,r){var realName=this.trim(r);v=this.trim(v);if(!v&&!r){return true;}if(realName&&!v){return"请输入您的身份证号";}if(!(validIdentity(v))){return"您输入的身份证格式不正确";}return true;},nickName:function(v){v=this.trim(v);if(!v)return true;if(/^\u73a9\u5bb6/.test(v)){return"昵称不能用玩家开头";}if((v.uniLength()>14||v.uniLength()<4)){return"最少2个汉字或4个英文字符，最多7个汉字或14个字符，可不填";}if(/([\x00-\x2F\x3A-\x40\x5B-\x5E\x60\x7B-\x80])/.test(v)){return"出现非法字符： "+RegExp["$1"].htmlEncode();}return true;},sex:function(){return true;}};function validIdentity(_identity){var ReDate15=/\d{6}(\d{6})\d{3}/;var ReDate18=/\d{6}(\d{8})\d{3}/;function _CheckSum(strID){Re18Digital=/(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})(\d{1})([0-9xX]{1})/;Arr=Re18Digital.exec(strID);var Wi=new Array(7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2);Sum=0;for(i=0;i<=16;i++)Sum+=Arr[i+1]*Wi[i];ArrCheckSum=new Array('1','0','X','9','8','7','6','5','4','3','2');strCheckSum=ArrCheckSum[Sum%11];if(strCheckSum==Arr[18].toUpperCase())return true;else return false;}function _CheckDate(strDate,DateFrom,DateTo){ReDigital8=/\d{8}/;ReAutoDate=/\d{4}-{1}\d{1,2}-\d{1,2}/;if(strDate.indexOf("-")>-1){if(ReAutoDate.test(strDate)==false)return false;Arr=strDate.split("-");strDate=(Arr[0])+""+(Arr[1].length<2?"0":"")+Arr[1]+(Arr[2].length<2?"0":"")+(Arr[2]);}if(strDate.length!=8)return false;if(ReDigital8.test(strDate)==false)return false;MyDate=eval(strDate.replace(/^(\d{4})(\d{2})(\d{2})$/,"new Date($1,$2-1,$3)"));strMyDate=MyDate.getFullYear()+(MyDate.getMonth()<9?"0":"")+(MyDate.getMonth()+1)+""+(MyDate.getDate()<=9?"0":"")+MyDate.getDate();if(strMyDate!=strDate)return false;if(MyDate>=DateFrom&&MyDate<=DateTo)return true;else return false;}function _validIdentity(identity){var ReDigital15=/\d{15}/;var ReDigital18=/\d{17}[0-9xX]{1}/;var strMsg1="身份证号码中包含非法字符，请重新输入";var strMsg2="身份证位数不正确，请重新输入";var strMsg3="身份证号码无效，请重新输入";switch(identity.length){case 15:if(identity=="111111111111111"){return strMsg3;}if(ReDigital15.test(identity)==false){return strMsg1;}Arr=ReDate15.exec(identity);strDate="19"+Arr[1];if(CheckDate(strDate,new Date(1900,0,1),new Date(1999,11,31))==false){return strMsg3;}break;case 18:if(ReDigital18.test(identity)==false){return strMsg1;}Arr=ReDate18.exec(identity);strDate=Arr[1];if(_CheckDate(strDate,new Date(1900,0,1),new Date())==false){return strMsg3;}if(_CheckSum(identity)==false){return strMsg3;}break;case 0:break;default:return strMsg2;break;}return true;}return _validIdentity(_identity)===true;}WNSNS={};WNSNS.expandDom=function(dom,from,to,dir,fun){if(dom.layerTimer){return;clearInterval(dom.layerTimer);}if(from>to){var tmp=from;from=to;to=tmp};var h=to==null?(dir=="x"?dom.scrollWidth:dom.scrollHeight):to;var step=h*.15;var start=from==null?dom.offsetHeight:from;var me=dom;me.layerTimer=setInterval(function(){if(start>=h){start=h;clearInterval(me.layerTimer);me.layerTimer=null;if(fun){fun();}}else{start+=step;}dir=="x"?dom.style.width=Math.min(h,start)+"px":dom.style.height=Math.min(h,start)+"px";},15);};WNSNS.collapseDom=function(dom,from,to,dir,fun){if(dom.layerTimer){return;clearInterval(dom.layerTimer);}if(from<to){var tmp=from;from=to;to=tmp};var h=to==null?(dir=="x"?dom.scrollWidth:dom.scrollHeight):to;var step=from*.15;var start=from||dom.offsetHeight;var me=dom;me.layerTimer=setInterval(function(){if(start<=h){start=h;clearInterval(me.layerTimer);me.layerTimer=null;if(fun){fun();}}else{start-=step;}dir=="x"?dom.style.width=Math.max(h,start)+"px":dom.style.height=Math.max(h,start)+"px";},15);};WN_PlatForm={};WN_PlatForm.gameOptTips=(function(){var _fadeObj;function Hex(i){if(i<0)return"00";else if(i>255)return"ff";else{var str="0"+i.toString(16);return str.substring(str.length-2);}}function Mid(string,start,length){if(length)return string.substring(start,start+length);else return string.substring(start);}function _ColorFade(Obj,options){this._obj=$(Obj)||null;this._timer=null;this.SetOptions(options);this.Step=Math.abs(this.options.Step);this.Speed=Math.abs(this.options.Speed);this.StartColor=this._color=this.GetColors(this.options.StartColor);this.EndColor=this.GetColors(this.options.EndColor);this._arrStep=[this.GetStep(this.StartColor[0],this.EndColor[0]),this.GetStep(this.StartColor[1],this.EndColor[1]),this.GetStep(this.StartColor[2],this.EndColor[2])];this._set=function(color){this._obj.style.backgroundColor=color;};}_ColorFade.prototype={init:function(){this._set(this.options.StartColor);},SetOptions:function(options){this.options={StartColor:"#000",EndColor:"#DDC",Step:20,Speed:10};$.extra(options,this.options);},GetColors:function(sColor){sColor=sColor.replace("#","");var r,g,b;if(sColor.length>3){r=Mid(sColor,0,2);g=Mid(sColor,2,2);b=Mid(sColor,4,2);}else{r=Mid(sColor,0,1);g=Mid(sColor,1,1);b=Mid(sColor,2,1);r+=r;g+=g;b+=b;}return[parseInt(r,16),parseInt(g,16),parseInt(b,16)];},GetColor:function(c,ec,iStep){if(c==ec){return c;}if(c<ec){c+=iStep;return(c>ec?ec:c);}else{c-=iStep;return(c<ec?ec:c);}},GetStep:function(start,end){var iStep=Math.abs((end-start)/this.Step);if(iStep>0&&iStep<1)iStep=1;return parseInt(iStep);},Fade:function(rColor){clearTimeout(this._timer);var er=rColor[0],eg=rColor[1],eb=rColor[2],r=this.GetColor(this._color[0],er,this._arrStep[0]),g=this.GetColor(this._color[1],eg,this._arrStep[1]),b=this.GetColor(this._color[2],eb,this._arrStep[2]);this._set("#"+Hex(r)+Hex(g)+Hex(b));this._color=[r,g,b];if(r!=er||g!=eg||b!=eb){var oThis=this;this._timer=setTimeout(function(){oThis.Fade(rColor);},this.Speed);}else{this._set("");this._color=this.StartColor;}}};_fadeObj=new _ColorFade("",{StartColor:"#fde061",EndColor:"#f5f5f5"});function _gameTip(ele,startColor,endColor){$(ele).focus();startColor&&(_fadeObj.options.StartColor=startColor);startColor&&(_fadeObj.StartColor=_fadeObj.GetColors(startColor));endColor&&(_fadeObj.EndColor=_fadeObj.GetColors(endColor));_fadeObj._obj=$(ele);_fadeObj.init();_fadeObj.Fade(_fadeObj.EndColor);}return _gameTip;})();(function(){WN_Register.init();$("ipt.extra").checked=false;var gaJsHost=(("https:"==document.location.protocol)?"https://ssl.":"http://www.");new $.scriptLoader(gaJsHost+"google-analytics.com/ga.js",null,function(){var pageTracker=_gat._getTracker("UA-12765758-1");pageTracker._trackPageview();}).ask();var referre=document.referrer;$.info(referre);try{setTimeout(function(){WN_Register.get("account").ipt.focus();},500);}catch(e){}})();