var msgwidth=0;function attachimg(f,e){if(e=="load"){if(is_ie&&is_ie<7){var a=fetchOffset(f);msgwidth=document.body.clientWidth-a.left-20}else{if(!msgwidth){var b=/postcontent|message/i;var d=f;while((d=d.parentNode)!=null){var c=b.exec(d.className);if(c!=null){msgwidth=d.clientWidth-20;break}}if(msgwidth<1){msgwidth=window.screen.width}}}if(f.width>msgwidth){f.resized=true;f.width=msgwidth;f.style.cursor="pointer"}else{f.onclick=null}}else{if(e=="mouseover"){if(f.resized){f.style.cursor="pointer"}}}}function attachimginfo(f,b,a,e){objinfo=fetchOffset(f);if(a){$(b).style.left=objinfo.left+"px";$(b).style.top=f.offsetHeight<40?(objinfo.top+f.offsetHeight)+"px":objinfo.top+"px";$(b).style.display=""}else{if(is_ie){$(b).style.display="none";return}else{var d=document.body.scrollLeft+e.clientX;var c=document.documentElement.scrollTop+e.clientY;if(d<objinfo.left||d>objinfo.left+objinfo.width||c<objinfo.top||c>objinfo.top+objinfo.height){$(b).style.display="none"}}}}function copycode(b){if(is_ie&&b.style.display!="none"){var a=document.body.createTextRange();a.moveToElementText(b);a.scrollIntoView();a.select();a.execCommand("Copy");a.collapse(false)}}function signature(b){if(b.style.maxHeightIE!=""){var a=(b.scrollHeight>parseInt(b.style.maxHeightIE))?b.style.maxHeightIE:b.scrollHeight;if(b.innerHTML.indexOf("<IMG ")==-1){b.style.maxHeightIE=""}return a}}function fastreply(c,b){if($("postform")){var a=$("postnum"+b).innerHTML;if($("userinfo"+b)){a+=" "+$("userinfo"+b).innerHTML}$("postform").subject.value=c.replace(/#/,a.replace(/<[\/\!]*?[^<>]*?>/ig,""));$("postform").message.focus()}}function tagshow(a){var b=is_ie?a.srcElement:a.target;b.id=!b.id?"tag_"+Math.random():b.id;ajaxmenu(a,b.id,0,"",1,3,0);b.onclick=null}var zoomobj=Array();var zoomadjust;var zoomstatus=1;function zoom(a,b){if(!zoomstatus){window.open(b,"","");return}if(!b){b=a.src}if(!$("zoomimglayer_bg")){div=document.createElement("div");div.id="zoomimglayer_bg";div.style.position="absolute";div.style.left=div.style.top="0px";div.style.width="100%";div.style.height=document.body.scrollHeight+"px";div.style.backgroundColor="#000";div.style.display="none";div.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=80,finishOpacity=100,style=0)";div.style.opacity=0.8;$("append_parent").appendChild(div);div=document.createElement("div");div.id="zoomimglayer";div.style.position="absolute";div.className="popupmenu_popup";div.style.padding=0;$("append_parent").appendChild(div)}zoomobj.srcinfo=fetchOffset(a);zoomobj.srcobj=a;zoomobj.zimg=b;$("zoomimglayer").style.display="";$("zoomimglayer").style.left=zoomobj.srcinfo["left"]+"px";$("zoomimglayer").style.top=zoomobj.srcinfo["top"]+"px";$("zoomimglayer").style.width=zoomobj.srcobj.width+"px";$("zoomimglayer").style.height=zoomobj.srcobj.height+"px";$("zoomimglayer").style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=40,finishOpacity=100,style=0)";$("zoomimglayer").style.opacity=0.4;$("zoomimglayer").style.zIndex=999;$("zoomimglayer").innerHTML='<table width="100%" height="100%" cellspacing="0" cellpadding="0"><tr><td align="center" valign="middle"><img src="'+IMGDIR+'/loading.gif"></td></tr></table><div style="position:absolute;top:-100000px;visibility:hidden"><img onload="zoomimgresize(this)" src="'+zoomobj.zimg+'"></div>'}var zoomdragstart=new Array();var zoomclick=0;function zoomdrag(b,c){if(c==1){zoomclick=1;zoomdragstart=is_ie?[event.clientX,event.clientY]:[b.clientX,b.clientY];zoomdragstart[2]=parseInt($("zoomimglayer").style.left);zoomdragstart[3]=parseInt($("zoomimglayer").style.top);doane(b)}else{if(c==2&&zoomdragstart[0]){zoomclick=0;var a=is_ie?[event.clientX,event.clientY]:[b.clientX,b.clientY];$("zoomimglayer").style.left=(zoomdragstart[2]+a[0]-zoomdragstart[0])+"px";$("zoomimglayer").style.top=(zoomdragstart[3]+a[1]-zoomdragstart[1])+"px";doane(b)}else{if(c==3){if(zoomclick){zoomclose()}zoomdragstart=[];doane(b)}}}}function zoomST(b){if($("zoomimglayer").style.display==""){$("zoomimglayer").style.left=(parseInt($("zoomimglayer").style.left)+zoomobj.x)+"px";$("zoomimglayer").style.top=(parseInt($("zoomimglayer").style.top)+zoomobj.y)+"px";$("zoomimglayer").style.width=(parseInt($("zoomimglayer").style.width)+zoomobj.w)+"px";$("zoomimglayer").style.height=(parseInt($("zoomimglayer").style.height)+zoomobj.h)+"px";var a=b*20;$("zoomimglayer").style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+a+",finishOpacity=100,style=0)";$("zoomimglayer").style.opacity=a/100;b++;if(b<=5){setTimeout("zoomST("+b+")",5)}else{zoomadjust=1;$("zoomimglayer").style.filter="";$("zoomimglayer_bg").style.display="";$("zoomimglayer").innerHTML='<table cellspacing="0" cellpadding="2"><tr><td style="text-align: right">鼠標滾輪縮放圖片 <a href="'+zoomobj.zimg+'" target="_blank"><img src="'+IMGDIR+'/newwindow.gif" border="0" style="vertical-align: middle" title="在新視窗打開" /></a> <a href="###" onclick="zoomimgadjust(event, 1)"><img src="'+IMGDIR+'/resize.gif" border="0" style="vertical-align: middle" title="實際大小" /></a> <a href="###" onclick="zoomclose()"><img style="vertical-align: middle" src="'+IMGDIR+'/close.gif" title="關閉" /></a>&nbsp;</td></tr><tr><td align="center" id="zoomimgbox"><img id="zoomimg" style="cursor: move; margin: 5px;" src="'+zoomobj.zimg+'" width="'+$("zoomimglayer").style.width+'" height="'+$("zoomimglayer").style.height+'"></td></tr></table>';$("zoomimglayer").style.overflow="visible";$("zoomimglayer").style.width=$("zoomimglayer").style.height="auto";if(is_ie){$("zoomimglayer").onmousewheel=zoomimgadjust}else{$("zoomimglayer").addEventListener("DOMMouseScroll",zoomimgadjust,false)}$("zoomimgbox").onmousedown=function(c){try{zoomdrag(c,1)}catch(d){}};$("zoomimgbox").onmousemove=function(c){try{zoomdrag(c,2)}catch(d){}};$("zoomimgbox").onmouseup=function(c){try{zoomdrag(c,3)}catch(d){}}}}}function zoomimgresize(j){zoomobj.zimginfo=[j.width,j.height];var f=j.width/j.height;var b=document.body.clientWidth*0.95;b=j.width>b?b:j.width;var e=b/f;var c=document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight;var g=document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop;if(e>c){e=c;b=e*f}var a=(document.body.clientWidth-b)/2;var d=e<c?(c-e)/2:0;d+=+g;zoomobj.x=(a-zoomobj.srcinfo["left"])/5;zoomobj.y=(d-zoomobj.srcinfo["top"])/5;zoomobj.w=(b-zoomobj.srcobj.width)/5;zoomobj.h=(e-zoomobj.srcobj.height)/5;$("zoomimglayer").style.filter="";$("zoomimglayer").innerHTML="";setTimeout("zoomST(1)",5)}function zoomimgadjust(h,c){if(!c){if(!h){h=window.event}if(h.altKey||h.shiftKey||h.ctrlKey){return}var b=parseInt($("zoomimglayer").style.left);var f=parseInt($("zoomimglayer").style.top);if(h.wheelDelta<=0||h.detail>0){if($("zoomimg").width<=200||$("zoomimg").height<=200){doane(h);return}$("zoomimg").width-=zoomobj.zimginfo[0]/10;$("zoomimg").height-=zoomobj.zimginfo[1]/10;b+=zoomobj.zimginfo[0]/20;f+=zoomobj.zimginfo[1]/20}else{if($("zoomimg").width>=zoomobj.zimginfo[0]){zoomimgadjust(h,1);return}$("zoomimg").width+=zoomobj.zimginfo[0]/10;$("zoomimg").height+=zoomobj.zimginfo[1]/10;b-=zoomobj.zimginfo[0]/20;f-=zoomobj.zimginfo[1]/20}}else{var d=document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight;var g=document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop;$("zoomimg").width=zoomobj.zimginfo[0];$("zoomimg").height=zoomobj.zimginfo[1];var b=(document.body.clientWidth-$("zoomimg").clientWidth)/2;b=b>0?b:0;var f=(d-$("zoomimg").clientHeight)/2+g;f=f>0?f:0}$("zoomimglayer").style.left=b+"px";$("zoomimglayer").style.top=f+"px";$("zoomimglayer_bg").style.height=f+$("zoomimglayer").clientHeight>$("zoomimglayer_bg").clientHeight?(f+$("zoomimglayer").clientHeight)+"px":$("zoomimglayer_bg").style.height;doane(h)}function zoomclose(){$("zoomimglayer").innerHTML="";$("zoomimglayer").style.display="none";$("zoomimglayer_bg").style.display="none"}function videoPlay(a,b,d,c){ajaxget("api/video.php?action=updatevideoinfo&vid="+a+"&vtime="+b+"&tid="+d+"&pid="+c,"")}function parsetag(){var a=new Array();var b=$("firstpost").innerHTML.replace(/(^|>)([^<]+)(?=<|$)/ig,function(c,f,e,d){for(i in tagarray){if(tagarray[i]&&e.indexOf(tagarray[i])!=-1){e=e.replace(tagarray[i],"<h_ "+i+">");a[i]=tagarray[i];tagarray[i]=""}}return f+e});$("firstpost").innerHTML=b.replace(/<h_ (\d+)>/ig,function(c,d){return'<span href="tag.php?name='+tagencarray[d]+'" onclick="tagshow(event)" class="t_tag">'+a[d]+"</span>"})};