

//--- ◆ ブラウザ判別 ◆ -----------------------------------------------
var uAnt = navigator.userAgent.toLowerCase();

var SAF = uAnt.indexOf("safari") > -1;
var OP = uAnt.indexOf("opera") > -1;
var winFF = uAnt.indexOf("firefox") > -1 && (uAnt.indexOf("win") > -1);
var macFF = uAnt.indexOf("firefox") > -1 && (uAnt.indexOf("mac") > -1);
var winIE = uAnt.indexOf("msie") > -1 && (uAnt.indexOf("opera") == -1) && (uAnt.indexOf("win") > -1);
var macIE = uAnt.indexOf("msie") > -1 && (uAnt.indexOf("mac") > -1);
var NS4 = document.layers?1:0;
var NS6 = document.getElementById && !document.all?1:0;



//-- ◆ 対象 Flashプラグインの設定 ◆ -----------------------------------
var actX = searchActiveX(("ShockwaveFlash.ShockwaveFlash.7")||("ShockwaveFlash.ShockwaveFlash.8"));			// winIE4-6
var plug = searchPluginsNN("application\/x-shockwave-flash","Shockwave Flash 7"|"Shockwave Flash 8",2);	// NN
//alert( "ActiveX ： " + actX );
//alert( "Netscape style プラグイン ： " + plug );



//-- ◆ winIE4-6 ActiveX Check ◆ ---------------------------------------
function searchActiveX(ActiveXName){
	var result = false;
	if (!window.opera && navigator.platform && document.all){
		if(navigator.platform != "Win32") return result;
		/*@cc_on @*/
		/*@if ((@_jscript_version >= 3) && (@_win32 == true))
			document.write('<scr'+'ipt language="VBScript"\>\nOn Error Resume Next\n');
			document.write('ax=""\n');
			document.write('ax=(IsObject(CreateObject("'+ActiveXName+'")))\n');
			document.write('</scr'+'ipt\>\n');
			result = (ax) ? true : false;
			//alert("Now JScript version 3++ ( " + @_jscript_version + " )");
		@else @*/
			//alert("This browser is not Internet Explorer for Win32 system");
		/*@end @*/
	}
	return result;
}



//-- ◆ Netscape プラグインCheck ◆ -------------------------------------
function searchPluginsNN(mineType,strSearch,searchType){
	var enabled = false;
	var result = false;
	var strPlg;
	var spObj;
	
	if(!(navigator.plugins && navigator.mimeTypes && navigator.mimeTypes[mineType])) return result;
	
	if(window.opera && !document.plugins){
	// Enabled Plugin Non supported (Opera 7 Under ...)
		enabled = true;
	}else if(navigator.mimeTypes[mineType].enabledPlugin){
		enabled = true;
	}
	
	if(strSearch != '' && enabled){
		if(searchType == 3) strSearch = strSearch.toLowerCase();
		
		for(i=0;i<navigator.plugins.length;i++){
			spObj = navigator.plugins[i];
			strPlg = ((searchType == 3) ? spObj.filename.toLowerCase() : ((searchType == 2) ? spObj.description : ((searchType == 1) ? spObj.name : "")));
			if(strPlg.indexOf(strSearch) != -1){
				result = true; break;
			}
	 	}
	 
	}else if(strSearch == '' && enabled){
		result = true;
	}
	return result;
}



//-- ◆ Valueを引数から受け取る ◆ -------------------------------------
flashObj = new Object();

flashObj.f_getValue = function(fileName, idNumber, xSize, ySize){
	v_name = fileName;
	v_id = idNumber;
	v_width = xSize;
	v_height = ySize;
	v_version = "6,0,29,0"	// Playerのバージョン設定
	v_loop = "false";				// ループ再生：true→ループ / false→ループなし
	v_quality = "high";			// アンチエイリアス：LOW, HIGH, AUTOHIGH, AUTOLOW
}

//-- ◆ Param追加用Function ◆ -----------------------------------------
var v_color;
var v_mode;
var v_vars;
var v_base;
var v_loop;

//【bgcolor】 背景色
flashObj.f_getValue.prototype.f_getColor = function( color ){
	v_color = color;
}

//【wmode】 背景透明：transparent　処理高速化：opaque
flashObj.f_getValue.prototype.f_getMode = function( mode ){
	v_mode = mode;
}

//【FlashVars】
flashObj.f_getValue.prototype.f_getVars = function( vars ){
	v_vars = vars;
}

// 【base】
flashObj.f_getValue.prototype.f_getBase = function( base ){
	v_base = base;
}



//-- ◆ Flashのタグをセット ◆ ------------------------------------------
flashObj.f_getValue.prototype.f_writeHTML = function(){
	document.write( this.f_setTAG() );
	//alert( this.f_setTAG() );
}

flashObj.f_getValue.prototype.f_setTAG = function(){
	var v_set = "";
	
	v_set += '<object ';
	v_set += 'width="' + v_width + '" ';
	v_set += 'height="' + v_height + '" ';
	v_set += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';
	v_set += ' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + v_version + '"';
	v_set += ' id="' + v_id + '"';
	v_set += '>' + "\n";

	v_set += '<param name="movie" value="' + v_name + '" />' + "\n";
	v_set += '<param name="loop" value="' + v_loop + '" />' + "\n";
	v_set += '<param name="quality" value="' + v_quality + '" />' + "\n";
	
	if(v_color != null){
		v_set += '<param name="bgcolor" value="' + v_color + '" />' + "\n";
	}
	if(v_mode != null){
		v_set += '<param name="wmode" value="' + v_mode + '" />' + "\n";
	}
	if(v_vars != null){
		v_set += '<param name="flashvars" value="' + v_vars + '" />' + "\n";
	}
	if(v_base != null){
		v_set += '<param name="base" value="' + v_base + '" />' + "\n";
	}
	
	v_set += '<param name="menu" value="false" />' + "\n";  //070531
	
	v_set += '<embed src="' + v_name;
	v_set += '" quality="' + v_quality + '"';
	v_set += ' pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"'
	v_set += ' type="application/x-shockwave-flash"'
	v_set += ' width="' + v_width + '" height="' + v_height + '"';
		
	if(v_color != null){
		v_set += ' bgcolor="' + v_color + '"';
	}
		
	if(v_mode != null){
		v_set += ' wmode="' + v_mode + '"';
	}
	
	if(v_vars != null){
		v_set += ' flashvars=' + v_vars + '"';
	}
	
	if(v_base != null){
		v_set += ' base="' + v_base + '"';
	}
	
	v_set += ' menu="false"'; //070531
	
	v_set += '></embed>';
	
	v_set += '</object>';

	return v_set;
}


