function ArekorePopup(){this.attrs=["ap:banner","title","href","cite","datetime"];this.requiredAttr={"a":"title"};this.ns={xhtml1:"http://www.w3.org/1999/xhtml",xhtml2:"http://www.w3.org/2002/06/xhtml2",ap:"http://www.remus.dti.ne.jp/~a-satomi/ap"};this.safariOnly=false;this.initBeforehand=false;this.initTimeout=3000;this.popupDelay=1000;this.popupSustain=5000;this.offset={X:0,Y:20};this.useRichStyle=true;this.richStyleUseTextShadow=true;this.richStyleUseAILoader=true;this.richStyleEdgeWidth=16;this.richStyleImages={body:"body.png",rect_top:"top.png",rect_left:"left.png",rect_right:"right.png",rect_bottom:"bottom.png",angle_top_left:"top-left.png",angle_top_right:"top-right.png",angle_bottom_left:"bottom-left.png",angle_bottom_right:"bottom-right.png",simple_background:"body.png"};this.cssDir="/hspjs/";this.isSafari=navigator.userAgent.match("AppleWebKit");this.label="ArekorePopup";this.popupBoxId="AP-popup-parent";this.noPopupClassName="AP-noPopup";this.richStyleClassName="AP-richStyle";this.evacuate={"title":"ap:ec-title","alt":"ap:ec-alt"};this.uriAttrsPtn=new RegExp("^(background|cite|classid|code|codebase|data|for|href|longdesc|src|usemap)$","i");this.version="v1.2.5";return this}ArekorePopup.prototype={fixAttrsArray:function(){if(!AP.attrs.length){return }var B=AP.attrs;var A=B.length;AP.attrs={};for(var C=0;C<A;C++){AP.attrs[C]=B[C]}},launch:function(){AP.oBODY=AP.getElements("body")[0];if(!AP.oBODY||AP.safariOnly&&!AP.isSafari||!AP.findCSS()){return }if(AP.isSafari){setTimeout("AP.init()",500)}else{AP.init()}},init:function(){AP.fixAttrsArray();if(!AP.cssEnabledCheck()){return }AP.initTimer=(new Date()).getTime();AP.image.prepare();if(AP.initBeforehand){AP.scanNode.recursive(AP.oBODY)}else{AP.addEvent(AP.oBODY,"mouseover",AP.append)}AP.addEvent(AP.oBODY,"mousemove",AP.getMousePos);AP.addEvent(AP.oBODY,"click",AP.remove);AP.statusMsg.show(AP.label+" ("+AP.version+") launched."+((!AP.initBeforehand)?" wasted for init : "+(((new Date()).getTime()-AP.initTimer)/1000)+" sec.":""),100,5000)},scanNode:{recursive:function(C){var A=C.childNodes;for(var B=0;B<A.length;B++){if(A[B].nodeType!=1){continue}if(AP.scanNode.eachNode(A[B])){AP.scanNode.recursive(A[B])}}},eachNode:function(C){if(AP.initBeforehand){if((new Date()).getTime()-AP.initTimer>AP.initTimeout){return false}AP.evacuateAttr(C);AP.image.loadBanner(C)}var D=(!C.namespaceURI)?C.nodeName.toLowerCase():C.nodeName;var A=false;if(!AP.findAttr.ancestorOrSelf(C,"class",AP.noPopupClassName)){if(AP.requiredAttr[D]){A=(AP.getAttr(C,AP.revealAttr(AP.requiredAttr[D])))}else{for(var B in AP.attrs){if(AP.getAttr(C,AP.revealAttr(AP.attrs[B]))){A=true;break}}}if(A&&AP.initBeforehand){AP.addEvent(C,"mouseover",AP.append);AP.addEvent(C,"mouseout",AP.remove)}}return(AP.initBeforehand)?true:A}},addEvent:function(C,A,B){if(C.addEventListener){C.addEventListener(A,B,false)}else{if(C.attachEvent){C.attachEvent("on"+A,function(){B({type:window.event.type,target:window.event.srcElement,currentTarget:C,clientX:window.event.clientX,clientY:window.event.clientY,pageY:document.body.scrollTop+window.event.clientY,shiftKey:window.event.shiftKey,stopPropagation:function(){window.event.cancelBubble=true}})})}}},findCSS:function(){if(!AP.cssDir){var E=AP.getElements("link");var C=new RegExp("/?"+AP.label+".css$");for(var D=0;D<E.length;D++){var A=AP.getAttr(E[D],"rel");var B=AP.getAttr(E[D],"href");if(A&&B&&A.match(/stylesheet/i)&&B.match(C)){AP.cssDir=B.replace(/[^\/]+$/,"");AP.cssDir=(!AP.cssDir)?"./":AP.cssDir;AP.APcss=E[D];break}}if(!AP.cssDir){AP.statusMsg.show("Can't locate CSS : Not found <link> for \""+AP.label+'.css"',500,15000);return false}}else{if(!AP.APcss){AP.APcss=AP.createElement("link");AP.setAttr(AP.APcss,"rel","stylesheet");AP.setAttr(AP.APcss,"type","text/css");AP.setAttr(AP.APcss,"href",AP.cssDir+AP.label+".css");AP.getElements("head")[0].appendChild(AP.APcss)}}return true},cssEnabledCheck:function(){if(!document.styleSheets){return false}if(AP.APcss){AP.APcss.disabled=false}if(!AP.curPopup){AP.curPopup=AP.createElement("ins");AP.setAttr(AP.curPopup,"id",AP.popupBoxId);AP.curPopup.style.position="absolute";AP.curPopup.style.top="-10000px";AP.oBODY.appendChild(AP.curPopup);AP.addEvent(AP.curPopup,"mouseover",AP.sticky);AP.addEvent(AP.curPopup,"click",AP.command);AP.addEvent(AP.curPopup,"mouseout",AP.remove)}return(AP.curPopup.offsetTop==-10000)},image:{prepare:function(){AP.images=[];AP.useAPBanner=false;for(var B in AP.attrs){if(AP.attrs[B]=="ap:banner"){AP.useAPBanner=true;break}}if(AP.useRichStyle){for(var A in AP.richStyleImages){AP.image.preload(AP.cssDir+AP.richStyleImages[A])}}},preload:function(A){if(!A||!A.match(/(gif|png|jpe?g)$/i)){return }AP.images[A]=new Image();AP.images[A].src=A},enabledCheck:function(){var A=(AP.richStyleEdgeWidth)?"body":"simple_background";return AP.images[AP.cssDir+AP.richStyleImages[A]].complete},loadBanner:function(C,B){if(!AP.useAPBanner||!C||AP.getAttr(C,"ap:preloaded")){return }var A=(B)?AP.findAttr.ancestorOrSelf(C,"ap:banner"):AP.getAttr(C,"ap:banner");AP.image.preload(A);AP.setAttr(C,"ap:preloaded","true")},createImgNode:function(B){var A=AP.images[B];if(!A||!A.complete){return null}if(AP.isSafari){var A=AP.createElement("img");AP.setAttr(A,"src",B)}return A}},append:function(A){if(typeof AP!="object"||AP.curItem){return }if(AP.initBeforehand){A.stopPropagation();AP.curItem=A.currentTarget;AP.popupTimer=setTimeout("AP.popup()",AP.popupDelay)}else{AP.curItem=(A.target.nodeType==3)?A.target.parentNode:A.target;AP.evacuateAttr(AP.curItem,true);AP.image.loadBanner(AP.curItem,true);AP.addEvent(AP.curItem,"mouseout",AP.remove);AP.popupTimer=setTimeout("AP.checkNode()",AP.popupDelay)}},checkNode:function(){if(typeof AP!="object"||!AP.curItem){return }if(AP.scanNode.eachNode(AP.curItem)){AP.popup()}else{if(AP.curItem!=AP.oBODY){AP.curItem=AP.curItem.parentNode;AP.checkNode()}}},popup:function(){if(!AP.cssEnabledCheck()||!AP.curItem){return }var D=AP.createElement("ul");var H=AP.getAttr(AP.curItem,"target");var E=parseInt(AP.windowW*0.9)-AP.richStyleEdgeWidth*2;AP.curPopup.appendChild(D);for(var C in AP.attrs){var A=AP.revealAttr(AP.attrs[C]);var G=AP.getAttr(AP.curItem,A);if(!G){continue}var B=AP.createElement("li");var F=(A.match(AP.uriAttrsPtn))?AP.createAnchor(G,H):(A=="ap:banner")?AP.image.createImgNode(G):document.createTextNode(G);if(F){B.appendChild(F);D.appendChild(B);AP.setAttr(B,"class",AP.attrs[C].replace(/:/,"-"));if(B.offsetWidth>E){B.style.width=E+"px"}}}if(AP.curPopup.offsetWidth>E){D.style.width=E+"px"}AP.applyRichStyle();AP.revisePosition();AP.sustainTimer=setTimeout("AP.remove()",AP.popupSustain)},applyRichStyle:function(){if(!AP.useRichStyle||!AP.image.enabledCheck()){AP.setAttr(AP.curPopup,"class","");return }AP.setAttr(AP.curPopup,"class",AP.richStyleClassName);var E=AP.curPopup.firstChild;var D=AP.richStyleEdgeWidth;if(AP.richStyleUseTextShadow){var G=1,N=[];for(var I=0;I<E.childNodes.length;I++){var J=E.childNodes[I];if(J.runtimeStyle){J.runtimeStyle.filter="progid:DXImageTransform.Microsoft.DropShadow(offX="+G+", offY="+G+', color="black")';J.style.width=J.offsetWidth+"px";J.style.height=J.offsetHeight+"px"}else{N[I]=J.cloneNode(true);AP.setAttr(N[I],"class",AP.getAttr(N[I],"class")+" AP-shadow");var K=(AP.getAttr(J,"class")=="ap-banner")?0:G;N[I].style.top=(J.offsetTop+K)+"px";N[I].style.left=(J.offsetLeft+K)+"px";N[I].style.width=(J.offsetWidth)+"px"}}for(var I=0;I<N.length;I++){E.appendChild(N[I])}}for(var C in AP.richStyleImages){var F=C.split("_")[0];if(F=="body"&&D){var H=E;var M={}}else{if(F=="simple"&&!D){var H=AP.curPopup;var M={}}else{if(F=="angle"&&D){var H=AP.createElement("div");var M={top:(C.split("_")[1]=="top")?0:"auto",bottom:(C.split("_")[1]=="bottom")?0:"auto",left:(C.split("_")[2]=="left")?0:"auto",right:(C.split("_")[2]=="right")?0:"auto",width:D,height:D};AP.setAttr(H,"id","AP-"+C.replace(/_/g,"-"))}else{if(F=="rect"&&D){var H=AP.createElement("div");var L=C.split("_")[1];var M={top:(L.match(/left|right/))?D:(L=="top")?0:"auto",bottom:(L.match(/left|right/))?D:(L=="bottom")?0:"auto",left:(L.match(/top|bottom/))?D:(L=="left")?0:"auto",right:(L.match(/top|bottom/))?D:(L=="right")?0:"auto",width:(L.match(/left|right/))?D:(document.all)?E.offsetWidth:"auto",height:(L.match(/top|bottom/))?D:(document.all)?E.offsetHeight:"auto"};AP.setAttr(H,"id","AP-"+C.replace(/_/g,"-"))}else{continue}}}}for(var B in M){H.style[B]=M[B]+(!isNaN(M[B])?"px":"")}if(H.runtimeStyle&&AP.richStyleUseAILoader){H.runtimeStyle.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+AP.cssDir+AP.richStyleImages[C]+'", sizingMethod="scale")'}else{H.style.backgroundImage="url("+AP.cssDir+AP.richStyleImages[C]+")"}if(H!=AP.curPopup&&H!=E){AP.curPopup.appendChild(H)}}if(AP.curPopup.runtimeStyle&&AP.richStyleUseAILoader&&D){var A=AP.curPopup.childNodes;A[0].style.width=(A[0].offsetWidth+1)+"px";A[0].style.height=(A[0].offsetHeight+1)+"px";A[1].style.width=(A[0].offsetWidth)+"px";A[2].style.height=(A[0].offsetHeight)+"px";A[3].style.height=(A[0].offsetHeight)+"px";A[3].style.left=(A[0].offsetWidth+D-1)+"px";A[4].style.width=(A[0].offsetWidth)+"px";A[4].style.top=(A[0].offsetHeight+D-1)+"px";A[6].style.left=(A[0].offsetWidth+D-1)+"px";A[7].style.top=(A[0].offsetHeight+D-1)+"px";A[8].style.top=(A[0].offsetHeight+D-1)+"px";A[8].style.left=(A[0].offsetWidth+D-1)+"px"}},revisePosition:function(){var B=AP.windowW-(AP.windowX+AP.offset.X+AP.curPopup.offsetWidth+20);var A=AP.windowH-(AP.windowY+AP.offset.Y+AP.curPopup.offsetHeight+20);AP.curPopup.style.left=(AP.mouseX+AP.offset.X+((B<0)?B:0))+"px";AP.curPopup.style.top=(AP.mouseY+AP.offset.Y+((A<0)?A:0))+"px"},sticky:function(A){clearTimeout(AP.removeTimer)},command:function(G){G.stopPropagation();if(G.target.nodeName.toLowerCase()=="ul"&&G.target.runtimeStyle&&AP.richStyleUseAILoader){for(var D=0;D<G.target.childNodes.length;D++){var F=G.target.childNodes[D];if(F.firstChild.nodeType!=1&&F.firstChild.nodeName.toLowerCase()!="a"){continue}var C=G.target.parentNode.offsetTop+AP.richStyleEdgeWidth+F.offsetTop;var E=C+F.offsetHeight;var A=AP.getAttr(F.firstChild,"href");if(G.pageY>C&&G.pageY<E&&A){var H=(G.shiftKey)?"_blank":AP.getAttr(F.firstChild,"target");if(!H){H=AP.getAttr(AP.getElements("base")[0],"target")}if(!H){H="_self"}window.open(A,H);return }}}var B=(G.target.nodeType==1)?G.target.nodeName:G.target.parentNode.nodeName;if(B.toLowerCase()!="a"&&confirm('Disable "'+AP.label+'" ?',"")){AP.attrs=[];AP.remove_()}},remove:function(B){if(typeof AP!="object"||!AP.curPopup||!AP.curItem){return }AP.curItem=null;clearTimeout(AP.popupTimer);clearTimeout(AP.sustainTimer);clearTimeout(AP.removeTimer);var A=Math.ceil(Math.log(Math.sqrt(AP.offset.X*AP.offset.X+AP.offset.Y*AP.offset.Y)+1.5)*18);AP.removeTimer=setTimeout("AP.remove_()",A)},remove_:function(){AP.curPopup.style.top="-10000px";while(AP.curPopup.firstChild){AP.curPopup.removeChild(AP.curPopup.firstChild)}},getElements:function(A){if(A.match(/:/)){var B=attr.split(":")[0];var A=attr.split(":")[1];if(document.getElementsByTagNameNS&&AP.oBODY.namespaceURI){return document.getElementsByTagNameNS(AP.ns[B],A)}else{return document.getElementsByTagName(B+":"+A)}}else{return document.getElementsByTagName(A)}},createElement:function(A){return(document.createElementNS)?document.createElementNS(AP.ns.xhtml1,A):document.createElement(A)},getAttr:function(E,A){if(!E||!A){return null}if(document.all){if(A=="href"&&E.nodeName.toLowerCase()=="img"){return null}if(A=="class"){A+="Name"}}try{var B=E.getAttribute(A)}catch(D){}if(!B&&E.getAttributeNS&&A.match(/:/)){var C=A.split(":")[0];var A=A.split(":")[1];return E.getAttributeNS(AP.ns[C],A)}else{return B}},setAttr:function(C,A,D){if(!C||!A){return }if(A.match(/:/)){var B=A.split(":")[0];var A=A.split(":")[1];if(C.setAttributeNS&&C.namespaceURI||AP.isSafari){C.setAttributeNS(AP.ns[B],A,D)}else{C.setAttribute("xmlns:"+B,AP.ns[B]);C.setAttribute(B+":"+A,D)}}else{if(A=="class"&&document.all){A+="Name"}C.setAttribute(A,D)}},evacuateAttr:function(C,A){if(!C||AP.getAttr(C,"ap:evacuated")){return }for(var B in AP.evacuate){var D=AP.getAttr(C,B);if(D){AP.setAttr(C,B,"");AP.setAttr(C,AP.evacuate[B],D);AP.setAttr(C,"ap:evacuated","true")}}if(A){AP.evacuateAttr(C.parentNode,true)}},revealAttr:function(A){return(!A)?null:(AP.evacuate[A])?AP.evacuate[A]:A},findAttr:{eachNode:function(E,A,F){if(!E||!A){return null}var C=value=AP.getAttr(E,A);if(F){C=(value==F);if(A=="class"&&value){var D=value.split(" ");for(var B in D){if(D[B]==F){C=true;break}}}}return C},ancestorOrSelf:function(C,A,D){var B=AP.findAttr.eachNode(C,A,D);return(B)?B:(C.parentNode)?AP.findAttr.ancestorOrSelf(C.parentNode,A,D):null}},createAnchor:function(B,D){if(!B){return null}var A=AP.createElement("a");AP.setAttr(A,"href",B);if(D){AP.setAttr(A,"target",D)}try{escapeduri=decodeURIComponent(A.href)}catch(C){escapeduri=A.href}A.appendChild(document.createTextNode(escapeduri));return A},getMousePos:function(B){if(typeof AP!="object"){return }var D=document.documentElement;var C=(window.scrollX)?window.scrollX:(D.scrollLeft)?D.scrollLeft:AP.oBODY.scrollLeft;var A=(window.scrollY)?window.scrollY:(D.scrollTop)?D.scrollTop:AP.oBODY.scrollTop;AP.windowW=(window.innerWidth)?window.innerWidth:D.offsetWidth;AP.windowH=(window.innerHeight)?window.innerHeight:D.offsetHeight;AP.windowX=B.clientX-((AP.isSafari)?C:0);AP.windowY=B.clientY-((AP.isSafari)?A:0);AP.mouseX=B.clientX+((!AP.isSafari)?C:0);AP.mouseY=B.clientY+((!AP.isSafari)?A:0)},statusMsg:{set:function(){try{window.status=AP.statusMsg.msg}catch(A){}},clear:function(){try{window.status=AP.statusMsg.msg=""}catch(A){}},show:function(C,A,B){if(AP.msgTimer){clearTimeout(AP.msgTimer)}AP.statusMsg.msg=C;if(!A){AP.statusMsg.set()}else{AP.msgTimer=setTimeout("AP.statusMsg.set()",A)}if(AP.statusMsg.msg&&B){AP.msgTimer=setTimeout("AP.statusMsg.clear()",A+B)}}}};var AP=new ArekorePopup();AP.addEvent(window,"load",AP.launch)