/**
 * 関連記事JavaScriptツール 2009-05-07
 * @author  全国新聞ネット <http://www.47news.jp/>
 *
 * Thanks to:
 *  Flash4AJAX by Julien Couvreur
 *    http://blog.monstuff.com/Flash4AJAX/static/Xdomain.html
 *  window.onload alternative by Dean Edwards/Matthias Miller/John Resig
 *    http://dean.edwards.name/weblog/2006/06/again/
 */
var pnj_urlPrefix="http://www.47news.jp/cgi-bin/ra/";var FlashHelper_version=1;var pnj_loadEvents=[];var FlashHelper=new Object();FlashHelper.height=138;FlashHelper.width=215;FlashHelper.shouldWaitForFlash=function(){};FlashHelper.isFlashInstalled=function(){var C;if(typeof (this.isFlashInstalledMemo)!="undefined"){return this.isFlashInstalledMemo}if(typeof (ActiveXObject)!="undefined"){try{var B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(D){}C=(B!=null)}else{var A=navigator.mimeTypes["application/x-shockwave-flash"];C=(A!=null)&&(A.enabledPlugin!=null)}this.isFlashInstalledMemo=C;return C};FlashHelper.getFlash=function(){return document.getElementById("pnj_storage")};FlashHelper.checkFlash=function(){try{return(this.getFlash().ping()=="pong")}catch(A){return false}};FlashHelper.writeFlash=function(){var A="/47gateway.swf";if(typeof window.bt_flashPath=="string"&&window.bt_flashPath!=""){A=window.bt_flashPath}if(window.ActiveXObject&&!FlashHelper.isFlashInstalled()){document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');document.write(' codebase="http://download.macromedia.com');document.write('/pub/shockwave/cabs/flash/swflash.cab#version=8,5,0,0"');document.write(' height="'+this.height+'" width="'+this.width+'" id="pnj_storage">');document.write(' <param name="movie" value="'+A+'">');document.write(' <param name="quality" value="high">');document.write(' <param name="swliveconnect" value="true">');document.write("</object>")}else{document.write('<object id="pnj_storage" data="'+A+'"');document.write(' type="application/x-shockwave-flash"');document.write(' height="'+this.height+'" width="'+this.width+'">');document.write('<param name="movie" value="'+A+'">');document.write('<param name="quality" value="high">');document.write('<param name="swliveconnect" value="true">');document.write('<param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer">');document.write('<param name="pluginspage" value="http://www.macromedia.com/go/getflashplayer">');document.write("<p>関連記事を表示するにはFlash最新版を");document.write('<a href="http://www.adobe.com/shockwave/download/?P1_Prod_Version=ShockwaveFlash&amp;Lang=Japanese">こちら</a>からインストールしてください。');document.write("</p>");document.write("</object>")}};FlashHelper.addLoadEvent=function(A){pnj_loadEvents[pnj_loadEvents.length]=A};function pnj_init(){if(arguments.callee.done){return }arguments.callee.done=true;if(_timer){clearInterval(_timer)}for(var B=0,A=pnj_loadEvents.length;B<A;B++){pnj_loadEvents[B].apply(this,[])}}if(/WebKit/i.test(navigator.userAgent)){var _timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){pnj_init()}},10)}else{if(document.addEventListener){document.addEventListener("DOMContentLoaded",pnj_init,false)}}document.write("<!--[if IE]><script id=__ie_onload defer src=javascript:void(0)><");document.write("/script><![endif]-->");var pnj_iedefer_script=document.getElementById("__ie_onload");if(pnj_iedefer_script){pnj_iedefer_script.onreadystatechange=function(){if(this.readyState=="complete"){pnj_init()}}}var pnj_oldonload=window.onload;if(typeof pnj_oldonload!="function"){window.onload=pnj_init}else{window.onload=function(){pnj_oldonload.apply(this,[]);pnj_init.apply(this,[])}}FlashHelper.load=function(){if(typeof (FlashHelper.onload)!="function"){return }if(FlashHelper.isFlashInstalled()){var B=this.flashLoaded&&this.documentLoaded;if(!B){return }}var A=FlashHelper.getFlash();if((!FlashHelper.isFlashInstalled()||this.flashLoaded)&&A){if(FlashHelper.checkFlash()){C(A)}else{C(null)}}else{C(null)}function C(D){if(FlashHelper.onloadCalled){return }FlashHelper.onloadCalled=true;FlashHelper.onload(D)}};function storageOnLoad(){FlashHelper.flashLoaded=true;FlashHelper.load()}function storageOnError(){FlashHelper.flashLoaded=true;FlashHelper.load()}FlashHelper.init=function(){this.flashLoaded=false;this.documentLoaded=false;this.addLoadEvent(A);function A(){if(FlashHelper.isFlashInstalled()){}FlashHelper.documentLoaded=true;FlashHelper.load()}};FlashHelper.init();var CallbackManager=new Object();CallbackManager.callbacks=new Array();CallbackManager.registerCallback=function(D){var A=this.callbacks.push(C);var B=A-1;return"CallbackManager.callbacks["+B+"]";function C(E){delete CallbackManager.callbacks[B];setTimeout(function(){D(E)},0);return }};var FlashXMLHttpRequest=function(){var C=this;var D,E,B=null;var A=new Array();this.open=function(J,H,I,F,G){D=J;E=H};this.send=function(G){var F=FlashHelper.getFlash();function H(J){var I=FlashHelper.getFlash().GetVariable(J);C.responseText=I;if(C.onload){C.onload()}}F.XmlHttp(E,CallbackManager.registerCallback(H),D,G,B,A)};this.setRequestHeader=function(G,F){if(G.toLowerCase()=="Content-Type".toLowerCase()){B=F;return }A.push(G);A.push(F)};this.getRequestHeader=function(){};this.getResponseHeader=function(F){alert("not supported")};this.getAllResponseHeaders=function(){alert("not supported")};this.abort=function(){alert("not supported")};this.addEventListener=function(G,F,H){alert("not supported")};this.dispatchEvent=function(F){alert("not supported")};this.openRequest=function(G,F,J,I,H){this.open(G,F,J,I,H)};this.overrideMimeType=function(F){alert("not supported")};this.removeEventListener=function(G,F,H){alert("not supported")}};(function(){var J=document;var K;var G;var A;var H=0;var L=1;var D=1;var B=1;var F=0;function I(M){return M.replace(/<[^>]*>/g,"").replace(/[\r\n]*/g,"").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&/g,"%26").replace(/=/g,"%3D").replace(/\?/g,"%3F").replace(/;/g,"%3B")}function C(){K=typeof window.bt_title=="string"?window.bt_title:null;G=typeof window.bt_body=="string"?window.bt_body:null;A=typeof window.bt_except=="string"?window.bt_except:"";if(typeof window.bt_maxline!="undefined"){F=parseInt(window.bt_maxline)}if(typeof window.bt_deco!="undefined"){H=parseInt(window.bt_deco)}if(typeof window.bt_zoom!="undefined"){L=parseInt(window.bt_zoom)}if(typeof window.bt_movie!="undefined"){D=parseInt(window.bt_movie)}if(typeof window.bt_photo!="undefined"){B=parseInt(window.bt_photo)}var M;if(!K){M=J.getElementById("bt_title");if(M){K=I(M.innerHTML)}}if(!G){M=J.getElementById("bt_body");if(M){G=I(M.innerHTML)}}}function E(){var M=[pnj_urlPrefix,"proxy.php"].join("");var O=["maxline=",F,"&photo=",B,"&movie=",D,"&zoom=",L,"&deco=",H,"&title=",K,"&body=",G,"&except=",A,"&css=2&z=",new Date().getTime()].join("");var N=new FlashXMLHttpRequest();N.onload=function(){var R=N.responseText;if(typeof R=="string"&&R!="undefined"){J.getElementById("bt_ra").innerHTML="";var U=document.createElement("div");U.innerHTML=R;J.getElementById("bt_ra").appendChild(U);if(typeof window.bt_doLater=="function"){var T="<!--";var S="-->";var P=R.substr(R.indexOf(T));P=P.replace(new RegExp().compile(T+"[s\n]*"),"");P=P.replace(new RegExp().compile("[s\n]*"+S+"[s\n]*"),"");window.bt_semantics=P;window.bt_doLater.apply(this)}}else{J.getElementById("bt_ra").innerHTML=""}var Q=J.getElementById("pnj_storage");if(Q){Q.parentNode.removeChild(Q)}};N.open("POST",M);N.setRequestHeader("Content-Type","application/x-www-form-urlencoded");N.send(O)}FlashHelper.onload=function(M){if(!M){document.getElementById("bt_ra").innerHTML="";return }C();if(!K&&!G){document.getElementById("bt_ra").innerHTML="";return }E()};document.write('<link rel="stylesheet" href="',pnj_urlPrefix,'related_article.css" type="text/css" charset="utf-8">');FlashHelper.height=1;FlashHelper.width=1;FlashHelper.writeFlash()})();