i = 0;  //上のJSで使ったiが下のVBにも残るので一旦初期化

//FlashPlayerVersionの判定
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
    for (var i = 0; i < words.length; ++i){
		if (isNaN(parseInt(words[i]))){
		continue;
		}
		MM_PluginVersion = words[i]; 
    }
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
	document.writeln('<scr' + 'ipt type="text/vbscript" language="VBScript"\>'); //FS hide this from IE4.5 Mac by splitting the tag
	document.writeln('on error resume next');
    document.writeln('MM_contentVersion = Array("9","8","7","6","5")');
	document.writeln('MM_PluginVersion = 0');
	document.writeln('for i=0 to 2');
	document.writeln('if IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion(i))) then');
	document.writeln('MM_PluginVersion = MM_contentVersion(i)');
	document.writeln('exit for');
	document.writeln('end if');
	document.writeln('next');

	document.writeln('</scr' + 'ipt\>');
}else {
	MM_PluginVersion = 0;
}

//ウィンドウオープン(アドレス,ウィンドウネーム,幅,高さ,スクロールyes,no,auto)
function winopen(ads,wname,wi,he,tf) {
  if(!tf) tf=',scrollbars=yes';
  if(tf == 'blank'){
  	prop = 'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes';
  }else{
	  prop = 'width=' + wi + ',height=' + he + tf;
  }
  CWin = window.open(ads,wname,prop);
  CWin.focus();
}

//ウィンドウクローズ
function closewindow(){
  if (navigator.appName=="Netscape"){
    parent.window.open("","_top")
    parent.window.close()
  }else{
    parent.window.close()
    var timer
    timer=setTimeout("closewindow()",500)
  }
}

//フラッシュのためのスクリプト
function EmbedPlugIn(id,source,width,height,param,version){
	// Active X の classID の判別
	var classID; var CodeBase; var PlugInSpace; var MimeType;
	if(source.match("swf$")){
		if(MM_PluginVersion >= version){
		classID = 'clsid:D27CDB6E-AE6D-11CF-96B8-444553540000';
		CodeBase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab';
		PlugInSpace = 'http://www.macromedia.com/go/getflashplayer';
		MimeType = 'application/x-shockwave-flash';
		TargetFile = '<param name="movie" value="' + source + '" />'; // Flash の場合は Param name="movie"
		}else{
		  eval(id)();
		  return;
		}
	}else if(source.match("mov$")){
		classID = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
		CodeBase = 'http://www.apple.com/qtactivex/qtplugin.cab';
		PlugInSpace = 'http://www.apple.co.jp/quicktime/download/';
		MimeType = 'video/quicktime';
		TargetFile = '<param name="src" value="' + source + '" />'; // QT の場合は Param name="src"
	}

	document.write('<object classid="' + classID + '" id="');
	document.write(id);
	document.writeln('" width="' + width + '" height="' + height + '" codebase="' + CodeBase + '" >');
	document.write(TargetFile);
	var Params = new Array(); // 受け取ったパラメータを分解して格納する
	var forEmbed = new Array(); // embed 用の一時配列
	Params = param.split(","); // パラメータをカンマで分解、配列に格納
	for(i=0; i<Params.length; i++){ // パラメータの数だけループして処理
		var Tmp = new Array(); // パラメータの属性と値を一時的に格納する配列
		Tmp = Params[i].split(":"); // Tmp[0] が属性、Tmp[1] が値
		document.write('<param name="' + Tmp[0] + '" value="' + Tmp[1] + '" />');
		forEmbed[i] = Tmp[0] + '="' + Tmp[1] + '"'; // embed 用に「属性="値"」を作成し一時配列に格納
	}
	//embed 用のパラメータをまとめる
	var EmbedParam = forEmbed.join(" "); // 「属性="値"」をスペースで文字列にする
	if(source.match("swf$")){EmbedParam += ' swiliveconnect="true"'}
	document.write('<embed width="' + width + '" height="' + height + '" src="' + source + '" ' + EmbedParam + ' type="' + MimeType + '" pluginspage="' + PlugInSpace + '" />');
	document.write('</object>');
}


/*
 * [関数名] CreateWindowsMediaPlayerObj
 * [機　能] Windows Media Player のウェブ埋め込みタグ生成
 * [説　明] JavaScriptでOBJECTタグ、EMBEDタグを生成し、生成した埋め込みタグを書き出す
 *　　　　　ムービーサイズ、自動再生の有無、コントロール表示・非表示を指定可
 * [引　数]
 * @param fpas ムービーへのパス（相対パス可）
 * @param width ムービーの幅
 * @param height ムービーの高さ
 * @param f_controll コントロール表示の有無 "true" | "false"
 * @param f_auto 自動再生の有無 "true" | "false"
 * @param f_status ステータスバー表示の有無 "true" | "false"
*/
function CreateWindowsMediaPlayerObj(fpass,width,height,f_controll,f_auto,f_status){
    htm="";
    if(f_controll=="true"){ // コントロール表示の場合はコントロールの高さ(45px)をプラス
        height=eval(height+45);
    }
    if(f_status=="true"){ // ステータスバー表示の場合はステータスバーの高さ(24px)をプラス
        height=eval(height+24);
    }
    //OBJECT TAG
    htm+="<object";
    htm+=" id='WMP'";
    htm+=" width='"+width+"' height='"+height+"'";
    htm+=" classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95'";
    htm+=" codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715'";
    htm+=" standby='Loading MicrosoftR WindowsR Media Player components...'";
    htm+=" type='application/x-oleobject'>\n";
    htm+="<param name='FileName' value='"+fpass+"'>\n";
    htm+="<param name='ShowControls' value='"+f_controll+"'>\n";
    htm+="<param name='AutoStart' value='"+f_auto+"'>\n";
    htm+="<param name='ShowStatusBar' value='"+f_status+"'>\n";
    //EMBED TAG
    htm+="<embed name='WMP' type='application/x-mplayer2'";
    htm+=" pluginspage='http://www.microsoft.com/Windows/MediaPlayer/'";
    htm+=" src='"+fpass+"'";
    htm+=" width='"+width+"' height='"+height+"'";
    htm+=" showcontrols='"+((f_controll=="true")?1:0)+"'";
    htm+=" autostart='"+((f_auto=="true")?1:0)+"'";
    htm+=" showstatusbar='"+((f_status=="true")?1:0)+"'>\n";
    htm+="</embed>\n";
    htm+="</object>\n";
    document.write(htm);
}


//テーブルの偶数行目にのみ背景色入れる処理
$(document).ready(function(){
  $("table").each(function(){
    jQuery(this).find("tr:even").addClass("even");
  });
});
