try{NAVFUN}catch(ex){NAVFUN={}}WONIUCOMMON=(function(){(function(){String.prototype.uniLength=function(){return this.replace(/[^\x00-\xff]/g,"**").length};String.prototype.uniSubstr=function(Y,S){var W=0,V=Y,U,X="",T;while(W<S){U=this.substr(V,1);if(U==""){break}X+=U;T=U.uniLength();W=W+T;V+=1}return X};String.prototype.uniLeft=function(S,T){if(!T){T=""}return this.uniLength()>S?this.uniSubstr(0,S-T.uniLength())+T:String(this)}})();var H=function(S){return document.getElementById(S)};var I={getScript:function(V){if(!this.script){var T=document.getElementsByTagName("script");var X=new RegExp(V||"woniuOfficialNav.js");for(var W=0,S=T.length-1;W>=0;W--){var U=T[W];var Y=U.getAttribute("src");if(Y&&X.test(Y)){this.script=U;break}}}return this.script},importCss:function(){var T=document.createElement("link");T.href="http://client2.snailgame.net/comres/js/woniu/style/style.css";T.rel="stylesheet";T.type="text/css";var S=document.getElementsByTagName("head")[0];S.firstChild?S.insertBefore(T,S.firstChild):S.appendChild(T);if(this.cls){var T=document.createElement("link");T.href=this.cls;T.rel="stylesheet";T.type="text/css";S.appendChild(T)}delete T},getCookie:function(T){var U=new RegExp("(^| )"+T+"=([^;]*)(;|$)");var S=document.cookie.match(U);return S==null?null:decodeURIComponent(S[2])},setCookie:function(X,Y,T,U,S,W){var V=X+"="+encodeURIComponent(Y);if(T){V+="; expires="+T.toGMTString()}if(U){V+="; path="+U}if(S){V+="; domain="+S}if(W){V+="; secure"}document.cookie=V},getQuery:function(T){var U=new RegExp("[?&]+"+T+"=([^?&]*)[?&]?");var S=location.search.match(U);return S?S[1]:""},scriptRequest:function(U,S){var T=document.createElement("script");T.type="text/javascript";if(this.isIE){T.onreadystatechange=function(){if(T.readyState=="complete"||T.readyState=="loaded"){T.onreadystatechange=null;if(S){try{S()}catch(V){}}T.parentNode.removeChild(T)}}}else{T.onload=function(){if(S){try{S()}catch(V){}}T.parentNode.removeChild(T)}}T.src=U;document.getElementsByTagName("head")[0].appendChild(T)}};var E={};var L=/MSIE/i.test(navigator.userAgent);var B=NAVFUN&&NAVFUN.loginDoms?NAVFUN.loginDoms:["woniunav_login","woniunav_right.logout"];var R=NAVFUN&&NAVFUN.logoutDoms?NAVFUN.logoutDoms:["woniunav_logout","woniunav_right.reg"];var G={},M=false;var C,D,A,O,Q;function P(){var S={};var T=I.getCookie("userInfoSNS");if(T){var V=T.split(/\+&&&&/g);var U=I.getCookie("lastTime");S={lastTime:U?U.split(",")[0]:null,userId:V[0],account:(V[1]),nickName:(V[2]),sex:(V[3])}}G={sex:S["sex"],nickName:S["nickName"],account:S["account"],userId:S["userId"],userGame:I.getCookie("userGame")}}function J(){var U=B.concat(R);for(var T=0;T<U.length;T++){H(U[T]).style.display="none"}var V=[];if(M){V=B}else{V=R}for(var T=0;T<V.length;T++){H(V[T]).style.display=""}var S=K();for(var T in E){E[T].get(S)}}function K(){return{product:C,noCls:O,delay:Q,User:G,isLogin:M}}function F(){G={};M=G.nickName?true:false;J()}function N(){(function(){var S=I.getQuery("promotParam");if(S){I.setCookie("PRMT",S)}})();C=location.host.split(".")[0];Q=false;if(Q){L?(function(){document.attachEvent("onreadystatechange",function(){if(document.readyState=="complete"||document.readyState=="loaded"){F()}})}()):document.addEventListener("DOMContentLoaded",function(){F()},false)}else{F()}}return{$:H,refresh:F,getUser:function(){return G},setUser:function(S){G=S},isLogin:M,Process:E,Util:I,init:N}})();WONIUCOMMON.NAVFUN=function(A){if(WONIUCOMMON.NAVFUN[A]){WONIUCOMMON.NAVFUN[A]()}};WONIUCOMMON.NAVFUN.viewMsg=function(){NAVFUN.viewMsg?NAVFUN.viewMsg():location.assign("http://www.woniu.com/personal/showSNSCommunity?app=model/message")};WONIUCOMMON.Process.basic={initFlag:false,get:function(B){this.bindEvent();var A=location.href.indexOf("service=")<0?"?service="+location.href:"";WONIUCOMMON.$("woniunav_right.login").href="http://www.woniu.com/account/login.do"+A;if(!B.isLogin){return }this.fillBasicInfo(B)},fillBasicInfo:function(A){var B=A["User"];WONIUCOMMON.$("woniunav_login.nickName").innerHTML=this.genNickDom(B);WONIUCOMMON.$("woniunav_login.nickName").title=/^\u73a9\u5bb6\d+/.test(B["nickName"])?"\u70b9\u51fb\u5b8c\u5584\u793e\u533a\u8d44\u6599":B["nickName"];WONIUCOMMON.$("woniunav_login.zone").href="http://hi.woniu.com/"+B["userId"]+".home"},genNickDom:function(C){var B=C["nickName"].replace(/</g,"&lt;").replace(/>/g,"&gt;").uniLeft(10,"..");var A="";if(/^\u73a9\u5bb6\d+/.test(B)){A="<a href=\"http://www.woniu.com/personal/showSNSCommunity?app=model/info#/community/snsProfile.do?m=init\" class=\"WN_ALLNAV_leftMenuTTit\">\u5b8c\u5584\u8d44\u6599</a>"}else{A=B}return A},bindEvent:function(){if(this.initFlag){return }var A=null;var B=this.hideQuickList;WONIUCOMMON.$("woniunav_listBtn").onmouseover=WONIUCOMMON.$("woniunav_listBtn").onclick=function(){if(A){clearTimeout(A);A=null}setTimeout(function(){document.getElementById("woniunav_list").style.display=""},50)};WONIUCOMMON.$("woniunav_listBtn").onmouseout=function(){A=setTimeout(B,500)};if(window.attachEvent){document.attachEvent("onclick",B)}else{window.addEventListener("click",B,false)}this.initFlag=true},hideQuickList:function(){document.getElementById("woniunav_list").style.display="none"}};WONIUCOMMON.Process.product={get:function(A){if(this.current){WONIUCOMMON.$("woniunav_game."+this.current).className="WN_ALLNAV_leftMenuOBtn"}this.fillProduct(A["product"]);this.fillReg(A["product"]);this.fillClub(A["product"]);this.fillCharge(A["product"]);this.fillLogin(A["product"])},fillProduct:function(A){var B=WONIUCOMMON.$("woniunav_game."+A);if(B){B.className="WN_ALLNAV_leftMenuOBtn WN_ALLNAV_leftMenuOBtnSe";this.current=A}},fillReg:function(B){var D=WONIUCOMMON.$("woniunav_right.reg");var A=WONIUCOMMON.Process.game.gameDict[B];if(!A){return }var C=WONIUCOMMON.Process.game.woniuGameList[A]["reg"];if(D&&C){D.href=C}},fillCharge:function(C){var D=WONIUCOMMON.$("woniunav_right.charge");var A=WONIUCOMMON.Process.game.gameDict[C];if(!A){return }var B=WONIUCOMMON.Process.game.woniuGameList[A]["charge"];if(D&&B){D.href=B}},fillLogin:function(B){var D=WONIUCOMMON.$("woniunav_right.login");var A=WONIUCOMMON.Process.game.gameDict[B];if(!A){return }var C=WONIUCOMMON.Process.game.woniuGameList[A]["log"];if(D&&C){D.href=C}},fillClub:function(C){var E=WONIUCOMMON.$("woniunav_logout.club");var A=WONIUCOMMON.Process.game.gameDict[C];if(!A){return }var B=WONIUCOMMON.Process.game.woniuGameList[A]["clubId"];var D="";if(isNaN(B)){D=B}else{D="http://club.woniu.com/thread.php?fid="+B}if(E&&D){E.href=D}}};WONIUCOMMON.Process.guild={get:function(A){return ;if(!A.isLogin){return }var C=this.guild=WONIUCOMMON.Util.getCookie("GI_"+A.User["userId"]);if(C&&C!=","){var B=C.split(",");C={"guildDomain":B[0],"guildName":B[1]}}(C)?this.fillGuild(C):WONIUCOMMON.Util.scriptRequest("http://www.woniu.com/newuser/guild.do?account="+A.User["account"]+"&jsback=WONIUCOMMON.Process.guild.fillGuild&t="+(new Date().getTime()))},fillGuild:function(A){if(!A["guildDomain"]||!A["guildName"]){return }this.Guild=A;var B=WONIUCOMMON.$("woniunav_login.guild");B.href="http://gh.woniu.com/"+A["guildDomain"];B.innerHTML="\u6211\u7684\u516c\u4f1a";WONIUCOMMON.Util.setCookie("GI_"+WONIUCOMMON.getUser()["userId"],[A["guildDomain"],A["guildName"]].join(","),null,"/","woniu.com")}};WONIUCOMMON.Process.msg={get:function(A){if(!A.isLogin){return }WONIUCOMMON.Util.scriptRequest("http://hi.woniu.com/newuser/newmessage.do?m=jsQuery&jsback=WONIUCOMMON.Process.msg.fillMsgInfo&userId="+A.User.userId+"&t="+(new Date().getTime()))},fillMsgInfo:function(B){var D=0;if(B){for(var A in B){D+=parseInt(Number(B[A]))}}var C=WONIUCOMMON.$("woniunav_login.msg");C.innerHTML="(0)".replace("0",D);C.className=D>0?"WN_userMsg_Se":"WN_userMsg";if(window.fillMsgInfo){window.fillMsgInfo(B)}}};WONIUCOMMON.Process.game={gameDict:{"9yin":10,tz:7,dg:12,aoa:13,"5jq":4,vc:1,hero:9,"aoahj":3,lz:8},woniuGameList:{10:{name:"\u4e5d\u9634\u771f\u7ecf",url:"http://9yin.woniu.com/",clubId:"http://9yin.woniu.com/bbs/",reg:"http://9yin.woniu.com/bbs/register.php"},7:{name:"\u5929\u5b50",url:"http://tz.woniu.com/",clubId:393,reg:"http://act.woniu.com/reg/tz/reg.html?fromurl=GW.TZ.0.0.0",charge:"http://res.woniu.com/imprest/imprest_main.html?gameId=7"},12:{name:"\u5e1d\u56fd\u6587\u660e",url:"http://dg.woniu.com/",clubId:679,reg:"http://dg.woniu.com/serverlist/reg.html?fromurl=GW.DG.1.0.1"},3:{name:"\u673a\u7532\u4e16\u7eaa",url:"http://aoa.woniu.com/aoahj/",reg:"http://reg.woniu.com/?fromurl=GW.AOAHJ.0.0.0"},13:{name:"\u673a\u7532\u4e16\u7eaa\u9769\u65b0\u7248",url:"http://aoa.woniu.com/",clubId:703,reg:"http://reg.woniu.com/?fromurl=GW.AOA.0.0.0"},4:{name:"\u821e\u8857\u533a",url:"http://5jq.woniu.com/",clubId:215,reg:"http://act.woniu.com/reg/5jq/reg.html?fromurl=GW.5JQ.0.0.0",charge:"http://res.woniu.com/imprest/imprest_main.html?gameId=4"},1:{name:"\u822a\u6d77\u4e16\u7eaa",url:"http://vc.woniu.com/",clubId:183,reg:"http://act.woniu.com/reg/vc/reg.html?fromurl=GW.VC.0.0.0",charge:"http://res.woniu.com/imprest/imprest_main.html?gameId=1"},9:{name:"\u82f1\u96c4\u4e4b\u57ce",url:"http://hero.woniu.com/",clubId:524,charge:"http://res.woniu.com/imprest/imprest_main.html?gameId=9",reg:"http://hero.woniu.com/reg.html?fromurl=GW.HO.0.0.0",log:"http://hero.woniu.com/login.html"},8:{name:"\u9f99\u6218",url:"http://lz.woniu.com/",clubId:825,reg:"http://reg.woniu.com/?fromurl=GW.LZ.0.0.0"}},get:function(B){if(!B.isLogin){return }var A=this.game=this.getGame(B.product);if(A&&A>-1){var C=this.woniuGameList[A]?this.woniuGameList[A]["name"]:null}if(C){this.fillUserGame(C)}},fillUserGame:function(D){var B=["woniunav_login.club","woniunav_logout.club"];href=this.getClub("clubId");for(var A=0;A<B.length;A++){var C=WONIUCOMMON.$(B[A]);href?C.href=href:C.removeAttribute("href")}},getHref:function(){var B="";var A=this.game;if(A&&A>-1){B=this.woniuGameList[A]?this.woniuGameList[A]["url"]:null}return B},getClub:function(){var B="";var A=this.game;if(A&&A>-1){B=this.woniuGameList[A]?this.woniuGameList[A]["clubId"]:null}return isNaN(B)?B:"http://club.woniu.com/thread.php?fid="+B},getGame:function(A){return this["gameDict"][A]||""}};WONIUCOMMON.init()
