function changetxt(a){$("iframe").each(function(a){if(0<=a.src.indexOf("?autoplay=1"))a.src=a.src.replace(/\?autoplay=1/gi,"")});oo=document.getElementById(a);a=oo.innerHTML;a=a.replace(/(<[^>]*)h(ttp:\/\/[^>]*>)/gi,"$1b$2");a=a.replace(/http:\/\/(www|jp|tw).youtube.com\/watch\?v=([0-9a-zA-Z_-]{11})[^ <\u2E80-\u9FFF]*/gi,"<p style=\" display:block; width:138px; height:77px; background:url(bttp://i1.ytimg.com/vi/$2/default.jpg) no-repeat center center;\" onclick=\"$(this).html('<iframe width=425 height=344 src=bttp://www.youtube.com/embed/$2?autoplay=1 frameborder=0 allowfullscreen></iframe>');$(this).css('width','425px');$(this).css('height','344px');\"><img src=\"bttp://pic.bahamut.com.tw/PLAY2.png\" style=\"cursor: Pointer;\"></p>");
a=a.replace(/http:\/\/youtu.be\/([0-9a-zA-Z_-]{11})[^ <\u2E80-\u9FFF]*/gi,"<p style=\" display:block; width:138px; height:77px; background:url(bttp://i1.ytimg.com/vi/$1/default.jpg) no-repeat center center;\" onclick=\"$(this).html('<iframe width=425 height=344 src=bttp://www.youtube.com/embed/$1?autoplay=1 frameborder=0 allowfullscreen></iframe>');$(this).css('width','425px');$(this).css('height','344px');\"><img src=\"bttp://pic.bahamut.com.tw/PLAY2.png\" style=\"cursor: Pointer;\"></p>");a=a.replace(/h(ttp:\/\/\S+\.(jpg|png|gif))/gi,
'<br><a href="b$1" target="_blank" onclick="if( this.href.substr(0,16) != \'bttp://ref.gamer\' ){this.href=\'bttp://ref.gamer.com.tw/redir.php?url=\'+encodeURIComponent(this.href);}"><img src="b$1" border="0" style="max-height:120px;max-width:120px;"></a>');a=a.replace(/h(ttp:\/\/([^ <\u2E80-\u9FFF]+))/gi,'<br><a href="b$1" target="_blank" onclick="if( this.href.substr(0,16) != \'bttp://ref.gamer\' ){this.href=\'bttp://ref.gamer.com.tw/redir.php?url=\'+encodeURIComponent(this.href);}">$2</a><br>');
a=a.replace(/\[e(\d*)\]/gi,'<img src="http://pic.bahamut.com.tw/editor/emotion/$1.gif">');a=a.replace(/a>\uff1a\[([0-9a-zA-Z]*):([^\]]*)\]/gi,'a> &gt; <a class="msgname AT1" href="http://home.gamer.com.tw/bahawall.php?owner=$1" target="_blank">$2</a>');a=a.replace(/\uff1a\[([0-9a-zA-Z]*):([^\]]*)\]/gi,'\u3001<a class="msgname AT1" href="http://home.gamer.com.tw/bahawall.php?owner=$1" target="_blank">$2</a>');a=a.replace(/\[([0-9a-zA-Z]*):([^\]]*)\]/gi,'<a class="msgname AT1" href="http://home.gamer.com.tw/bahawall.php?owner=$1" target="_blank">$2</a>');
a=a.replace(/b(ttp:\/\/)/gi,"h$1");oo.innerHTML=a}
function checkMsg(){var a=document.getElementById("msgtalk"),b=a.value;if(420<b.utf8Length())alert("\u53ea\u80fd\u5beb140\u500b\u5b57\u5594!");else if(""==b.replace(/(^\s*)|(\s*$)/g,""))alert("\u4e0d\u80fd\u7a7a\u767d!");else if(1==document.getElementById("sendingMsg").value)alert("\u8655\u7406\u4e2d\u8acb\u7a0d\u5019\uff01");else{var b="mainmsg.php",c="",d=document.getElementById("ori_s");if(d)switch(d.value.substr(0,1)){case "g":b="guildMsgNew.php",c="&sf="+d.value.substr(1)}document.getElementById("sendingMsg").value=
1;noreply=0;document.getElementById("forbidden")&&(noreply=document.getElementById("forbidden").checked?1:0);secret=document.getElementById("privacy").checked?1:0;$("iframe").each(function(a){if(0<=a.src.indexOf("?autoplay=1"))a.src=a.src.replace(/\?autoplay=1/gi,"")});$.ajax({url:"/ajax/"+b,method:"POST",param:"msg="+encodeURIComponent(a.value)+"&status="+secret+"&flag="+noreply+c,success:function(a){showActiveDiv("MSG-box2",a)}})}}
function checkReply(a,b){var c=document.getElementById("replyMsg"+a),d=c.value;if(!countLimit(c,85))""==d.replace(/(^\s*)|(\s*$)/g,"")?(alert("\u8acb\u8f38\u5165\u7559\u8a00"),c.focus()):document.getElementById("replyBtn"+a).disabled?alert("\u8655\u7406\u4e2d\uff0c\u8acb\u7a0d\u5019"):(document.getElementById("replyBtn"+a).disabled=!0,$.ajax({url:"/ajax/comment.php?a=A&s="+a,method:"POST",param:"a=A&s="+a+"&c="+encodeURIComponent(c.value)+"&u="+b,success:function(b){showActiveDiv("allReply"+a,b)}}))}
function delMainMsg(a){confirm("\u78ba\u5b9a\u8981\u522a\u9664\u55ce\uff1f")&&$.ajax({url:"/ajax/delMainmsg.php",method:"POST",param:"sn="+a,success:function(b){showActiveDiv("m-"+a,b)}})}function delReplyMsg(a){confirm("\u78ba\u5b9a\u8981\u522a\u9664\u55ce\uff1f")&&$.ajax({url:"/ajax/comment.php?a=D&s="+a,method:"POST",param:"a=D&s="+a,success:function(b){showActiveDiv("r-"+a,b)}})}
function delMsg_guild(a,b){var a=parseInt(a),c="";switch(a){case 2:c="m-"+b;break;case 3:c="r-"+b}if(""==c)return alert("\u7121\u6548\u7684\u52d5\u4f5c!"),!1;var d=document.getElementById("ori_s");if(!d)return alert("\u8cc7\u6599\u4e0d\u5b58\u5728!"),!1;if("g"!=d.value.substr(0,1))return alert("\u7121\u6548\u7684\u52d5\u4f5c(1)"),!1;confirm("\u78ba\u5b9a\u8981\u522a\u9664\u55ce\uff1f")&&$.ajax({url:"/ajax/delMsgGuild.php?asn="+b,method:"POST",param:"loctype="+a+"&s="+b+"&gsn="+d.value.substr(1),success:function(a){showActiveDiv(c,
a)}})}
function showActiveDiv(a,b){var c=b.getElementsByTagName("errMsg");if(c.length){if("GP\u6210\u529f"==c[0].firstChild.nodeValue||"BP\u6210\u529f"==c[0].firstChild.nodeValue){var d=a.substr(2);if(0==document.getElementById(a).innerHTML){var e=a.substr(0,2),f="GP"==e?0:1;document.getElementById(e+"Link"+d).innerHTML='<a href="javascript:void(0)" onclick="getVoteList(event,'+d+","+f+')"><span id="'+a+'">0</span></a>'}document.getElementById(a).innerHTML=Number(document.getElementById(a).innerHTML)+Number(1);
document.getElementById("hasGP"+d).innerHTML="\u63a8";document.getElementById("hasBP"+d).innerHTML="\u5653"}else if("ERR_NEVER"==c[0].firstChild.nodeValue)$.ajax({url:"/ajax/bahabook_nodata.php",method:"POST",param:"",success:function(a){document.getElementById("moreBtn").style.display="none";document.getElementById("noMsg").innerHTML=a}});else if(!("readMore"==a&&1==document.getElementById("autoReadMore").value))alert(c[0].firstChild.nodeValue),document.getElementById("sendingMsg").value=0;if("readMore"==
a)document.getElementById("moreBtn").disabled=!1,document.getElementById("lastTime").value=b.getElementsByTagName("stime")[0].firstChild.nodeValue,document.getElementById("daysRange").value=b.getElementsByTagName("daysRange")[0].firstChild.nodeValue,document.getElementById("autoReadMore").value=0}else{if("allReply"==a.substr(0,8)||"MSG-box2"==a||"readMore"==a)var d=b.getElementsByTagName("sn")[0].firstChild.nodeValue,e=b.getElementsByTagName("author")[0].firstChild.nodeValue,f=b.getElementsByTagName("nick")[0].firstChild.nodeValue,
h=b.getElementsByTagName("date")[0].firstChild.nodeValue,l=b.getElementsByTagName("content")[0].firstChild.nodeValue;if("allReply"==a.substr(0,8))c=""==document.getElementById(a).innerHTML?c=1:parseInt(document.getElementById(a).lastChild.lastChild.lastChild.innerHTML.substr(1))+1,document.getElementById(a).innerHTML+=buildReply(d,e,f,l,h,1,a.substr(8),c),document.getElementById("replyMsg"+a.substr(8)).value="",changetxt("r-"+d),document.getElementById("replyBtn"+a.substr(8)).disabled=!1;else if("MSG-box2"==
a){var g=b.getElementsByTagName("flag")[0].firstChild.nodeValue,c=b.getElementsByTagName("status")[0].firstChild.nodeValue,o=document.getElementById(a).innerHTML;document.getElementById(a).innerHTML=buildMsg(d,e,f,"",l,h,0,0,0,"",1,g,c,1)+o;document.getElementById("msgtalk").value="";document.getElementById("msgtalk").style.height="32px";changetxt("m-"+d);document.getElementById("sendingMsg").value=0}else if("m-"==a.substr(0,2)||"r-"==a.substr(0,2))document.getElementById(a).style.display="none";
else if("readMore"==a){var d=b.getElementsByTagName("sn"),e=b.getElementsByTagName("author"),f=b.getElementsByTagName("nick"),g=b.getElementsByTagName("kind"),h=b.getElementsByTagName("date"),l=b.getElementsByTagName("content"),o=b.getElementsByTagName("flag"),c=b.getElementsByTagName("status"),p=b.getElementsByTagName("replynum"),q=b.getElementsByTagName("gp"),v=b.getElementsByTagName("bp"),u=b.getElementsByTagName("hasGPBP"),s=b.getElementsByTagName("auxuser"),m=getCookie("BAHAID");for(i=0;i<d.length;i++){var n=
b.getElementsByTagName("msg")[i].getElementsByTagName("new3");msgArr[total_ary]=[];for(j=0;j<n.length;j++){var w=n[j].childNodes[1].firstChild.nodeValue.toLowerCase()==m.toLowerCase()||e[i].firstChild.nodeValue.toLowerCase()==m.toLowerCase()?1:0;w||(w=0<parseInt(s[i].firstChild.nodeValue)?3:0);msgArr[total_ary]["rsn"+j]=n[j].childNodes[0].firstChild.nodeValue;msgArr[total_ary]["ruserid"+j]=n[j].childNodes[1].firstChild.nodeValue;msgArr[total_ary]["rnick"+j]=n[j].childNodes[2].firstChild.nodeValue;
msgArr[total_ary]["rcomment"+j]=n[j].childNodes[4].firstChild.nodeValue;msgArr[total_ary]["rtime"+j]=n[j].childNodes[3].firstChild.nodeValue;msgArr[total_ary]["rdel"+j]=w}(n=e[i].firstChild.nodeValue.toLowerCase()==m.toLowerCase()?1:0)||(n=0<parseInt(s[i].firstChild.nodeValue)?2:0);msgArr[total_ary].sn=d[i].firstChild.nodeValue;msgArr[total_ary].userid=e[i].firstChild.nodeValue;msgArr[total_ary].nick=f[i].firstChild.nodeValue;msgArr[total_ary].kind=g[i].firstChild.nodeValue;msgArr[total_ary].content=
l[i].firstChild.nodeValue;msgArr[total_ary].ctime=h[i].firstChild.nodeValue;msgArr[total_ary].gp=q[i].firstChild.nodeValue;msgArr[total_ary].bp=v[i].firstChild.nodeValue;msgArr[total_ary].replynum=p[i].firstChild.nodeValue;msgArr[total_ary].del=n;msgArr[total_ary].noreply=o[i].firstChild.nodeValue;msgArr[total_ary].status=c[i].firstChild.nodeValue;msgArr[total_ary].hasGPBP=u[i].firstChild.nodeValue;total_ary++}document.getElementById("autoReadMore").value=0;readMore(b.getElementsByTagName("owner")[0].firstChild.nodeValue);
document.getElementById("moreBtn").disabled=!1;document.getElementById("lastTime").value=b.getElementsByTagName("stime")[0].firstChild.nodeValue;document.getElementById("lastGetSn").value=msgArr[total_ary-1].sn;document.getElementById("daysRange").value=b.getElementsByTagName("daysRange")[0].firstChild.nodeValue}}}function giveGPBP(a,b){$.ajax({url:"/ajax/comment.php?a="+a+"&s="+b,method:"POST",param:"a="+a+"&s="+b,success:function(c){showActiveDiv(a+b,c)}})}
function readAllReply(a,b){$.ajax({url:"/ajax/comment.php?a=S&s="+a,method:"POST",param:"a=S&s="+a,loading:function(){b.innerHTML='<img src="http://pic.bahamut.com.tw/loading.gif">'},success:function(b){changeDiv("allReply"+a,b)}})}
function changeDiv(a,b){var c=b.getElementsByTagName("errMsg");if(c.length)alert(c[0].firstChild.nodeValue);else{c=0;document.getElementById("auxd")&&1==parseInt(document.getElementById("auxd").value)&&(c=3);var d="",e=b.getElementsByTagName("sn"),f=b.getElementsByTagName("author"),h=b.getElementsByTagName("nick"),l=b.getElementsByTagName("date"),g=b.getElementsByTagName("content"),o=b.getElementsByTagName("del"),p=a.substr(8);for(i=0;i<e.length;i++)d+=buildReply(e[i].firstChild.nodeValue,f[i].firstChild.nodeValue,
h[i].firstChild.nodeValue,g[i].firstChild.nodeValue,l[i].firstChild.nodeValue,parseInt(o[i].firstChild.nodeValue)?o[i].firstChild.nodeValue:c?c:0,p,i+1);document.getElementById(a).innerHTML=d;changetxt(a)}}
function buildReply(a,b,c,d,e,f,h,l){var g="",g='<div id="r-'+a+'" name="r-'+a+'" class="msgreport BC2">';1==f?g+='<a href="javascript:delReplyMsg('+a+')" class="msgdel AB1">\u522a\u9664</a>':3==f&&(g+='<a href="javascript:" onClick="delMsg_guild(3,'+a+'); return false;" class="msgdel AB1">\u522a\u9664</a>');g+='<a href="http://home.gamer.com.tw/home.php?owner='+b+'" target="_blank"><img src="'+getAvatarPic(b)+'" class="msghead" /></a><div><a href="http://home.gamer.com.tw/home.php?owner='+b+'" class="msgname AT1">'+
c+"</a>\uff1a"+d+'<span><a href="javascript:void(0)" onclick="iWantReply('+h+",1,'"+b+"','"+c+'\')" title="\u56de\u8986\u4ed6"><img src="http://pic.bahamut.com.tw/spacer.gif" class="IMG-E26" /></a></span><span class="ST1">'+e+'</span><span class="ST1">#'+l+"</span></div>";return g+"</div>"}
function buildMsg(a,b,c,d,e,f,h,l,g,o,p,q,v,u){var s=1;if("#acg"==b.substr(0,4).toLowerCase()){var m=b.split("_");url="http://acg.gamer.com.tw/acgDetail.php?s="+m[0].substr(4);m="http://home.gamer.com.tw/singleACMsg.php?sn="+a}else"#gid"==b.substr(0,4).toLowerCase()?(url="http://guild.gamer.com.tw/guild.php?sn="+b.substr(4),s=0,m="http://guild.gamer.com.tw/singleACMsg.php?sn="+a+"&gsn="+b.substr(4,b.length).toLowerCase()):$("#ori_s").val()?(url="http://home.gamer.com.tw/home.php?owner="+b,m="http://guild.gamer.com.tw/singleACMsg.php?sn="+
a+"&gsn="+$("#ori_s").val().substr(1,$("#ori_s").val().length).toLowerCase()):(url="http://home.gamer.com.tw/home.php?owner="+b,m="http://home.gamer.com.tw/singleACMsg.php?sn="+a);htmlcode='<div id="m-'+a+'" class="MSG-box2" name="m-'+a+'">';htmlcode+='<a href="'+url+'" target="_blank"><img src="'+getAvatarPic(b)+'" class="msghead" /></a>';htmlcode+='<div class="msgright">';1==p?htmlcode+='<a href="javascript:delMainMsg('+a+')" class="msgdel AB1">\u522a\u9664</a>':2==p&&(htmlcode+='<a href="javascript:" onClick="delMsg_guild(2,'+
a+'); return false;" class="msgdel AB1">\u522a\u9664</a>');1==v&&(htmlcode+='<img src="http://pic.bahamut.com.tw/forum/forum_manager/icon_lock.gif" />');gpStr=0==h?'<span id="GP'+a+'">'+h+"</span>":'<a href="javascript:void(0)" onclick="getVoteList(event,'+a+',0)"><span id="GP'+a+'">'+h+"</span></a>";bpStr=0==l?'<span id="BP'+a+'">'+l+"</span>":'<a href="javascript:void(0)" onclick="getVoteList(event,'+a+',1)"><span id="BP'+a+'">'+l+"</span></a>";s&&(htmlcode+='<a href="'+url+'" class="msgname AT1">'+
c+"</a>"+("NaN"==d?"":d)+"\uff1a");htmlcode+=e;htmlcode+='<p class="msgitembar"><span class="msgtime ST1">'+f+"</span>";htmlcode+=1==u?'<span class="msggood MSG-graytxt ST1" id="hasGP'+a+'">\u63a8</span>':'<span id="hasGP'+a+'" class="msggood ST1"><a href="javascript:giveGPBP(\'GP\','+a+')">\u63a8</a></span>';htmlcode+='<span id="GPLink'+a+'" class="msggood ST1">'+gpStr+"</span>";htmlcode+=1==u?'<span class="msgbed MSG-graytxt ST1" id="hasBP'+a+'">\u5653</span>':'<span id="hasBP'+a+'" class="msgbed ST1"><a href="javascript:giveGPBP(\'BP\','+
a+')">\u5653</a></span>';htmlcode+='<span id="BPLink'+a+'" class="msgbed ST1">'+bpStr+'</span><span class="msggood ST1">';htmlcode=0==q||b.toLowerCase()==getCookie("BAHAID").toLowerCase()?htmlcode+('<a href="javascript:void(0)" onclick="iWantReply('+a+","+g+",'','')\">"+(1==q?'<font color="red">\u7559\u8a00</font>':"\u7559\u8a00")+"</a>"):htmlcode+"\u7981\u6b62\u7559\u8a00";htmlcode+='</span><span><a href="'+m+'" target="_blank" title="\u53e6\u958b\u6b64\u5247\u7db2\u9801">\u53e6\u958b</a></span></p>';
htmlcode+='<div id="allReply'+a+'" name="allReply'+a+'">';3<g&&(htmlcode+='<div class="msgreport BC2"><a href="javascript:void(0)" onclick="readAllReply('+a+',this.parentNode)">\u986f\u793a\u7a0d\u820a\u7684 '+(g-3)+" \u5247\u7559\u8a00</a></div>");htmlcode+=o;htmlcode+="</div>";showText="block";if(1==q||0==g)showText="none";htmlcode+='<div id="replyDiv'+a+'" style="display:'+showText+';clear:both;"><textarea rows="1" id="replyMsg'+a+"\" onkeypress=\"enterkey(event,this,'reply',"+a+",'"+b+"')\"></textarea>";
htmlcode+='<a href="javascript:void(0);" class="IMG-E13" onclick="all_showEmotion(this.id,\'replyMsg'+a+'\')" id="emo'+a+'"></a>';htmlcode+='<a href="javascript:void(0);" onclick="bhImg(\'replyMsg'+a+'\');" class="IMG-E05"></a>';htmlcode+='<button onclick="checkReply('+a+",'"+b+'\')" id="replyBtn'+a+'">\u53ed\u5566</button></div>';return htmlcode+="</div></div>"}
function iWantReply(a,b,c,d){"none"==document.getElementById("replyDiv"+a).style.display?(document.getElementById("replyDiv"+a).style.display="block",document.getElementById("replyMsg"+a).focus()):0==b?document.getElementById("replyDiv"+a).style.display="none":document.getElementById("replyMsg"+a).focus();d&&(document.getElementById("replyMsg"+a).value+="["+c+":"+d+"]\uff1a")}
function showVoteList(a,b){var c=b.getElementsByTagName("errMsg"),d="";if(c.length)d=c[0].firstChild.nodeValue;else{c=b.getElementsByTagName("userid");for(i=0;i<c.length;i++)var e=c[i].firstChild.nodeValue,d=d+('<a href="http://home.gamer.com.tw/home.php?owner='+e+'" target="_blank"><img src="'+getAvatarPic(e)+'" onmouseover="showGamerCard(event,\''+e.toLowerCase()+'\')" onmousemove="moveGamerCard(event)" onmouseout="hideGamerCard()"></a>')}document.getElementById(a).innerHTML=d;document.getElementById(a).style.display=
"block"}
function getVoteList(a,b,c){var d=document.getElementById("msgvotelist"),e=document.getElementById("lastSn");if("none"==d.style.display||"block"==d.style.display&&b+"&"+c!=e.value){if("block"==d.style.display)d.style.display="none";$.ajax({url:"/ajax/comment.php?a=showGPBP&t="+c+"&sn="+b,method:"POST",param:"a=showGPBP&t="+c+"&sn="+b,success:function(a){showVoteList("msgvotelist",a)}});if(isIE())var f=a.x,a=document.documentElement.scrollTop+a.clientY;else f=1E3<document.body.clientWidth?a.pageX-
(document.body.clientWidth-1E3)/2:a.pageX,a=a.pageY;e.value=b+"&"+c;d.style.left=f+"px";d.style.top=a+10+"px"}else d.style.display="none",e.value=""}
function buildMsgAndReply3(){var a="";for(i=point_now;i<point_now+rows&&i<total_ary;i++){var b="";for(j=0;3>j&&void 0!=msgArr[i]["rsn"+j];j++)b+=buildReply(msgArr[i]["rsn"+j],msgArr[i]["ruserid"+j],msgArr[i]["rnick"+j],msgArr[i]["rcomment"+j],msgArr[i]["rtime"+j],msgArr[i]["rdel"+j],msgArr[i].sn,3<=msgArr[i].replynum?msgArr[i].replynum-2+j:j+1);a+=buildMsg(msgArr[i].sn,msgArr[i].userid,msgArr[i].nick,msgArr[i].kind,msgArr[i].content,msgArr[i].ctime,msgArr[i].gp,msgArr[i].bp,msgArr[i].replynum,b,msgArr[i].del,
msgArr[i].noreply,msgArr[i].status,msgArr[i].hasGPBP)}point_now=i;return a}
function readMore(a){if(point_now<total_ary){var a=point_now,b=buildMsgAndReply3();document.getElementById("noMsg").style.display="none";document.getElementById("readMore").innerHTML+=b;for(i=a;i<point_now&&i<total_ary;i++)changetxt("m-"+msgArr[i].sn)}else{document.getElementById("moreBtn").disabled=!0;var b=getCookie("BAHAID"),c="",d="";t=document.getElementById("lastTime").value;1<(new Date-new Date(t.substr(0,4),t.substr(5,2)-1,t.substr(8,2),t.substr(11,2),t.substr(14,2),t.substr(17,2)))/7776E6?
(alert("\u60a8\u6c92\u6709\u66f4\u820a\u7684\u52d5\u614b\u4e86\uff01"),document.getElementById("moreBtn").disabled=!1):(r=document.getElementById("daysRange").value,a.toLowerCase()==b.toLowerCase()?(c="/ajax/getMoreMsg.php",d="t="+t+"&r="+r+"&k="+k+"&auto="+document.getElementById("autoReadMore").value+"&lastGetSn="+document.getElementById("lastGetSn").value):(c="/ajax/othersMoreMsg.php",d="t="+t+"&r="+r+"&u="+a+"&k="+k+"&lastGetSn="+document.getElementById("lastGetSn").value),$.ajax({url:c,method:"POST",
param:d,success:function(a){showActiveDiv("readMore",a)}}))}}function countLimit(a,b){var c=a.value,c=c.replace(/&/g,"&amp;"),c=c.replace(/'/g,"&#039;"),c=c.replace(/"/g,"&quot;"),c=c.replace(/</g,"&lt;"),c=c.replace(/>/g,"&gt;"),c=c.replace(/\r/g,""),c=c.replace(/\n/g,"<br />");return c.utf8Length()>3*b?(alert("\u5b57\u6578\u8d85\u904e"+b+"\u500b\u5b57\u4e86\u5594\uff5e"),ture):!1}
function enterkey(a,b,c,d,e){var a=window.event||a,f=isIE()?a.keyCode:a.which,h="main"==c?140:85;if(13==f&&!a.shiftKey)"main"==c?checkMsg():checkReply(d,e),a.preventDefault?a.preventDefault():a.returnValue=!1;else if(countLimit(b,h),b.clientHeight<b.scrollHeight)b.style.height=b.scrollHeight+"px"}
function addnamelist2(a,b){document.forms.addFriend.cid.value=b;document.forms.addFriend.fs.value="1";document.forms.addFriend.cdesc.value="";if("1"==a){if(confirm("\u78ba\u5b9a\u8981\u628a "+b+" \u52a0\u5165\u597d\u53cb?"))document.forms.addFriend.cno.value="1",document.forms.addFriend.submit()}else if("2"==a&&confirm("\u78ba\u5b9a\u8981\u628a"+b+"\u52a0\u5165\u9ed1\u540d\u55ae?"))document.forms.addFriend.cno.value="0",document.forms.addFriend.submit()}
function addbroadcast(a,b,c,d,e,f){""==$.cookie.get("BAHAID")||"guest"==$.cookie.get("BAHAID")?$.mutbox("\u8acb\u5148\u767b\u5165\u624d\u80fd\u9032\u884c\u6b64\u52d5\u4f5c","\u8a0a\u606f",{"\u78ba\u5b9a":function(){location.href="https://user.gamer.com.tw/login.php"}}):egg.bahabox('<form action="" method="POST" name="boradcastfrm"><table border="0"><tr>'+('<td><input name="c1" type="checkbox" value="1" '+(b||"checked")+"/>\u53ed\u5566\u53ed\u5566</td>")+('<td><input name="c2" type="checkbox" value="2" '+
(c||"checked")+"/>\u54c8\u5566\u5340\u767c\u8868</td>")+('<td><input name="c3" type="checkbox" value="4" '+(d||"checked")+"/>\u5c0f\u5c4b\u767c\u8868</td>")+('<td><input name="c4" type="checkbox" value="8" '+(e||"checked")+"/>ACG\u76f8\u95dc</td>")+('<td><input name="c5" type="checkbox" value="64" '+(f||"checked")+"/>\u904a\u6232\u8a0a\u606f</td>")+"</tr></table></form>","\u8a02\u95b1\u52d5\u614b",{"\u8a02\u95b1":function(){broadcasted(a)}})}function closebroadcast(){$.lightbox.close()}
function broadcasted(a){var b=document.forms.boradcastfrm,c=0;b.c1.checked&&(c|=b.c1.value);b.c2.checked&&(c|=b.c2.value);b.c3.checked&&(c|=b.c3.value);b.c4.checked&&(c|=b.c4.value);b.c5.checked&&(c|=b.c5.value);$.ajax({url:"/ajax/broadcast.php",method:"POST",param:"who="+a+"&v="+c,success:function(a){getbroadcast(a)}});return!1}function getbroadcast(a){$.lightbox.close();egg.bahabox(a,"\u8a02\u95b1\u52d5\u614b")}
function goSayHello2(a){$.ajax({url:"/ajax/homeSayhello2.php",method:"POST",param:"owner="+a,success:function(b){showSayHello(a,b)}})}
function showSayHello(a,b){if("\u60a8\u4eca\u5929\u5df2\u7d93\u6253\u904e\u62db\u547c\u4e86\u5594\uff5e"==b){var c;c='<div id="BH-popup"><p class="BH-poptitle">\u6253\u62db\u547c</p><div class="BH-popintxt">'+b+('\u53ef\u4ee5\u5230<a href="http://home.gamer.com.tw/homeusrStatus.php?owner='+a+'&shT=1" target="_blank">\u9019\u88e1</a>\u770b\u4e4b\u524d\u6253\u904e\u7684\u62db\u547c\u5594\uff5e')+'</div><p class="BH-popbtns"><input type="button" value="\u78ba\u5b9a" onclick="javascript:closebroadcast()" /></p></div>';
$.lightbox.close();$.lightbox.open(c)}else alert(b)}function preLoadImg(a){(new Image).src=a}function getNewestFunc(){60<getNewestCount?clearInterval(callNewestFunc):(getNewestCount++,$.ajax({url:"/ajax/getNewestMsg.php",method:"POST",param:"start="+getNewestTime,success:function(a){if("yes"==a)document.getElementById("newestDiv").style.display="block",clearInterval(callNewestFunc)}}));getNewestTime+=getNewestRange}preLoadImg("http://pic.bahamut.com.tw/loading.gif");
function bhImg(a){egg.ajax({url:"/ajax/image.html",success:function(b){b+='<span id="balaTextId" style="display:none;">'+a+"</span>";egg.lightbox(b)}})}
function bhImgOnOk(){switch(parseInt(egg(":radio[name=bhImgMode]:checked").val(),10)){case 1:egg("#BH-popup :radio,#bhImgBtnOk").attr("disabled",!0);egg("#bhImgMsg").html("\u5716\u7247\u4e0a\u50b3\u4e2d, \u8acb\u7a0d\u5019...").show();egg("#bhImgModeUpload").hide();break;case 2:return balaInsertSelectedImage(),!1;case 3:return balaInsertImage(),!1}return!0}
function bhImgModeChange(a){egg("#bhImgModeUpload,#bhImgModeInsertUrl,#bhImgModeTruth,#bhImgTruth").hide();switch(a){case 1:egg("#bhImgModeUpload").show();egg("#BH-popup").css("width","350px");break;case 2:egg("#BH-popup :radio,#bhImgBtnOk").attr("disabled",!0);egg("#bhImgMsg").html("\u53d6\u5f97\u8cc7\u6599\u4e2d, \u8acb\u7a0d\u5019...").show();egg("#bhImgTruth").html("");egg("#bhImgModeTruth").show();balaListTruthImage(1);break;case 3:egg("#BH-popup").css("width","350px"),egg("#bhImgModeInsertUrl").show()}egg.lightbox.refresh()}
function balaInsertSelectedImage(a){if(!a&&(a="",egg(":checkbox[name=bhImgChkImage]:checked").each(function(){a+=this.value+" "}),""===a)){alert("\u8acb\u52fe\u9078\u8981\u5f15\u7528\u7684\u5716\u7247");return}balaInsertUploadedImage(a)}
function balaListTruthImage(a){egg.ajax({url:"/ajax/listtruthimage.php",param:"p="+a,success:function(b){if("ERR_NOLOGIN"==b)alert("\u8acb\u5148\u767b\u5165");else{if(1==a)egg("#bhImgTruth").html(b).show();else{var c=egg("#bhImgMoreImage"+a).get(0),d=c.parentNode;egg(document.createElement("div")).html(b).appendTo(d);d.removeChild(c)}egg("#BH-popup").css("width","610px");egg("#bhImgMsg").hide();egg("#BH-popup :radio,#bhImgBtnOk").attr("disabled",!1);egg.lightbox.refresh()}},fail:function(){alert("\u767c\u751f\u932f\u8aa4, \u8acb\u7a0d\u5f8c\u518d\u8a66\u4e00\u6b21")}})}
function balaInsertImage(){var a=egg("#bhImgImageUrl").val();a.match(/^http[s]?:\/\/(?:.*?)\.(?:jpg|jpeg|gif|png)(?:\?.*)?$/i)?(egg("#"+egg("#balaTextId").html()).get(0).value+=" "+a,egg.lightbox.close()):alert("\u8acb\u8f38\u5165\u6b63\u78ba\u5716\u7247\u7db2\u5740")}function balaInsertUploadedImage(a){egg("#"+egg("#balaTextId").html()).get(0).value+=" "+a;egg.lightbox.close()};

