var htmlEscape = (function(){
	var map = {"<":"&lt;", ">":"&gt;", "&":"&amp;", "'":"&#39;", "\"":"&quot;", " ":"&nbsp;"};
	var replaceStr = function(s){ return map[s]; };
	return function(str) { return str.replace(/<|>|&|'|"|\s/g, replaceStr); };
})();

function getRequest(){//URLを返す
    var request = htmlEscape(window.location.href);
    return request;
}

function CFLerr() {
	return true;
}

var requestURL = getRequest();
var CFLver =0;
var CFLiewin = navigator.userAgent.indexOf('Win') && (document.all);
var CFLflag = false;

var SWFurl = "http://i.yimg.jp/images/srank/swf/";


var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;


function makeFlash(){


	if (plugin) {
		var desc = plugin.description;
		CFLver = eval(desc.substring(desc.indexOf("Flash")+6, desc.indexOf("Flash")+9));
		CFLflag = CFLver >= CFLfpver;
	
	} else if (CFLiewin) {
		document.write('<script language="VBScript"\> \n');
		document.write('on error resume next \n');
		document.write('CFLflag = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & CFLfpver )))\n');
		
	document.write('Function VBGetSwfVer(i) \n');
				document.write('Dim swControl , swVersion \n');
				document.write('swVersion=0 \n');
				document.write('set swControl=CreateObject("ShockwaveFlash.ShockwaveFlash."+CStr(i)) \n');
				document.write('if(IsObject(swControl))then \n');
				document.write('swVersion = swControl.GetVariable("$version") \n');
				document.write('end if \n');
				document.write('VBGetSwfVer=swVersion \n');
	document.write('End Function \n');
	
	document.write('</script\> \n');
		
	
	}
	
	if ( CFLflag ) {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"');
		document.write(' id="aexternal" width="'+ CFLwidth +'" height="'+ CFLheight +'">');
		
		document.write('<param name="movie" value="'+ SWFurl + CFLswfuri + '.swf">');
		
		document.write('<param name="flashVars" value="' + 'plp=' + requestURL +'">');
		document.write('<param name="wmode" value="opaque">');
		document.write('<param name="loop" value="true">');
		document.write('<param name="quality" value="high">');
		document.write('<param name="allowScriptAccess" value="always">');
		
		document.write('<embed src="' + SWFurl + CFLswfuri + '.swf' + '" loop="true" wmode="opaque" flashVars="' + 'plp=' + requestURL + '" allowScriptAccess="always"');

		document.write(' quality="high" swLiveConnect="false"');
		document.write(' width="'+ CFLwidth +'" height="'+ CFLheight +'"');
		document.write(' type="application/x-shockwave-flash"');
		document.write(' pluginspage="http://downloads.yahoo.co.jp/docs/flashplayer/start.html">');
		document.write('</embed>');
		document.write('</object>');
	} else {
		
		// ----- Initial Value -----
		// Help Url
		var yjpmAFP_Help = 'http://help.yahoo.co.jp/help/jp/common/sys/sys-10.html';
	
		// Element
		yjAFP = {
			yjpmLink : 'http://downloads.yahoo.co.jp/docs/flashplayer/start.html',
			yjpmImage : 'http://i.yimg.jp/images/common/ydc_get_flash_player1.gif',
			yjpmAlt : 'Flash Playerをダウンロード',
			yjpmText : {
				yjpmAFP : 'Adobe Flash Playerは、ボタンを押して移動したサイトで入手できます。さらに詳しい情報は「<a href="' + yjpmAFP_Help + '">Adobe Flash Playerをインストールするには</a>」をご覧ください。'
			}
		};

		CFLaltHTML ="<div class='yjplg pkg'><a href='" + yjAFP.yjpmLink + "' target='plugin'><img src='" + yjAFP.yjpmImage + "' alt='" + yjAFP.yjpmAlt + "'></a><p>" + yjAFP.yjpmText.yjpmAFP + "</p></div>";
		
		document.write(CFLaltHTML);
	}

}


