

// ----------------------------------------------
// chaeck Flash version
// ----------------------------------------------
var MM_contentVersion = 8;

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;
		var MM_PluginVersion = words[i]; 
	}
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}


// ----------------------------------------------
// Open_Flash()
// ----------------------------------------------
// swffile   | swf filename path
// w         | swf width size
// h         | swf height size
// subs      | substitution IMAGE or URL or TEXT
// [pramObj] | option attributes
// ----------------------------------------------
function Open_Flash(swffile, w, h, subs, pramObj) {
	
	var objectParam = embedParam = "";
	
	// option attributes
	if (pramObj){
		for (var item in pramObj){
			objectParam += '<PARAM NAME="' + item + '" VALUE="' + pramObj[item] + '">';
			embedParam  += ' ' + item + '=' + '"' + pramObj[item] + '" ';
		}
	}
	// default attributes
	var defObj = {
		allowScriptAccess : "sameDomain",
		swLiveConnect     : "true",
		menu              : "false",
		quality           : "high",
		bgcolor           : "#ff0000",
		scale             : "noscale",
		salign            : "lt",
		wmode             : "transparent"
	}
	
	for (var item in defObj){
		objectParam += '<PARAM NAME="' + item + '" VALUE="' + defObj[item] + '">';
		embedParam  += ' ' + item + '=' + '"' + defObj[item] + '" ';
	}

	if ( MM_FlashCanPlay ) {
		document.open();
		document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write(' WIDTH="' +w+ '" HEIGHT="' +h+ '" >');
		document.write(objectParam);
		document.write('<PARAM NAME=movie VALUE="' +swffile+ '">'); 
		document.write('<EMBED src="' +swffile+ '" ');
		document.write(embedParam);
		document.write('WIDTH="' +w+ '" HEIGHT="' +h+ '" ');
		document.write('TYPE="application/x-shockwave-flash" >');
		document.write('<\/EMBED>');
		document.write('<\/OBJECT>');
		document.close();
	} else {
		if (subs.length==0){
			rs = confirm("You need FLASH PLAYER verion "+MM_contentVersion+" \n\nInstall it now?");
			if (rs) window.open("http://www.macromedia.com/jp/shockwave/download/");
		} else if (subs.indexOf(".gif")>-1 || subs.indexOf(".jpg")>-1){
			document.write('<img src="' +subs+ '" height="' +h+ '" width="' +w+ '" border="0">');
		} else if (subs.indexOf("http")==0 || subs.indexOf('/')==subs.length-1 || subs.indexOf(".html")>-1){
			window.location = subs;
		} else {
			document.write(subs);
		}
	}

}


