/* =====================================================================
*
*    INDEX
*
*    // SHARP Flashプラグイン判定用スクリプト
*
* =================================================================== */

/*-------------------------------------
　Flashプラグインインストール判定
-------------------------------------*/
function checkPlugin() {
	if(navigator.userAgent.indexOf("MSIE") != -1) {
		try {
			var obj = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			if(obj) createChecker();
		} catch(e) {
			createNoPluginModule();
		}
	}
	else {
		if(navigator.plugins["Shockwave Flash"] != undefined) createChecker();
		else createNoPluginModule();
	}
}

/*-------------------------------------
　Flashプラグイン種別判定用swf生成
-------------------------------------*/
function createChecker() {
	var checkerData = '<div id="mainImageModule"><object classid="clsid:D27CDB6E- AE6D-11cf-96B8-444553540000" id="chkSwf" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0" width="1" height="1"><param name="movie" value="/common/swf/plugin_checker.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><embed src="/common/swf/plugin_checker.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" width="1" height="1" swLiveConnect="true" name="chkSwf"></embed></object></div>';
	
	document.write(checkerData);

	var str = undefined;
	
	var tid = setInterval(function() {
		try {
			//alert("try");
		 str = window.document["chkSwf"].GetVariable("_level0.str");
		} catch (e) {
		 	//alert("catch");
		} finally {
			if (str != undefined) {
				clearInterval(tid);
				if(str.indexOf("W") == 0) {
					createFlashModule();
				} else if (str.indexOf("M") == 0) {
					createFlashModule();
				} else if (str.indexOf("L") == 0) {
					createFlashModule();
				}	else {
					createFlashLiteModule();
				}
			}
		}
	}, 40);
}
