var pt=pfl=false,x,y,fl,al,dl,bIm,fIm,pIm,op=cp=0,pop={init:function(){bIm=SDN.e('div');bIm.className='pop';bIm.style.zindex='100';bIm.style.background='url(/img/loading_b.gif) #000 center center no-repeat';document.body.appendChild(bIm);fIm=SDN.e('div');fIm.className='pop';fIm.style.zindex='150';document.body.appendChild(fIm)},move:function(ev){if(SDN.IE()){var d=document.documentElement||document.body;x=d.scrollLeft+event.clientX;y=d.scrollTop+event.clientY}else{x=ev.pageX;y=ev.pageY}if(pt)pop.position()},position:function(){bIm.style.left=x-sx+14+'px';bIm.style.top=y-sy+14+'px';fIm.style.left=x-sx+20+'px';fIm.style.top=y-sy+20+'px'},resize:function(){var fw=SDN.width(pIm),fh=SDN.height(pIm);bIm.style.width=fw+12+'px';bIm.style.height=fh+12+'px';sx=ox*(fw+40);sy=oy*(fh+40);pop.position()},load:function(){if(pIm.complete)pop.set();else if(pIm)pIm.onload=pop.set;else return},set:function(){bIm.style.backgroundImage='none';pop.resize();if(pfl)pIm.style.visibility='visible';if(!SDN.IE())setTimeout(pop.fadeIn,25)},Pop:function(uri,opt){if(!tg||SDN.lite())return;if(pfl)fIm.removeChild(pIm);pIm=null;pfl=false;op=oi=0;clearTimeout(dl);furi=uri.substr(1);switch(uri.substr(0,1)){case'#':uri='/img/'+furi;break;case'!':uri='/img/haruhi/'+furi;break;case'%':uri='/img/link/'+furi;break}if(typeof opt=='object'){ox=opt.x?opt.x:0;oy=opt.y?opt.y:0;cp=opt.o?opt.o:60;if(typeof opt.t=='object')opt.t.title=''}else{ox=opt?opt:0;oy=0;cp=60}sx=ox*80;sy=oy*80;pt=true;pop.position();bIm.style.width=bIm.style.height=52+'px';bIm.style.visibility=fIm.style.visibility='visible';bIm.style.backgroundImage='url(/img/loading_b.gif)';if(SDN.IE())bIm.style.filter='alpha(opacity='+cp+')';else bIm.style.opacity=fIm.style.opacity='0';pIm=SDN.e('img');pIm.src=uri;pIm.style.margin='0';pIm.style.visibility='hidden';pIm.onerror=function(){bIm.style.width=bIm.style.height=52+'px';bIm.style.backgroundImage='url(/img/loading_e.png)';if(pfl)pIm.style.visibility='hidden'};pfl=true;fIm.style.width=fIm.style.height='auto';fIm.innerHTML='';fIm.appendChild(pIm);if(!SDN.IE())pop.fadeInBg();pop.load()},fadeIn:function(){if(oi<=100){fIm.style.opacity=oi/100;oi+=10;fl=setTimeout(pop.fadeIn,25)}else{return}},fadeInBg:function(){if(op<=cp){bIm.style.opacity=op/100;op+=10;al=setTimeout(pop.fadeInBg,25)}else{op=100}},Del:function(){if(!tg||SDN.lite())return;pt=pfl=false;clearTimeout(fl);clearTimeout(al);if(op>=0&&!SDN.IE()){fIm.style.opacity=op/100;if(op<=cp)bIm.style.opacity=op/100;op-=10;dl=setTimeout(pop.Del,25)}else{bIm.style.visibility=fIm.style.visibility='hidden';if(pIm)fIm.removeChild(pIm);pIm=null}}},box={Roll:function(id,obj,opt){if(!tg)return false;if(opt&&opt.n&&!SDN.height(hide))if(!confirm('OK?'))return false;var click=obj.onclick;obj.onclick=function(){return false};var hide=SDN.i((id.match(/^[0-9]/)?'H':'')+id),htex;try{htex=SDN.i('T'+id)}catch(e){htex=null}var on='&#34920;&#31034;',cl='&#38560;&#12377;',oh=ud=SDN.height(hide);if(opt){if(opt.o)on=opt.o;if(opt.c)cl=opt.c}if(oh){RollUp(oh,ud)}else{hide.style.height='auto';oh=SDN.height(hide);ud=0;hide.style.height='0';RollDown(oh,ud)}function RollUp(oh,ud){if(ud>1&&!SDN.lite()){var sc=SDN.IE()?2.5:3;ud-=Math.max(1,Math.min(Math.round(ud/sc),Math.round(oh/sc*2)));hide.style.height=ud+'px';setTimeout(function(){RollUp(oh,ud)},20)}else{hide.style.height='0';obj.onclick=click;if(htex)htex.innerHTML=on}}function RollDown(oh,ud){if(ud<oh&&!SDN.lite()){var sc=SDN.IE()?2.5:3;ud+=Math.max(1,Math.min(Math.round(oh/sc*2),Math.round((oh-ud)/sc)));hide.style.height=ud+'px';setTimeout(function(){RollDown(oh,ud)},20)}else{hide.style.height='auto';obj.onclick=click;if(htex)htex.innerHTML=cl}}return false}};SDN.add(window,'load',pop.init);SDN.add(document,'mousemove',pop.move)
