function be(i,r){var w=window.open('http://be.2ch.net/test/p.php?i='+i+'&u=d:'+''+r);if(w)w.focus();}
var pop = new Object;var _NN67,_OP678; onload=init;
function init(){pop.opt = new Object;pop.opt.idpopup = 1; pop.opt.mailpopup = 1; pop.opt.refpopup = 1; pop.opt.respopup = 1; pop.opt.opa = 1; pop.max=15; pop.lev=0; pop.lay= new Array(pop.max); pop.ids = new Array; pop.refs = new Array; pop.res = new Array; pop.dir = new Object; pop.flg = new Object; pop.flg.cnt = 0; pop.flg.mout = 0; pop.flg.touch = 0; pop.timer = new Object; _NN67=navigator.userAgent.match(/Netscape.[67]/);_OP678=navigator.userAgent.match(/Opera.[678]/);document.onmouseover = event_mouseover;document.onmouseout = event_mouseout;if (pop.opt.idpopup+pop.opt.refpopup!=0) document.onmousedown = event_click;var i,s;for (i=0;i<=pop.max;i++) { pop.lay[i] = document.createElement("div"); if (i<10) sl="0"+String(i); else sl=String(i); pop.lay[i].id="sty"+sl; pop.lay[i].style.visibility = "hidden"; pop.lay[i].style.top = "0px"; pop.lay[i].style.position = "absolute"; pop.lay[i].style.fontSize = "12pt"; pop.lay[i].style.border = "1px solid gray"; pop.lay[i].style.padding = "6px"; pop.lay[i].style.color = "#000000"; pop.lay[i].style.backgroundColor = "#f5fffa"; pop.lay[i].style.visibility = "hidden"; document.body.appendChild(pop.lay[i]);}if (document.all && !window.opera) { document.all.tags("DL")[0].style.cssText="width:"+String(screen.width)+"px"; document.all.tags("DT")[0].style.cssText="width:"+String(screen.width)+"px";}}
function event_click(e) {var s,spn;if (document.all) { s=window.event.srcElement; if (!window.opera && event.button!=1) return; try { spn=(s.tagName=="A" && s.href==null); } catch(e) { return; } }else { if (e.button!=0) return; s=e.target;}if (s==null) return;pop.tags=s.tagName;for (;;) { var rect=get_cursor(e); var resnum,ar=new Array; if (s.tagName=='A' && s.href=="" && s.name!="") { resnum=parseInt(s.name.match(/[0-9]{1,5}$/)); ar[1]=rect[0]-parseInt(document.body.offsetLeft); if (resnum==null) break; } else { if (s.tagName!='DT' && s.tagName!='DIV') break; ar=check_dtpos(s,rect[0]); resnum=ar[0]; if (isNaN(resnum)) break; } if (pop.opt.refpopup==0) break; var ref=findrefres(resnum); if (ref==null) pophtml="(この投稿に対するレスはありません)"; else { control_multiplepopup(s); var pophtml=edit_popuphtml(ref); if (pophtml=="") return; } pop.res[pop.lev+1]=String(resnum); pop.lev++; show_popup(pophtml,ar[1],rect[1],4+(ref==null)*7); return;}for (;;) { if (pop.opt.idpopup==0) break; if (s.tagName!='DT' && (s.tagName!='DIV' || s.id.substr(5,1)!='a')) break; if (pop.lev==pop.max) break; var ida=findid(s); if (ida[0]==null || ida[0].match(/^\?\?\?/)) return; var c=0,i=1; for (;i<=pop.lev;i++) { if (ida[0]==pop.res[i]) c++; } if (c>=2) return; control_multiplepopup(s); var pophtml=""; if (ida[1].indexOf(" ")==-1) pophtml="(他に同じIDの投稿はありません)"; else pophtml=edit_popuphtml(ida[1]); pop.res[pop.lev+1]=ida[0]; pop.lev++; show_popup(pophtml,rect[0],rect[1],(pophtml.substr(0,1)=='(')*8+2); return;}}
function event_mouseover(e) {var s,spn;if (document.all) { s=window.event.srcElement; try { spn=(s.tagName=="A" && s.href==null); } catch(e) { return; } }else s=e.target;if (s.parentElement) spn=s.parentElement; else spn=s.parentNode;for (;;) { if (s.id.substr(0,3)=='sty' || s.id.substr(0,3)=='pop') { lay_mouseover(s); break; } if (s.tagName!='A' && s.tagName!='B') break; var ss; if (s.tagName=='A') ss=s; else ss=spn; if (ss==null || ss.href==null || pop.opt.mailpopup==0) break; if (ss.href.substr(0,7)!="mailto:") break; if (ss.href.indexOf("%",0)!=-1) ss.setAttribute("title",decodeURI(ss.href.replace(/^mailto:/,""))); else ss.setAttribute("title",ss.href.replace(/^mailto:/,"")); return;}for (;;) { if (s.tagName!='A' || pop.lev==pop.max || pop.opt.respopup==0) break; if (spn.tagName=="SPAN" || spn.tagName=="BODY") break; pop.tags=s.tagName; var anc=get_resnumfroma(s); if (anc==null) break; control_multiplepopup(spn); var c=0,i=1,lv,sa=""; for (i=0,pop.res[pop.lev+1]="";i<anc.length;i++) pop.res[pop.lev+1]+=anc[i]+" "; for (lv=1;lv<=pop.lev;lv++) { if (pop.res[pop.lev+1]==pop.res[lv]) c++; } if (c>=2) return; for (i=0;i<anc.length && i<25;i++) sa+=anc[i]+" "; var pophtml=edit_popuphtml(sa); if (pophtml=="") return; var rect=get_cursor(e); pop.lev++; show_popup(pophtml,rect[0],rect[1],1); return; }}
function event_mouseout(e) {var s;if (document.all) s=window.event.srcElement; else s=e.target;if (pop.lev==0) return;if (pop.flg.cnt>1 && s.tagName==pop.tags) { if (pop.lay[pop.lev].style.visibility!="visible") return; pop.flg.cnt=1; pop.flg.mout=pop.lev; pop.flg.touch=0; if (pop.timer.i!=null) clearTimeout(pop.timer.i); pop.timer.i=setTimeout("event_timer()",750);}if (s.id.substr(0,3)=='sty' || s.id.substr(0,3)=='pop') { lay_mouseout(s);}}
function event_timer() {if (pop.timer.i!=null) pop.flg.cnt=0;pop.timer.t=null , pop.timer.i=null;if (pop.flg.mout==pop.flg.touch) return;var v;if (pop.flg.touch==0) v=1; else v=pop.flg.touch+1;hide_popup(v);pop.lev=(v-1)*(pop.lev>0);}
function lay_mouseover(e) {var c=parseInt(e.id.substr(3,2),10);pop.flg.touch=c;if (pop.flg.cnt==1 && pop.flg.mout<=c) { pop.flg.cnt = 0; if (pop.timer.i!=null) clearTimeout(pop.timer.i); pop.timer.i=null;}}
function lay_mouseout(e) {if (!(pop.timer.t!=null && pop.flg.mout>parseInt(e.id.substr(3,2),10))) pop.flg.mout=parseInt(e.id.substr(3,2),10);pop.flg.touch=0;if (pop.timer.t!=null) clearTimeout(pop.timer.t);pop.timer.t=setTimeout("event_timer()",250);}
function get_resnumfroma(s) {if (s==null) return;for (;;) { try { var spn=(s.tagName=="A" && s.href==null); } catch(e) { return; } if (s.href.match(/\/[0-9]{9,10}\/[0-9]{1,5}$/)) break; if (s.href.match(/#.{0,3}[0-9]{1,5}$/)) break; return null;}var lstr=mbdtosbd(s.innerHTML).replace(/&gt;|\>/g,"").replace(/[\+\,]/g," "); if (lstr.match(/[^0-9\s\-]/)) return null; if (lstr.indexOf("-")==-1) { return lstr.split(" ");}var lsa=lstr.split(" "),i,j;for (i=0,lstr="";lsa[i]!=null;i++) { if (lsa[i].indexOf("-")==-1) { lstr+=lsa[i]+" "; continue; } var sp,ep; sp=parseInt(lsa[i].match(/^[0-9]+/)); ep=parseInt(lsa[i].match(/[0-9]+$/)); if (isNaN(ep)) ep=sp+24; if (ep-sp>998) ep=sp+999; for (j=sp;j<=ep;j++) lstr+=String(j)+" ";}return lstr.split(" ");}
function get_anchor(num) {var l,v,d=0,res,s;if (num<1) return null; l=document.getElementsByTagName('DT').length;if (l==0) return null; l<num-1 ? v=l-1 : v=num-1;for (;v<l;v+=d) { s=document.getElementsByTagName('DT')[v]; if (s.firstChild.name!=null) res=parseInt(s.firstChild.name.match(/[0-9]+/),10); else res=parseInt(s.innerHTML.substr(0,5).match(/[0-9]+/),10); if (res==num) return s; if ((res>num && d==1) || (res<num && d==-1)) break; res>num ? d=-1 : d=1; }return null;}
function get_cursor(e) {var a=new Array;if (document.all) a[0]=parseInt(event.x),a[1]=parseInt(event.y);else a[0]=parseInt(e.clientX),a[1]=parseInt(e.clientY);return a;}
function control_multiplepopup(s) {if (pop.lev==0 || s==null) return null;var v,poplv;if (s.id.substr(0,3)=="pop") poplv=parseInt(s.id.substr(3,2),10);else { var spn; if (s.parentElement) spn=s.parentElement; else spn=s.parentNode; if (spn.id.substr(0,3)=="pop") poplv=parseInt(spn.id.substr(3,2),10); else poplv=0;}if (pop.lev==1 && poplv==0) v=pop.lev+1; if (pop.lev!=poplv) v=poplv+1; if (v==null) return null;hide_popup(v);pop.lev=(pop.lev-1)*(pop.lev>0);return 1;}
function edit_popuphtml(strnumarray) {if (strnumarray=="") return;var numarray=strnumarray.split(" ");var i,idstr,popstr="",tnode;if (pop.lev+1<10) idstr="0"+String(pop.lev+1); else idstr=String(pop.lev+1);for (i=0;numarray[i]!=null;i++) { tnode=get_anchor(parseInt(numarray[i])); if (tnode==null) continue; popstr+='<div id="pop'+idstr+'a" onmouseover="lay_mouseover(this)" onmouseout="lay_mouseout(this)">'+tnode.innerHTML+'</div>'; popstr+='<div id="pop'+idstr+'b" style="margin:0px 0px 0px 28px;" onmouseover="lay_mouseover(this)" onmouseout="lay_mouseout(this)">'; popstr+=tnode.nextSibling.innerHTML+"</div>"; }return popstr;}
function show_popup(d,ex,ey,popupkind) {var x,y;var dbst=parseInt(Math.max(document.documentElement.scrollTop,document.body.scrollTop));var dbch=parseInt(Math.min(document.documentElement.clientHeight,document.body.clientHeight));var dbsl=parseInt(document.body.scrollLeft);var dbcw=parseInt(document.body.clientWidth);dbch+=(dbch==0)*document.body.clientHeight;if (window.innerHeight) dbch=window.innerHeight; if (window.innerWidth) dbcw=window.innerWidth;var ll=pop.lay[pop.lev];if (pop.timer.t!=null) clearTimeout(pop.timer.t);if (pop.timer.i!=null) clearTimeout(pop.timer.i);pop.timer.t=null , pop.timer.i=null;ll.innerHTML=d; if (popupkind==2) { pop.lev==1 ? ex=dbsl+70 : ex=parseInt(pop.lay[pop.lev-1].style.left,10)-dbsl+54; pop.lev==1 ? ey=ey+29 : ey=parseInt(pop.lay[pop.lev-1].style.top,10)-dbst+32;}ex+=12; var llch,llcw;if (_NN67) llch=ll.offsetHeight,llcw=ll.offsetWidth;else llch=ll.clientHeight,llcw=ll.clientWidth;if (pop.lev==1 || pop.dir.y==0) ey>dbch/2 ? pop.dir.y=-1 : pop.dir.y=1;if (popupkind==4 || popupkind==11) { pop.dir.y=1; ey+=6;}popupkind==10 ? ey+=6*pop.dir.y : ey=ey;if (pop.dir.y<0) { if (pop.lev>1 && ey-llch<0) pop.dir.y=0; ey-llch<0 ? y=dbst : y=dbst+ey-llch; }else { if (pop.lev>1 && ey+llch>dbch) pop.dir.y=0; ey+llch>dbch ? y=dbst+dbch-llch-2 : y=dbst+ey; }if (y<1) y=1;if (pop.lev==1 || pop.dir.x==0) pop.dir.x=1;if (pop.dir.x>0) { if (pop.lev>1 && llcw>dbcw-ex) pop.dir.x=-1; ex+llcw>dbcw ? x=dbcw-llcw-3 : x=ex; }else { if (pop.lev>1 && ex-llcw<0) pop.dir.x=1; ex-llcw<0 ? x=0 : x=ex-llcw; }if (x<1) x=1;var a=0;for (;;) { if (ll.style.overflow==null) break; if (_NN67) { ll.style.overflow="auto"; break; } if (ll.offsetHeight>=dbch) a=1,y=dbst; if (ll.style.overflowY && !_NN67) ll.style.overflowY="visible"; else ll.style.overflow="visible"; if (a==0) break; var llowIE=ll.offsetWidth; ll.style.height=String(dbch)+"px"; if (window.opera) { ll.style.overflow="auto"; if (_OP678) ll.style.overflow="visible"; break; } if (ll.style.overflowY==null) { ll.style.overflow="scroll"; break; } ll.style.overflowY="scroll"; if (document.all && !window.opera) ll.style.pixelWidth=llowIE+22; break;}if (pop.opt.opa==1) { if (document.body.style.opacity!=null) ll.style.opacity = "0.95"; else ll.style.filter="Alpha(opacity=95)";} ll.style.left=String(x)+"px";ll.style.top=String(y)+"px";ll.style.visibility="visible"; pophideflag=0;pop.flg.cnt=(popupkind==2)*3+(popupkind==1)*2+(popupkind==4)*4;if (pop.flg.cnt==0) hide_popup(pop.lev,"delay"); }
function hide_popup(l,d) {if (d=="delay") { pop.flg.touch=l-1; pop.flg.mout=pop.lev; if (pop.timer.t!=null) clearTimeout(pop.timer.t); pop.timer.t=setTimeout("event_timer()",700); return;}for (i=pop.max;i>=l;i--) { if (pop.lay[i].style.visibility=="hidden") continue; if (pop.lay[i].style.overflow!=null) pop.lay[i].style.overflowX=""; pop.lay[i].innerHTML=""; pop.lay[i].style.overflow=""; pop.lay[i].style.overflowX=""; pop.lay[i].style.overflowY=""; pop.lay[i].style.width=""; pop.lay[i].style.height=""; pop.lay[i].style.visibility="hidden";}return;}
function check_dtpos(s,ex) {pop.lay[0].innerHTML="<dl><dt>"+s.innerHTML+"</dt></dl>";var lx,v;if (pop.lay[0].clientWidth) v=pop.lay[0].clientWidth; else v=pop.lay[0].offsetWidth;pop.lay[0].innerHTML="";if (pop.lev==0) lx=parseInt(document.body.offsetLeft);else { var sl; if (pop.lev<10) sl="0"+String(pop.lev); else sl=String(pop.lev); lx=parseInt(document.getElementById("sty"+sl).style.left);}var ar=new Array;if (ex-lx<50 || ex-lx>v) { if (s.firstChild!=null && s.firstChild.name!=null) ar[0]=s.firstChild.name.match(/[0-9]{1,5}$/); else ar[0]=parseInt(s.innerHTML.match(/^[0-9]{1,5}/));}else ar[0]=NaN; ar[1]=lx+50;return ar;}
function mbdtosbd(s) {var mbd=new String("０１２３４５６７８９＋−，＞");var sbd=new String("0123456789+-,>");var d=new String,c,p;for (p=0;p<s.length;p++) { c=mbd.indexOf(s.substr(p,1),0); if (c!=-1) d+=sbd.charAt(c); else d+=s.charAt(p);}return d;}
function findrefres(res) {if (pop.refs[0]!="done") { var s=new Array,r,lim,ss; lim=document.getElementsByTagName("DD").length; if (lim<1) return; for (r=0;r<lim;r++) { s[r]=document.getElementsByTagName("DD")[r].firstChild; } var prv,c,v; for (r=0;r<lim;r++) { for (ss=s[r];ss!=null;ss=ss.nextSibling) { if (ss.tagName!="A") continue; var anc=get_resnumfroma(ss); if (anc==null) continue; for (c=0;anc[c]!=null && c<lim;c++) { v=parseInt(anc[c]); if (v>=r+1) continue; if (pop.refs[v]==null) pop.refs[v]=String(r+1); else { if (pop.refs[v].indexOf(String(r+1))!=-1) continue; pop.refs[v]+=" "+String(r+1); } } } } pop.refs[0]="done";}var retval;if (pop.refs[res]=="") retval=null; else retval=pop.refs[res];return retval;}
function findid(s) {var retval=new Array(2);var ss;if (pop.ids['idget']!="done") { var idstr; var sa=new Array; var i,l; l=document.getElementsByTagName("DT").length; if (l<1) return; for (i=0;i<l;i++) { sa[i]=document.getElementsByTagName("DT")[i]; } for (i=0;i<l;i++) { ss=sa[i].innerHTML.match(/ID:([0-9A-Za-z\/\+\.]+)/); (ss==null) ? idstr="" : idstr=ss[1]; if (idstr=="") continue; if (pop.ids[idstr]==null) pop.ids[idstr]=String(i+1); else pop.ids[idstr]+=" "+String(i+1); } pop.ids['idget']="done";}ss=s.innerHTML.match(/ID:([0-9A-Za-z\/\+\.]+)/);(ss==null) ? retval[0]="" : retval[0]=ss[1];retval[1]=pop.ids[retval[0]]; if (retval[0]==null || retval[1]==null) retval[0]=null,retval[1]=null;return retval;}
