function changetxt(a){oo=document.getElementById(a);a=oo.innerHTML;a=a.replace(/((http:\/\/(www|jp|tw).youtube.com\/watch\?v=([0-9a-zA-Z_-]{11}))[^ <\u2E80-\u9FFF]*)/gi,'<br><object width="425" height="344"><param name="movie" value="bttp://www.youtube.com/v/$4"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="bttp://www.youtube.com/v/$4" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br>');
a=a.replace(/<a ([^>]*)href="h(ttp:\/\/\S+"[^>]*)>/gi,'<a $1href="b$2>');a=a.replace(/<img ([^>]*)src="h(ttp:\/\/\S+"[^>]*)>/gi,'<img $1src="b$2>');a=a.replace(/>h(ttp:\/\/\S+)</gi,">b$1<");a=a.replace(/'h(ttp:\/\/ref\.gamer\S+)/gi,"'b$1");a=a.replace(/(http:\/\/[^ <\u2E80-\u9FFF]+)/gi,'<br><a href="$1" target="_blank" onclick="if( this.href.substr(0,16) != \'http://ref.gamer\' ){oh = this.innerHTML;this.href=\'http://ref.gamer.com.tw/redir.php?url=\'+encodeURIComponent(this.href);this.innerHTML = oh;this.click();}">$1</a><br>');
a=a.replace(/>(http:\/\/\S+.(jpg|png|gif))/gi,'><img src="$1" border="0" style="max-height:120px;max-width:120px;">');a=a.replace(/bttp:\/\//gi,"http://");a=a.replace(/>b(ttp:\/\/\S+)</gi,">h$1<");a=a.replace(/'b(ttp:\/\/ref\.gamer\S+)/gi,"'h$1");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>');oo.innerHTML=a}
function checkMsg(){var a=document.getElementById("msgtalk"),b=a.value;if(b.utf8Length()>420)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{b="mainmsg.php";var 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);break}document.getElementById("sendingMsg").value=
1;noreply=0;if(document.getElementById("forbidden"))noreply=document.getElementById("forbidden").checked?1:0;secret=document.getElementById("privacy").checked?1:0;$.ajax({url:"/ajax/"+b,method:"POST",param:"msg="+encodeURIComponent(a.value)+"&status="+secret+"&flag="+noreply+c,success:function(e){showActiveDiv("MSG-box2",e)}})}}
function checkReply(a,b){var c=document.getElementById("replyMsg"+a),d=c.value;if(d.utf8Length()>255)alert("\u7559\u8a00\u5b57\u6578\u904e\u591a\uff01");else if(d.replace(/(^\s*)|(\s*$)/g,"")==""){alert("\u8acb\u8f38\u5165\u7559\u8a00");c.focus()}else if(document.getElementById("replyBtn"+a).disabled)alert("\u8655\u7406\u4e2d\uff0c\u8acb\u7a0d\u5019");else{document.getElementById("replyBtn"+a).disabled=true;$.ajax({url:"/ajax/comment.php",method:"POST",param:"a=A&s="+a+"&c="+encodeURIComponent(c.value)+
"&u="+b,success:function(e){showActiveDiv("allReply"+a,e)}})}}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",method:"POST",param:"a=D&s="+a,success:function(b){showActiveDiv("r-"+a,b)}})}
function delMsg_guild(a,b){a=parseInt(a);var c="";switch(a){case 2:c="m-"+b;break;case 3:c="r-"+b;break}if(""==c){alert("\u7121\u6548\u7684\u52d5\u4f5c!");return false}var d=document.getElementById("ori_s");if(!d){alert("\u8cc7\u6599\u4e0d\u5b58\u5728!");return false}if("g"!=d.value.substr(0,1)){alert("\u7121\u6548\u7684\u52d5\u4f5c(1)");return false}confirm("\u78ba\u5b9a\u8981\u522a\u9664\u55ce\uff1f")&&$.ajax({url:"/ajax/delMsgGuild.php",method:"POST",param:"loctype="+a+"&s="+b+"&gsn="+d.value.substr(1),
success:function(e){showActiveDiv(c,e)}})}
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),g="GP"==e?0:1;document.getElementById(e+"Link"+d).innerHTML='<a href="javascript:void(0)" onclick="getVoteList(event,'+d+","+g+')"><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(!("readMore"==a&&1==document.getElementById("autoReadMore").value)){alert(c[0].firstChild.nodeValue);document.getElementById("sendingMsg").value=0}if("readMore"==a){document.getElementById("moreBtn").disabled=false;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)||a=="MSG-box2"||a=="readMore"){d=b.getElementsByTagName("sn")[0].firstChild.nodeValue;e=b.getElementsByTagName("author")[0].firstChild.nodeValue;g=b.getElementsByTagName("nick")[0].firstChild.nodeValue;var f=b.getElementsByTagName("date")[0].firstChild.nodeValue,m=b.getElementsByTagName("content")[0].firstChild.nodeValue;m=m.replace("\n","<br>")}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,g,m,f,1,a.substr(8),c);document.getElementById("replyMsg"+a.substr(8)).value="";changetxt("r-"+d);document.getElementById("replyBtn"+a.substr(8)).disabled=false}else if(a=="MSG-box2"){var h=b.getElementsByTagName("flag")[0].firstChild.nodeValue;c=b.getElementsByTagName("status")[0].firstChild.nodeValue;var n=document.getElementById(a).innerHTML;document.getElementById(a).innerHTML=
buildMsg(d,e,g,"",m,f,0,0,0,"",1,h,c,1)+n;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){d=b.getElementsByTagName("sn");e=b.getElementsByTagName("author");g=b.getElementsByTagName("nick");h=b.getElementsByTagName("kind");f=b.getElementsByTagName("date");m=b.getElementsByTagName("content");
n=b.getElementsByTagName("flag");c=b.getElementsByTagName("status");var p=b.getElementsByTagName("replynum"),q=b.getElementsByTagName("gp"),v=b.getElementsByTagName("bp"),u=b.getElementsByTagName("hasGPBP"),s=b.getElementsByTagName("auxuser"),o=getCookie("BAHAID");for(i=0;i<d.length;i++){var l=b.getElementsByTagName("msg")[i].getElementsByTagName("new3");msgArr[total_ary]=[];for(j=0;j<l.length;j++){var w=l[j].childNodes[1].firstChild.nodeValue.toLowerCase()==o.toLowerCase()||e[i].firstChild.nodeValue.toLowerCase()==
o.toLowerCase()?1:0;w||(w=0<parseInt(s[i].firstChild.nodeValue)?3:0);msgArr[total_ary]["rsn"+j]=l[j].childNodes[0].firstChild.nodeValue;msgArr[total_ary]["ruserid"+j]=l[j].childNodes[1].firstChild.nodeValue;msgArr[total_ary]["rnick"+j]=l[j].childNodes[2].firstChild.nodeValue;msgArr[total_ary]["rcomment"+j]=l[j].childNodes[4].firstChild.nodeValue;msgArr[total_ary]["rtime"+j]=l[j].childNodes[3].firstChild.nodeValue;msgArr[total_ary]["rdel"+j]=w}(l=e[i].firstChild.nodeValue.toLowerCase()==o.toLowerCase()?
1:0)||(l=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=g[i].firstChild.nodeValue;msgArr[total_ary].kind=h[i].firstChild.nodeValue;msgArr[total_ary].content=m[i].firstChild.nodeValue;msgArr[total_ary].ctime=f[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=
l;msgArr[total_ary].noreply=n[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=false;document.getElementById("lastTime").value=b.getElementsByTagName("stime")[0].firstChild.nodeValue;document.getElementById("daysRange").value=b.getElementsByTagName("daysRange")[0].firstChild.nodeValue}}}
function giveGPBP(a,b){$.ajax({url:"/ajax/comment.php",method:"POST",param:"a="+a+"&s="+b,success:function(c){showActiveDiv(a+b,c)}})}function readAllReply(a,b){$.ajax({url:"/ajax/comment.php",method:"POST",param:"a=S&s="+a,loading:function(){b.innerHTML='<img src="http://pic.bahamut.com.tw/loading.gif">'},success:function(c){changeDiv("allReply"+a,c)}})}
function changeDiv(a,b){var c=b.getElementsByTagName("errMsg");if(c.length)alert(c[0].firstChild.nodeValue);else{c=0;if(document.getElementById("auxd"))if(1==parseInt(document.getElementById("auxd").value))c=3;var d="",e=b.getElementsByTagName("sn"),g=b.getElementsByTagName("author"),f=b.getElementsByTagName("nick"),m=b.getElementsByTagName("date"),h=b.getElementsByTagName("content"),n=b.getElementsByTagName("del"),p=a.substr(8);for(i=0;i<e.length;i++)d+=buildReply(e[i].firstChild.nodeValue,g[i].firstChild.nodeValue,
f[i].firstChild.nodeValue,h[i].firstChild.nodeValue,m[i].firstChild.nodeValue,parseInt(n[i].firstChild.nodeValue)?n[i].firstChild.nodeValue:c?c:0,p,i+1);document.getElementById(a).innerHTML=d;changetxt(a)}}
function buildReply(a,b,c,d,e,g,f,m){var h="";h='<div id="r-'+a+'" name="r-'+a+'" class="msgreport BC2">';if(1==g)h+='<a href="javascript:delReplyMsg('+a+')" class="msgdel AB1">\u522a\u9664</a>';else if(3==g)h+='<a href="javascript:" onClick="delMsg_guild(3,'+a+'); return false;" class="msgdel AB1">\u522a\u9664</a>';h+='<a href="http://home.gamer.com.tw/bahawall.php?owner='+b+'" target="_blank"><img src="'+getAvatarPic(b)+'" class="msghead" /></a><div><a href="http://home.gamer.com.tw/bahawall.php?owner='+
b+'" class="msgname AT1">'+c+"</a>\uff1a"+d+'<span><a href="javascript:void(0)" onclick="iWantReply('+f+",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">#'+m+"</span></div>";h+="</div>";return h}
function buildMsg(a,b,c,d,e,g,f,m,h,n,p,q,v,u){var s=1;if("#acg"==b.substr(0,4).toLowerCase()){var o=b.split("_");url="http://acg.gamer.com.tw/acgDetail.php?s="+o[0].substr(4);var l="http://home.gamer.com.tw/singleACMsg.php?sn="+a}else if("#gid"==b.substr(0,4).toLowerCase()){url="http://guild.gamer.com.tw/guild.php?sn="+b.substr(4);s=0;l="http://guild.gamer.com.tw/singleACMsg.php?sn="+a+"&gsn="+b.substr(4,b.length).toLowerCase()}else if($("#ori_s").val()){url="http://home.gamer.com.tw/bahawall.php?owner="+
b;l="http://guild.gamer.com.tw/singleACMsg.php?sn="+a+"&gsn="+$("#ori_s").val().substr(1,$("#ori_s").val().length).toLowerCase()}else{url="http://home.gamer.com.tw/bahawall.php?owner="+b;l="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">';if(1==p)htmlcode+='<a href="javascript:delMainMsg('+a+')" class="msgdel AB1">\u522a\u9664</a>';
else if(2==p)htmlcode+='<a href="javascript:" onClick="delMsg_guild(2,'+a+'); return false;" class="msgdel AB1">\u522a\u9664</a>';if(1==v)htmlcode+='<img src="http://pic.bahamut.com.tw/forum/forum_manager/icon_lock.gif" />';gpStr=0==f?'<span id="GP'+a+'">'+f+"</span>":'<a href="javascript:void(0)" onclick="getVoteList(event,'+a+',0)"><span id="GP'+a+'">'+f+"</span></a>";bpStr=0==m?'<span id="BP'+a+'">'+m+"</span>":'<a href="javascript:void(0)" onclick="getVoteList(event,'+a+',1)"><span id="BP'+a+
'">'+m+"</span></a>";d="NaN"==d?"":d;if(s)htmlcode+='<a href="'+url+'" class="msgname AT1">'+c+"</a>"+d+"\uff1a";htmlcode+=e;htmlcode+='<p class="msgitembar"><span class="msgtime ST1">'+g+"</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">';if(0==q||b.toLowerCase()==getCookie("BAHAID").toLowerCase()){o=1==q?'<font color="red">\u7559\u8a00</font>':"\u7559\u8a00";htmlcode+='<a href="javascript:void(0)" onclick="iWantReply('+a+","+h+",'','')\">"+o+"</a>"}else htmlcode+="\u7981\u6b62\u7559\u8a00";htmlcode+='</span><span><a href="'+
l+'" target="_blank" title="\u53e6\u958b\u6b64\u5247\u7db2\u9801">\u53e6\u958b</a></span></p>';htmlcode+='<div id="allReply'+a+'" name="allReply'+a+'">';if(h>3)htmlcode+='<div class="msgreport BC2"><a href="javascript:void(0)" onclick="readAllReply('+a+',this.parentNode)">\u986f\u793a\u7a0d\u820a\u7684 '+(h-3)+" \u5247\u7559\u8a00</a></div>";htmlcode+=n;htmlcode+="</div>";showText="block";if(1==q||0==h)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)" onclick="showEmotion(event,\'replyMsg'+a+'\')"><img src="http://pic.bahamut.com.tw/editor/emotion2.gif" style="vertical-align:middle"></a>';htmlcode+='<button onclick="checkReply('+a+",'"+b+'\')" id="replyBtn'+a+'">\u53ed\u5566</button></div>';htmlcode+="</div></div>";return htmlcode}
function iWantReply(a,b,c,d){if("none"==document.getElementById("replyDiv"+a).style.display){document.getElementById("replyDiv"+a).style.display="block";document.getElementById("replyMsg"+a).focus()}else if(0==b)document.getElementById("replyDiv"+a).style.display="none";else document.getElementById("replyMsg"+a).focus();if(d)document.getElementById("replyMsg"+a).value+="["+c+":"+d+"]\uff1a"}
function getAvatarPic(a){if(a&&"#"!=a.substr(0,1)){uidlow=a.toLowerCase();return"http://avatar2.bahamut.com.tw/avataruserpic/"+uidlow.substr(0,1)+"/"+uidlow.substr(1,1)+"/"+uidlow+"/"+uidlow+"_s.png"}else if("#acg"==a.substr(0,4).toLowerCase()){a=a.split("_");var b=[],c=[];b[1]="acg-game.gif";b[2]="acg-comic.gif";b[4]="acg-anime.gif";b[8]="acg-novel.gif";c[1]="acg-olg.gif";c[8]="acg-ps3.gif";c[32]="acg-xbox360.gif";c[128]="acg-wii.gif";c[512]="acg-psp.gif";c[1024]="acg-nds.gif";c[262144]="acg-pc.gif";
c[524288]="acg-web.gif";return a[1]&14?"http://pic.bahamut.com.tw/acg/"+b[a[1]]:undefined==c[a[2]]?"http://pic.bahamut.com.tw/acg/"+b[a[1]]:"http://pic.bahamut.com.tw/acg/"+c[a[2]]}else return"#gid"==a.substr(0,4).toLowerCase()?"http://pic.bahamut.com.tw/S/GUILD/c/"+a.substr(4)%10+"/"+$.sprintf("%010d",a.substr(4))+".PNG":"http://pic.bahamut.com.tw/none.gif"}
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+='<a href="http://home.gamer.com.tw/bahawall.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",method:"POST",param:"a=showGPBP&t="+c+"&sn="+b,success:function(f){showVoteList("msgvotelist",f)}});if(isIE()){var g=a.x;a=document.documentElement.scrollTop+a.clientY}else{g=document.body.clientWidth>1E3?a.pageX-(document.body.clientWidth-1E3)/
2:a.pageX;a=a.pageY}e.value=b+"&"+c;d.style.left=g+"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;j<3&&undefined!=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,msgArr[i].replynum>=3?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){a=point_now;var 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=true;b=getCookie("BAHAID");var c="",d="";t=document.getElementById("lastTime").value;r=document.getElementById("daysRange").value;if(a.toLowerCase()==b.toLowerCase()){c="/ajax/getMoreMsg.php";d="t="+t+
"&r="+r+"&k="+k}else{c="/ajax/othersMoreMsg.php";d="t="+t+"&r="+r+"&u="+a+"&k="+k}$.ajax({url:c,method:"POST",param:d,success:function(e){showActiveDiv("readMore",e)}})}}function countLimit(a,b){a.value.utf8Length()>b*3&&alert("\u5b57\u6578\u8d85\u904e"+b+"\u500b\u5b57\u4e86\u5594\uff5e")}
function enterkey(a,b,c,d,e){var g=isIE()?a.keyCode:a.which,f="main"==c?140:85;if(13==g){"main"==c?checkMsg():checkReply(d,e);if(a.preventDefault)a.preventDefault();else a.returnValue=false}else{countLimit(b,f);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(a=="1"){if(confirm("\u78ba\u5b9a\u8981\u628a "+b+" \u52a0\u5165\u597d\u53cb?")){document.forms.addFriend.cno.value="1";document.forms.addFriend.submit()}}else if(a=="2")if(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,g){b=b||"checked";c=c||"checked";d=d||"checked";e=e||"checked";g=g||"checked";var f="";f+='<div id="BH-popup">';f+='<p class="BH-poptitle">\u8a02\u95b1\u52d5\u614b</p>';f+='<form action="" method="POST" name="boradcastfrm">';f+='<div class="BH-popintxt">';f+='<table border="0">';f+="<tr>";f+='<td><input name="c1" type="checkbox" value="1" '+b+"/>\u53ed\u5566\u53ed\u5566</td>";f+='<td><input name="c2" type="checkbox" value="2" '+c+"/>\u54c8\u5566\u5340\u767c\u8868</td>";
f+='<td><input name="c3" type="checkbox" value="4" '+d+"/>\u5c0f\u5c4b\u767c\u8868</td>";f+='<td><input name="c4" type="checkbox" value="8" '+e+"/>ACG\u76f8\u95dc</td>";f+='<td><input name="c5" type="checkbox" value="64" '+g+"/>\u904a\u6232\u8a0a\u606f</td>";f+="</tr>";f+="</table>";f+="</div>";f+="</form>";f+='<p class="BH-popbtns"><input type="button" onclick="broadcasted(\''+a+'\');" value="\u8a02\u95b1" /><input type="button" value="\u53d6\u6d88" onclick="javascript:closebroadcast()" /></p>';
f+="</div>";$.lightbox.open(f)}function closebroadcast(){$.lightbox.close()}function broadcasted(a){var b=document.forms.boradcastfrm,c=0;if(b.c1.checked)c|=b.c1.value;if(b.c2.checked)c|=b.c2.value;if(b.c3.checked)c|=b.c3.value;if(b.c4.checked)c|=b.c4.value;if(b.c5.checked)c|=b.c5.value;$.ajax({url:"/ajax/broadcast.php",method:"POST",param:"who="+a+"&v="+c,success:function(d){getbroadcast(d)}});return false}
function getbroadcast(a){var b="";b+='<div id="BH-popup">';b+='<p class="BH-poptitle">\u8a02\u95b1\u52d5\u614b</p>';b+='<div class="BH-popintxt">';b+=a;b+="</div>";b+='<p class="BH-popbtns"><input type="button" value="\u78ba\u5b9a" onclick="javascript:closebroadcast()" /></p>';b+="</div>";$.lightbox.close();$.lightbox.open(b)}
function addEmotion(a){var b=document.getElementById("emotiontxt").value;document.getElementById("emotionlist").style.display="none";a="[e"+a+"]";b=document.getElementById(b);if(document.selection){b.focus();document.selection.createRange().text+=a}else{var c=b.value.substr(0,b.selectionStart),d=b.value.substr(b.selectionEnd);b.value=c+a+d;b.focus()}}
function showEmotion(a,b){var c=document.getElementById("emotionlist");if("none"==document.getElementById("emotionlist").style.display){if(isIE())var d=a.x,e=document.documentElement.scrollTop+a.clientY;else{d=document.body.clientWidth>1E3?a.pageX-(document.body.clientWidth-1E3)/2:a.pageX;e=a.pageY}c.style.left=d-10+"px";c.style.top=e+10+"px";c.style.display="block";document.getElementById("emotiontxt").value=b}else c.style.display="none"}
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">';c+='<p class="BH-poptitle">\u6253\u62db\u547c</p>';c+='<div class="BH-popintxt">';c+=b;c+='\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';c+="</div>";c+='<p class="BH-popbtns"><input type="button" value="\u78ba\u5b9a" onclick="javascript:closebroadcast()" /></p>';
c+="</div>";$.lightbox.close();$.lightbox.open(c)}else alert(b)}function preLoadImg(a){(new Image).src=a}function getNewestFunc(){if(getNewestCount>60)clearInterval(callNewestFunc);else{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");
