//ブラウザ判定
function isWin () { return (navigator.appVersion.indexOf ("Win") != -1); }
function isMac () { return (navigator.appVersion.indexOf ("Mac") != -1); }
function isIE () { return (navigator.appName.indexOf ("Explorer") != -1); }
function isNS () { return (navigator.appName.indexOf ("Netscape") != -1); }
function isWinIE () { return (isWin () && isIE ()); }
function isWinNS () { return (isWin () && isNS ()); }
function isMacIE () { return (isMac () && isIE ()); }
function isMacNS () { return (isMac () && isNS ()); }
function isW3CDOM () { return (document.getElementById ? true : false); }
function isMSDOM () { return (document.all ? true : false); }
function isNCDOM () { return (document.layers ? true : false); }
function isDOM () { return (isW3CDOM () || isMSDOM () || isNCDOM ()); }




//プラグイン判定
function getFlashPlayerVersion() {
	if (navigator.plugins) with (navigator) {
		var s = "application/x-shockwave-flash";
		if (mimeTypes && mimeTypes [s] && mimeTypes [s].enabledPlugin){
			nFlashPlayerVersion = navigator.plugins ["Shockwave Flash"].description.match (/\d+/);
		}
	}
	return parseInt (nFlashPlayerVersion);
}

var nFlashPlayerVersion = 0;
if (isWinIE ()){
	document.write ('<scr' + 'ipt type="text/vbscript" language="VBScript"\>\nPrivate i, b\nOn Error Resume Next\nFor i = 8 To 1 Step -1\nb = (IsObject (CreateObject ("ShockwaveFlash.ShockwaveFlash." & i)))\nIf b Then \nnFlashPlayerVersion = i\nExit For\nEnd If\nNext\n</scr' + 'ipt\>');
}

//Flash描画
function printMovie(id,src,base,width,height,flashvars){
	var http_https = window.location.protocol;
	if(http_https != "https:"){
		http_https="http:";
	}
	var content = "";
	content += '<object id="' + id + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
	content += ' codebase="' + http_https +'//fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ';
	content += ' width="' + width + '" height="' + height + '">';
	content += '<param name="movie" value="'+ src + '">';
	if(base) content += '<param name="base" value="'+ base + '">';
	content += '<param name="quality" value="high">';
	if(flashvars) content += '<param name="flashvars" value="' + flashvars + '">';
	content += '<param name="menu"	value="false"><param name="allowScriptAccess" value="sameDomain" ><param name"WMOD" value="window">'
	content += '<embed id="' + id +'"';
	content += ' src="' + src +'"';
	content += ' width="' + width + '" height="' + height + '"';
	if(base) content += ' base="' + base +'"';
	content += ' quality="high"';
	if(flashvars) content += ' flashvars="' + flashvars + '"';
	content += ' menu="false" swLiveConnect="false" ';
	content += ' type="application/x-shockwave-flash"';
	content += ' pluginspage="' + http_https +'//www.macromedia.com/go/getflashplayer">';
	content += '</embed></object>';
	document.write(content);
}

//クッキーを読み込み
function readCookie(id){
 var r = false;
 var s = " " + document.cookie + ";";
 var x = s.indexOf ((id = " " + id + "="));
 if (x != -1) r = unescape (s.substring ((x += id.length), s.indexOf (";", x)));
 return r;
}

//クッキーに書き込み
function writeCookie(id, v){
 document.cookie = id + "=" + escape (v) + ";";
 return true;
}

//indexを開いたクッキーのチェック
function visitedCheck(from){
	
	var cookieValue = readCookie("index_visited");
	
	if(from == "index"){		//indexからチェックした場合
		if(cookieValue == "true"){
			writeCookie("index_visited","false");
			return true;
		}else if(cookieValue == "false"){
				return false;
			}else{
				writeCookie("index_visited","false");
				return false;
			}
	}else{		//その他のページからチェックした場合
		if(cookieValue == "false"){
			writeCookie("index_visited","true");
		}
	}
} 
