var win = (navigator.userAgent.indexOf("Windows") != -1) || false;
var mac = (navigator.userAgent.indexOf("PPC Mac") != -1 || navigator.userAgent.indexOf("PowerPC") != -1 ) || false;
var intelMac = (navigator.userAgent.indexOf("Intel Mac") != -1) || false;
var firefox = (navigator.userAgent.indexOf("Firefox") != -1) || false;
var opera9 = (navigator.userAgent.indexOf("Opera/9") != -1) || false;
var opera = (navigator.userAgent.indexOf("Opera") != -1 && !opera9) || false;
var ie = (document.all && win && !opera && !opera9) || false;
var ie7 =(navigator.userAgent.indexOf("MSIE 7") != -1) || false;
var macIE = (navigator.userAgent.indexOf("MSIE") != -1 && mac) || false;
var safari = (navigator.userAgent.indexOf("Safari") != -1) || false;
var camino = (navigator.userAgent.indexOf("Camino") != -1) || false;
var omniweb = (navigator.userAgent.indexOf("OmniWeb") != -1) || false;
var netscape = (navigator.userAgent.indexOf("Netscape") != -1) || false;

//############################//
//## 音楽再生 Flashタグ挿入 ##//
//############################//

function drawFlashSound() {
if (document.getElementById){
	document.write('<div id="sound">' + "\n");
	if(safari || firefox || macIE || opera || camino || omniweb) {
		document.write('<embed id="sound" src="./flash/sound.swf" quality="high" wmode="transparent" width="130" height="40" name="top" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' + "\n");
	} else {
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="130" height="40">' + "\n");
		document.write('<param name="allowScriptAccess" value="sameDomain" />' + "\n");
		document.write('<param name="movie" value="./flash/sound.swf" />' + "\n");
		document.write('<param name="quality" value="high" />' + "\n");
		document.write('<param name="wmode" value="transparent">' + "\n");
		document.write('</object>' + "\n");
	} 
	document.write('</div>' + "\n");
	document.write('<hr />' + "\n");
}
}

//##########################//
//## メイン Flashタグ挿入 ##//
//##########################//

function drawFlash(file, level) {
if (document.getElementById){
	if(macIE) {
		document.write('<!-- このサイトにおけるMacIEでのFlash再生は、一部サポートしておりません。 -->' + "\n");
	} else {
		document.write('<div id="flash" class="' + file + '">' + "\n");
		if((win && (firefox || opera)) || ((intelMac || mac) && ((safari && !omniweb) || firefox || camino))) {
			document.write('<embed id="flash" src="' + level +  '/flash/' + file + '.swf" quality="high" wmode="transparent" width="750" height="500" name="' + file + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' + "\n");
		} else if(ie) {
			document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="750" height="500">' + "\n");
			document.write('<param name="allowScriptAccess" value="sameDomain" />' + "\n");
			document.write('<param name="movie" value="' + level +  '/flash/' + file + '.swf" />' + "\n");
			document.write('<param name="quality" value="high" />' + "\n");
			document.write('<param name="wmode" value="transparent">' + "\n");
			document.write('</object>' + "\n");
		}
		document.write('</div>' + "\n");
		document.write('<hr />' + "\n");
    }
}
}

//##########################//
//## 動画 Flashタグ挿入 ##//
//##########################//

function drawFlashMovie(file) {
if (document.getElementById){
	document.write('<div id="movie">' + "\n");
	if(safari || firefox || macIE || opera || camino || omniweb) {
		document.write('<embed id="movie" src="'+ file + '" quality="high" wmode="opaque" width="200" height="180" name="top" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' + "\n");
	} else {
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="200" height="180">' + "\n");
		document.write('<param name="allowScriptAccess" value="sameDomain" />' + "\n");
		document.write('<param name="movie" value="' + file + '" />' + "\n");
		document.write('<param name="quality" value="high" />' + "\n");
		document.write('<param name="wmode" value="opaque">' + "\n");
		document.write('</object>' + "\n");
	} 
	document.write('</div>' + "\n");
	document.write('<hr />' + "\n");
}
}

//#########################################//
//## Flash Player 簡易バージョンチェック ##//
//#########################################//

function chkFlashVersion(ver) {
if (document.getElementById){
	var flashVersion = 0;
	var targetVersion = ver;
	var text = '<div id="caution"><p>エラー：バージョン' + ver + '以上の <a href="http://www.macromedia.com/go/getflashplayer">Flash Player</a> をお使いください</p>\n</div>' + "\n"
	
	if((win && (safari || firefox || opera)) || ((intelMac || mac) && ((safari && !omniweb) || firefox || camino))) {
		flashVersion = navigator.plugins["Shockwave Flash"].description.charAt(16);
			
		if(flashVersion >= targetVersion) {
			return;
		} else {
			document.write(text);
		}
	} else if(ie) {
        var temp = new ActiveXObject("ShockwaveFlash.ShockwaveFlash").FlashVersion();
        flashVersion=Math.floor(temp / 0x10000);
        
		if(flashVersion >= targetVersion) {
			return;
		} else {
			document.write(text);
		} 
	}
}
}

