(function(){var i=this;this.janet_ad_domain='https://j-a-net.jp';this.janet_ad_url=this.janet_ad_domain+'/janet_ad/';this.janet_user_agent=navigator.userAgent;this.janet_jq_src=this.janet_ad_domain+'/javascript/jquery-1.6.1.min.js';this.janet_banner=4;this.max_height=250;this.advWidth=640;this.advHeight=100;this.hideTime=200;this.checkTime=100;this.timeoutId=null;this.intervalId=null;this.max_height_h=35;this.touch=0;this.max_height_from_bottom=40;this.advs=[];this.advsInterval=8000;this.moveInterval=10;this.moveDuration=300;this.hideAdv=function(){if(i.adv){i.adv.style.visibility='hidden';i.adv.style.display='none'}};this.clearTimeout=function(){if(i.timeoutId){clearTimeout(i.timeoutId);i.timeoutId=null}if(i.intervalId){clearInterval(i.intervalId);i.intervalId=null}};this.setTimeout=function(f,time){var id=setTimeout(f,time);i.timeoutId=id};this.setInterval=function(f,time){var id=setInterval(f,time);i.intervalId=id};this.getViewPortDimension=function(){var a={};a.left=window.scrollX;a.top=window.scrollY;a.width=window.innerWidth;a.height=window.innerHeight;return a};this.scaleScreenAdvDimensionToBody=function(sd){var vd=i.getViewPortDimension();var scaleScreenToViewPort=window.screen.width/vd.width;var a={};a.width=Math.ceil(sd.width/scaleScreenToViewPort);a.height=Math.ceil(sd.height/scaleScreenToViewPort);return a};this.maxAdvScreenDimension=function(){var a={};switch(window.orientation){case 0:case 180:a.width=window.screen.width;a.height=i.advHeight*a.width/i.advWidth;break;case 90:case-90:if(i.app=="android"){a.height=i.max_height_h}else{a.height=Math.ceil(window.screen.height/10)}if(a.height>i.max_height_h){a.height=i.max_height_h}var temp_height=window.screen.width*i.advHeight/i.advWidth;if(temp_height>a.height){a.width=i.advWidth*a.height/i.advHeight}else{a.height=temp_height;a.width=window.screen.width}break}return a};this.getAdvDimension=function(){var vd=i.getViewPortDimension();var maxD=i.maxAdvScreenDimension();var s=i.scaleScreenAdvDimensionToBody(maxD);var a={};a.left=Math.ceil(vd.left+(vd.width-s.width)/2);if(window.scrollY+window.innerHeight>document.height-i.max_height_from_bottom){a.top=window.scrollY}else{a.top=vd.top+vd.height-s.height}a.width=s.width;a.height=s.height;return a};this.setAdvDimension=function(div,dim){div.style.width=dim.width+"px";div.style.height=dim.height+"px";div.style.left=dim.left+"px";div.style.top=dim.top+"px";i.setImgDimension(dim)};this.setImgDimension=function(d){if(i.imgList){for(var imgIndex=0;imgIndex<i.imgList.length;imgIndex++){var img;if(i.app=='android'){img=i.imgList[imgIndex].firstChild}else{img=i.imgList[imgIndex]}img.width=d.width;img.height=d.height;img.style.position="absolute";img.style.left="0px";img.style.top="0px"}}};this.rotateTo=function(n){var l=i.advs.length;var z=parseInt(i.adv.style.zIndex);var url;var openURL=function(e){window.open(url)};for(var x=0;x<l;x++){var img;if(i.app=='android'){img=i.imgList[x].firstChild}else{img=i.imgList[x]}if(x==n){img.style.zIndex=z+1;url=i.advs[x].click_url;if(i.app!='android'){i.adv.removeEventListener("touchstart",i.openURL,false);i.openURL=openURL;i.adv.addEventListener("touchstart",i.openURL,false)}}else{img.style.zIndex=z}}};this.composeAdv=function(){for(var index=0;index<i.imgList.length;index++){i.adv.appendChild(i.imgList[index])}var d=i.getAdvDimension();i.advDimension=d;i.setAdvDimension(i.adv,d);var n=0;var timeRotate=function(){i.rotateTo(n);n=(n+1)%i.imgList.length;i.rotateTimeoutId=setTimeout(timeRotate,i.advsInterval)};timeRotate()};this.makeAdvDiv=function(){var adv=document.createElement("div");adv.style.position="absolute";adv.style.zIndex=99999;var imgList=new Array();for(var aIndex=0;aIndex<i.advs.length;aIndex++){var img=document.createElement("img");img.src=i.advs[aIndex].adunit_image;if(i.app=='android'){var a=document.createElement("A");a.href=i.advs[aIndex].click_url;a.target="_blank";a.appendChild(img);imgList.push(a)}else{imgList.push(img)}}i.adv=adv;i.imgList=imgList;i.composeAdv();return adv};this.showAdv=function(){if(i.adv){if(i.app=='android'){if(window.innerHeight>i.max_height||(window.orientation==90||window.orientation==-90)){i.adv.style.visibility='visible';i.adv.style.display='block'}else{i.adv.style.visibility='hidden';i.adv.style.display='none'}}else{i.adv.style.visibility='visible';i.adv.style.display='block'}}};this.appendAdv=function(){if(i.adv){document.body.appendChild(i.adv)}};this.delayShowAdv=function(){i.setTimeout(function(){var d=i.getAdvDimension();i.setAdvDimension(i.adv,d);i.showAdv()},300)};this.init=function(){if(navigator.userAgent.search(/Android/)!=-1){i.app='android'}else if(navigator.userAgent.search(/Safari/)!=-1){i.app='apple'}else{return}if(i.app=='android'){i.hideTime=4000;i.checkTime=1000}document.addEventListener("touchstart",function(e){i.pageTop=window.scrollY;i.innerHeight=window.innerHeight;i.clearTimeout();if(i.app=='android'){var d=i.getAdvDimension();var touch=e.touches[0];if(d.left>touch.pageX||touch.pageX>(d.left+d.width)||d.top>touch.pageY||touch.pageY>(d.top+d.height)){i.hideAdv()}}else{i.hideAdv()}},false);document.addEventListener("touchend",function(e){i.pageTop=-1;i.innerHeight=-1;i.setTimeout(function(){var dEnd=i.getAdvDimension();var count=0;var checkFunc=function(){if(count>20){i.setAdvDimension(i.adv,d);i.showAdv();return}var d=i.getAdvDimension();if(d.top==dEnd.top&&d.left==dEnd.left&&d.width==dEnd.width&&d.height==dEnd.height){i.setAdvDimension(i.adv,d);i.showAdv()}else{dEnd.left=d.left;dEnd.top=d.top;dEnd.width=d.width;dEnd.height=d.height;i.setTimeout(checkFunc,i.checkTime);count++}};i.setTimeout(checkFunc,i.checkTime)},i.hideTime)},false);var freshAdv=function(){i.hideAdv();i.delayShowAdv()};if(i.app=='android'){window.addEventListener("resize",function(e){freshAdv()},false)}else if(i.app=='apple'){document.addEventListener("orientationchange",function(e){freshAdv()},false)}i.makeAdvDiv();i.appendAdv();i.delayShowAdv()};this.preInit=function(){if(navigator.cookieEnabled&&(i.janet_user_agent.search(/Android/)!=-1||i.janet_user_agent.search(/iPhone/)!=-1)){var ga=document.createElement('script');ga.type='text/javascript';ga.src=i.janet_jq_src;var s=document.getElementsByTagName('script')[0];var ad_url=i.janet_ad_url+'?format=json&callback=?&m='+window.need_params.media+'&b='+i.janet_banner+'&s='+window.need_params.slot+'&w='+window.need_params.width+'&h='+window.need_params.height+'&u='+window.need_params.user_id+'&t='+window.need_params.type;ga.addEventListener("load",function(e){jQuery.noConflict();jQuery.getJSON(ad_url,function(data){if(data.length>0){i.advs=data;i.init()}})},false);s.parentNode.insertBefore(ga,s)}};window.addEventListener("load",this.preInit,false)}).call({});

