/* --------------------------------------------------------------------------------------
 * flash.js
-------------------------------------------------------------------------------------- */

var pluginspages = new Array();
pluginspages[0] = "http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"; // English
pluginspages[1] = "http://www.macromedia.com/jp/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"; // Japanese
var pluginVer = 0;
function pfAltAction(Obj) {
	if (Obj.nonflashSW == 1) location.href = Obj.nonFlashSRC;
	return Obj.nonFlashSRC;
}
function pfAltContent(Obj) {
	if (Obj.nonflashSW == 1) return "";
	return Obj.nonFlashSRC;
}
function pfFlashPlayerObject() {
	if(navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]){
		return navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
	}
}
function putflash (Obj) {
	var script = "";
	if (!Obj.dir) Obj.dir = '';
	if (!Obj.id) Obj.id = 'putflash';
	if (!Obj.requiredVer) Obj.requiredVer = 8;
	if (!Obj.bgcolor) Obj.bgcolor = "#000000";
	if (!Obj.quality) Obj.quality = "high";
	if (!Obj.language) Obj.language = 0;
	if (!Obj.macie4exec && Obj.macie4exec != "0") Obj.macie4exec = 0;
	if (!Obj.moz_exec && Obj.moz_exec != "0") Obj.moz_exec = 1;
	if (!Obj.opera_exec && Obj.opera_exec != "0") Obj.opera_exec = 0;
	if (!Obj.nonflashSW && Obj.nonflashSW != "0") Obj.nonflashSW = 0;
	if (!Obj.nonFlashSRC) Obj.nonFlashSRC = "";
	if (!Obj.swLiveConnect) Obj.swLiveConnect = "false";
	if (!Obj.wmode) Obj.wmode = '';
	if (!Obj.menu) Obj.menu = "false";
	if (!Obj.disableCodebase) Obj.disableCodebase = 0;
	if (!Obj.flashVars) Obj.flashVars= '';
	var plugin = pfFlashPlayerObject();
	if (plugin) {
		pluginVer = parseInt(plugin.description.match(/\d+\.\d+/));
//	pluginVer = parseInt(plugin.description.substring(plugin.description.indexOf("Flash") +6));
//	pluginVer = parseInt(plugin.description.substring(plugin.description.indexOf(".") -1));
	} else {
		// for Win MSIE
		script += '<script type="text/vbscript">\n';
		script += 'On Error Resume Next\n';
		script += 'Private swfEnableFlag\n';
		script += 'swfEnableFlag = false\n';
		script += 'swfEnableFlag = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.' + Obj.requiredVer + '"))\n';
		script += 'If swfEnableFlag Then\n';
		script += 'pluginVer = ' + Obj.requiredVer + '\n';
		script += 'End If\n';
		script += '</script>\n';
	}
	if (Obj.hedSRC) document.write(Obj.hedSRC);
	if (pluginVer < Obj.requiredVer){
		script += pfAltAction(Obj);
	} else {
 		script += pfGetObjectElement(Obj);
	}
	if (Obj.fotSRC) script += Obj.fotSRC;
	
	if(location.href.indexOf("sitemap") >= 0) {
		return script;
	} else {
		document.write(script);
	}
}
function pfGetObjectElement(Obj){
	

	if (window.opera && Obj.opera_exec != 1) {
		return pfAltAction(Obj);
	}
	if (!Obj.file || !Obj.width || !Obj.height || !Obj.id) {
		return "";
	}
	var result = "";
	result += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
	if(!Obj.disableCodebase){
		result += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"';
	}
	result += ' id="' + Obj.id + '" width="' + Obj.width + '" height="' + Obj.height + '" name="' + Obj.id + '">';
	result += '<param name="movie" value="' + Obj.dir + Obj.file + '">';
	result += '<param name="quality" value="' + Obj.quality + '">';
	result += '<param name="bgcolor" value="' + Obj.bgcolor + '">';
	result += '<param name="wmode" value="' + Obj.wmode + '">';
	result += '<param name="menu" value="' + Obj.menu + '"' + '>';
	if (Obj.salign) result += '<param name="salign" value="' + Obj.salign + '"' + '>';
	if (Obj.scale) result += '<param name="scale" value=' + Obj.scale + '' + '>';
	if (Obj.flashVars) result += '<param name="FlashVars" value="' + Obj.flashVars+ '"' + '>';
	if ((navigator.appVersion.indexOf('Win',0) != -1 && navigator.appName.indexOf("Microsoft Internet Explorer",0) != -1) && !window.opera){
		result += pfAltContent(Obj);
	} else {
		result += pfGetEmbedElement(Obj);
	}
	result += '</object>';
	return result;
}
function pfGetEmbedElement(Obj){
	if (Obj.moz_exec != 1 && (navigator.userAgent.indexOf("Gecko/") != -1)) return pfAltAction(Obj);
	if (Obj.macie4exec != 1 && (navigator.appVersion.indexOf('Mac',0) != -1)){
		if (navigator.appVersion.indexOf('MSIE 4.',0) != -1) return pfAltAction(Obj);
		if (navigator.appVersion.indexOf('MSIE 3.',0) != -1) return pfAltAction(Obj);
	}
	var result = "";
	result += '<embed src="' + Obj.dir + Obj.file + '"';
	result += ' menu="' + Obj.menu + '"';
	result += ' quality="' + Obj.quality + '"';
	result += ' swLiveConnect="' + Obj.swLiveConnect + '"';
	result += ' bgcolor="' + Obj.bgcolor + '"';
	result += ' width="' + Obj.width + '"';
	result += ' height="' + Obj.height + '"';
	if (Obj.salign) result += ' salign="' + Obj.salign + '"';
	if (Obj.scale) result += ' scale="' + Obj.scale + '"';
	if (Obj.flashVars) result += ' FlashVars="' + Obj.flashVars + '"';
	result += ' type="application/x-shockwave-flash"';
	result += ' pluginspage="' + pluginspages[Obj.language] + '"';
	result += ' wmode="' + Obj.wmode + '"';
	result += ' name="' + Obj.id + '"';
	result += '></embed><br>';
	return result;
}

