if(typeof nend_domain=='undefined'){var nend_domain='http://ad1.nend.net'}if(typeof nendCommon=='undefined'){var nendCommon={nend_overlay_params:{},uid:null,rt:null,init:function(){try{var npobj=nend_params instanceof Array?nend_params.shift():nend_params;if(typeof npobj=='undefined'){return}var iframe_flg=nendCommon.getIframeFlg(npobj);if(iframe_flg===true){window.addEventListener('message',function(event){nendCommon.iframePrepare(event,npobj)},false);window.addEventListener('DOMContentLoaded',nendCommon.addIframe,false)}nend_adspace_divid='nend_adspace_'+npobj.site+'_'+npobj.spot;if(npobj.type=='1'){nend_style="margin-left:auto;margin-right:auto;text-align:center;";document.write('<div id="'+nend_adspace_divid+'" style="'+nend_style+'"></div>');if(iframe_flg===false){this.request(npobj)}}else if(npobj.type=='2'){var agent=navigator.userAgent;if(agent.search(/Android/)!=-1){var viewport_flg=0;var m=document.getElementsByTagName('meta');var mlen=m.length;if(mlen>0){for(var i=0;i<mlen;i++){if(m[i].name=='viewport'){viewport_flg=1;break}}}if(viewport_flg==0){var vp=document.createElement('meta');vp.name='viewport';vp.content="width=device-width, initial-scale=1, maximum-scale=4, minimum-scale=0.3";document.getElementsByTagName('head').item(0).appendChild(vp)}}nend_style="position: absolute; left: 0px; z-index: 9999; top: "+(window.scrollY+window.innerHeight)+"px; display: none;";document.write('<div id="'+nend_adspace_divid+'" style="'+nend_style+'"></div>');this.nend_overlay_params=npobj;window.addEventListener('DOMContentLoaded',nendOlObject.init,false);window.addEventListener('DOMContentLoaded',this.load,false);if(iframe_flg===false){window.addEventListener('resize',this.load,false)}}}catch(e){console.log(e)}},getIframeFlg:function(npobj){return false;if(typeof npobj.oriented=='undefined'||npobj.oriented==2||npobj.oriented==3){return false}var exclude=[];for(var i in exclude){if(exclude[i]==npobj.spot){return false}}return true},iframePrepare:function(res,npobj){try{if(res.origin===nend_domain){var tmp=res.data.split('#');nendCommon.uid=tmp[0];nendCommon.rt=tmp[1];window.removeEventListener('message',function(event){nendCommon.iframePrepare(res,npobj)},false)}if(npobj.type=='1'){this.request(npobj)}else if(npobj.type=='2'){window.addEventListener('resize',this.load,false)}}catch(e){console.log(e)}},addIframe:function(){try{if(document.getElementById("nend_ad_iframe")==null){iframeNode=document.createElement("iframe");iframeNode.setAttribute("src",nend_domain+'/adiframe.html');iframeNode.setAttribute("id","nend_ad_iframe");iframeNode.setAttribute("scrolling","no");iframeNode.setAttribute("frameborder","0");iframeNode.setAttribute("allowtransparency","true");iframeNode.setAttribute("style","width: 0px; height: 0px; position:absolute; top:-9999px; left: -9999px; border-style: none");document.body.appendChild(iframeNode)}}catch(e){console.log(e)}},load:function(event){try{var feed_script_elem=document.getElementById('nend_feed_'+nendCommon.nend_overlay_params.site+'_'+nendCommon.nend_overlay_params.spot);if(typeof feed_script_elem!='undefined'&&feed_script_elem!==null){feed_script_elem.parentNode.removeChild(feed_script_elem)}nendCommon.request(nendCommon.nend_overlay_params)}catch(e){console.log(e)}},request:function(npobj){try{if(nendCommon.uid!=null){npobj.u=nendCommon.uid}if(nendCommon.rt!=null){npobj.rt=nendCommon.rt}if(npobj.type=='2'){document.getElementById('nend_adspace_'+npobj.site+'_'+npobj.spot).style.display='none';npobj.width=nendDimension.get(this.is_portrait()).ad_width;npobj.height=nendDimension.get(this.is_portrait()).ad_height}var qp=new Array();var x;for(var i in npobj){x=npobj[i];if(typeof x=='string'){x=x.replace('#','%23')}qp.push(i+'='+x)}var url=nend_domain+'/feed.php?'+qp.join('&');var scr_elem=document.createElement('script');scr_elem.setAttribute('src',url);scr_elem.setAttribute('type','text/javascript');scr_elem.setAttribute('id','nend_feed_'+npobj.site+'_'+npobj.spot);document.getElementsByTagName('body')[0].appendChild(scr_elem)}catch(e){console.log(e)}},is_portrait:function(){return(typeof window.orientation=='undefined'||window.orientation%180==0)},display:function(json){try{var nend_adspace_divid='nend_adspace_'+json.s+'_'+json.w;var div_elem=document.getElementById(nend_adspace_divid);if(json.y==2&&typeof nendOlObject!='undefined'){nendOlObject.kind=json.k}if(typeof json.v=='undefined'){json.v=1}var image_output='image_output';var query='/'+json.a+'/'+json.c+'/'+json.m+'/'+json.i+'/'+json.d+'/'+json.s+'/'+json.w+'/'+json.k+'/'+json.p+'/'+json.q+'/'+json.v;if(typeof json.z!='undefined'&&json.z!=''&&typeof json.u!='undefined'&&json.u!=''){query=query+'/'+json.z+'/'+json.u+'/'+json.o+'/'+json.e+'/'+json.n+'/'+json.l}var img_elem=document.createElement('img');img_elem.setAttribute('src',nend_domain+'/'+image_output+query);img_elem.setAttribute('border',0);if(json.y==2){img_elem.setAttribute('id','nend_banner_img')}var a_elem=document.createElement('a');a_elem.setAttribute('href',nend_domain+'/click'+query);if(typeof json.g=='undefined'){a_elem.setAttribute('target','_blank')}else if(typeof json.g!='undefined'&&json.g!=''){a_elem.setAttribute('target',json.g)}a_elem.appendChild(img_elem);div_elem.innerHTML='';div_elem.appendChild(a_elem);if(json.y==2&&typeof nendOlObject!='undefined'){nendOlObject.touchstart();nendOlObject.touchend()}}catch(e){console.log(e)}},addTag:function(json){try{var gmsflg;var ifflg=false;if("if"in json){ifflg=true}var is320=true;var ad_dim=nendDimension.get(is320);var width;if("iw"in json){width=json.iw}else{width=ad_dim.ad_width}var height;if("ih"in json){height=json.ih}else{height=ad_dim.ad_height}var nend_adspace_divid='nend_adspace_'+json.s+'_'+json.w;var div_elem=document.getElementById(nend_adspace_divid);div_elem.innerHTML='';div_elem.style.textAlign='center';if(ifflg){iframeNode=document.createElement("iframe");iframeNode.setAttribute("id","nend_adspace_if_"+json.s+"_"+json.w);iframeNode.setAttribute("scrolling","no");iframeNode.setAttribute("frameborder","0");iframeNode.setAttribute("allowtransparency","true");iframeNode.setAttribute("style","width: "+width+"px; height: "+height+"px;");div_elem.appendChild(iframeNode);iframeDocument=iframeNode.contentWindow.document;iframeDocument.open();iframeDocument.writeln('<html><head></head><body style="margin: 1px;">'+json.ta+'</body></html>');iframeDocument.close()}else{var tmpNode=document.createElement("div");tmpNode.innerHTML=json.ta;tagNodes=tmpNode.childNodes;tagNodeLength=tagNodes.length;var i;for(i=0;i<tagNodeLength;i++){if(typeof(tagNodes[i].tagName)=='undefined'){continue}if(tagNodes[i].tagName.toLowerCase()=="script"){var scriptNode=document.createElement("script");scriptNode.setAttribute("type","text/javascript");if(tagNodes[i].getAttribute("charset")!=null){scriptNode.setAttribute("charset",tagNodes[i].getAttribute("charset"))}if(tagNodes[i].getAttribute("data-gsmuserblock")!=null){scriptNode.setAttribute("data-gsmuserblock",tagNodes[i].getAttribute("data-gsmuserblock"));gmsflg=true}if(tagNodes[i].getAttribute("src")!=null){scriptNode.setAttribute("src",tagNodes[i].getAttribute("src"))}else{scriptNode.innerHTML=tagNodes[i].innerHTML}if(gmsflg){document.body.appendChild(scriptNode)}else{div_elem.appendChild(scriptNode)}}else{div_elem.appendChild(tagNodes[i])}}}if(json.y==2&&typeof nendOlObject!='undefined'){nendOlObject.kind=json.k;nendOlObject.ih=height;nendOlObject.iw=width;nendOlObject.s=json.s;nendOlObject.w=json.w;nendOlObject.ifr=ifflg;nendOlObject.touchstart();nendOlObject.touchend();window.removeEventListener('resize',this.load,false)}}catch(e){console.log(e)}}}}if(typeof nendDimension=='undefined'){var nendDimension={get:function(is_portrait){return{ad_width:is_portrait?320:480,ad_height:is_portrait?48:32}},magnify:function(is_portrait,ratio){var scaled_dims={};basic_dims=this.get(is_portrait);for(var i in basic_dims){scaled_dims[i]=basic_dims[i]*ratio}return scaled_dims}}}if(typeof nendOlObject=='undefined'){var nendOlObject={actual_screen_width:nendDimension.get(true).ad_width,actual_ad_height:nendDimension.get(true).ad_height,show_timer_msec:1000,slide_dir:1,slide_interval:10,init:function(event){var div_tag_id='nend_adspace_'+nendCommon.nend_overlay_params.site+'_'+nendCommon.nend_overlay_params.spot;nendOlObject.target=document.getElementById(div_tag_id);nendOlObject.target.addEventListener("touchstart",nendOlObject.stop_propagation,false);document.addEventListener("touchstart",nendOlObject.touchstart,false);document.addEventListener("touchend",nendOlObject.touchend,false);document.addEventListener("scroll",nendOlObject.touchend,false)},touchstart:function(event){nendOlObject.hide();clearInterval(nendOlObject.move_timer);clearTimeout(nendOlObject.timer)},touchend:function(event){clearTimeout(nendOlObject.timer);nendOlObject.timer=setTimeout(function(){nendOlObject.redraw();if(nendOlObject.kind!=3||(nendOlObject.kind==3&&nendOlObject.get_zoom_ratio()>=1)){nendOlObject.move()}},nendOlObject.show_timer_msec)},redraw:function(){var isP=nendCommon.is_portrait();var ratio=nendOlObject.get_zoom_ratio();var scaled_dim=nendDimension.magnify(isP,ratio);nendOlObject.actual_screen_width=scaled_dim.ad_width;nendOlObject.actual_ad_height=scaled_dim.ad_height;if(nendOlObject.kind==3){nendOlObject.actual_ad_height=nendOlObject.ih*ratio}var topPos=window.scrollY+1;var docHeight=Math.max(document.body.clientHeight,document.documentElement.clientHeight);var show_upper=false;if(window.innerHeight-document.body.offsetHeight>nendOlObject.actual_ad_height){show_upper=false}else if(window.scrollY<nendOlObject.actual_ad_height){show_upper=false}else if(docHeight-window.scrollY-window.innerHeight<nendOlObject.actual_ad_height){show_upper=true}if(show_upper===true){topPos-=nendOlObject.actual_ad_height;nendOlObject.slide_dir=-1}else{topPos+=window.innerHeight;nendOlObject.slide_dir=1}var target=nendOlObject.target;target.style.left=window.scrollX+"px";target.style.width=nendOlObject.actual_screen_width+"px";target.style.height=nendOlObject.actual_ad_height+"px";target.style.visibility="visible";target.style.opacity="1.0";target.style.top=topPos+"px";if(nendOlObject.kind==1||nendOlObject.kind==2){var target4=document.getElementById('nend_banner_img');target4.style.width=nendOlObject.actual_screen_width+"px";target4.style.height=nendOlObject.actual_ad_height+"px"}else if(nendOlObject.kind==3){if(nendOlObject.ifr){var iframetarget=document.getElementById("nend_adspace_if_"+nendOlObject.s+"_"+nendOlObject.w);iframetarget.style.width=nendOlObject.iw*ratio+"px";iframetarget.style.height=nendOlObject.ih*ratio+"px"}}},move:function(){nendOlObject.target.style.display="block";var stime=new Date();nendOlObject.move_start_time=stime.getTime();nendOlObject.move_start_position=parseInt(nendOlObject.target.style.top.replace(/px/,''));clearInterval(nendOlObject.move_timer);nendOlObject.move_timer=setInterval(nendOlObject.animate,nendOlObject.slide_interval)},animate:function(){var nowtime=new Date();var ycoord=nendOlObject.timeprofile(nendOlObject.move_start_time,nowtime.getTime());nendOlObject.target.style.top=(nendOlObject.move_start_position-nendOlObject.slide_dir*ycoord)+'px'},timeprofile:function(start,nowtime){var elapsed=nowtime-start;var y=nendOlObject.quickappear(elapsed);if(y===false){clearInterval(nendOlObject.move_timer);nendOlObject.hide();return 0}else{return y}},quickappear:function(elapsed){var y;var appearing_period=0,stopping_period=3600000,sinking_period=500;if(typeof nend_params.staytime=='number'){stopping_period=nend_params.staytime*1000}if(elapsed<appearing_period){y=nendOlObject.actual_ad_height*(1-Math.pow(elapsed-appearing_period,2)/Math.pow(appearing_period,2))}else if(elapsed<appearing_period+stopping_period){y=nendOlObject.actual_ad_height}else if(elapsed<appearing_period+stopping_period+sinking_period){y=nendOlObject.actual_ad_height*(1-Math.pow(elapsed-appearing_period-stopping_period,2)/Math.pow(sinking_period,2))}else{y=false}return y},trapezoid:function(elapsed){var y;var appearing_period=1000,stopping_period=5000,sinking_period=1000;if(elapsed<appearing_period){y=nendOlObject.actual_ad_height*elapsed/appearing_period}else if(elapsed<appearing_period+stopping_period){y=nendOlObject.actual_ad_height}else if(elapsed<appearing_period+stopping_period+sinking_period){y=nendOlObject.actual_ad_height*(1-(elapsed-(appearing_period+stopping_period))/sinking_period)}else if(elapsed<appearing_period+stopping_period+sinking_period+2000){y=window.innerHeight*Math.pow(elapsed-appearing_period-stopping_period-sinking_period,2)/4000000}else{y=false}return y},trochoid:function(elapsed){var sec=elapsed/1000;return nendOlObject.actual_ad_height*(2*sec+Math.sin(2*Math.PI*sec))/2},oscillator:function(elapsed){return nendOlObject.actual_ad_height*(1+Math.sin(2*Math.PI*elapsed/1000))/2},hide_and_seek:function(elapsed){var y;var t1=200,t2=400,t3=1000,t4=1500,t5=3000,t6=3500,t7=4000,t8=5000,t9=6000,t10=7000,t11=8000;if(elapsed<t1){y=nendOlObject.actual_ad_height/2*elapsed/t1}else if(elapsed<t2){y=nendOlObject.actual_ad_height/2*(t2-elapsed)/(t2-t1)}else if(elapsed<t3){y=0}else if(elapsed<t4){y=nendOlObject.actual_ad_height/2*(elapsed-t3)/(t4-t3)}else if(elapsed<t5){y=nendOlObject.actual_ad_height/2}else if(elapsed<t6){y=nendOlObject.actual_ad_height/2*(t6-elapsed)/(t6-t5)}else if(elapsed<t7){y=0}else if(elapsed<t8){y=4*Math.pow((t7-t8)/2,-2)*nendOlObject.actual_ad_height*(Math.pow((t7-t8)/2,2)-Math.pow(elapsed-(t7+t8)/2,2))}else if(elapsed<t9){y=2*Math.pow((t8-t9)/2,-2)*nendOlObject.actual_ad_height*(Math.pow((t8-t9)/2,2)-Math.pow(elapsed-(t8+t9)/2,2))}else if(elapsed<t10){y=nendOlObject.actual_ad_height}else if(elapsed<t11){y=nendOlObject.actual_ad_height+Math.pow(t11-t10,-2)*window.innerHeight*Math.pow(elapsed-t10,2)}else{y=false}return y},hide:function(){nendOlObject.target.style.display="none"},stop_propagation:function(event){event.stopPropagation()},get_zoom_ratio:function(){return(window.innerWidth/nendDimension.get(nendCommon.is_portrait()).ad_width)}}}function nendDisplay(json){nendCommon.display(json)}function nendAddTag(json){nendCommon.addTag(json)}var nend_user_agent=navigator.userAgent;if(navigator.cookieEnabled&&(nend_user_agent.search(/AppleWebKit/)!=-1&&(nend_user_agent.search(/Android/)!=-1||nend_user_agent.search(/iPhone/)!=-1||nend_user_agent.search(/iPod/)!=-1||nend_user_agent.search(/iPad/)!=-1)||nend_params.debug==1)){nendCommon.init()}
