
//-----------------------------------------------------
// flash
//-----------------------------------------------------

//version
var playerVer = 8;

var getPlayerVer = 0;
var playerFlag = 0;
var plugin = 0;

var win = (navigator.appVersion.indexOf("Win") != -1)? true : false;
var ie = (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0)? true : false;


function setFlash(targetObj){
	document.open();
	
	//check Flash Plugin
	plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;

	//check Flash Active X Control
	//Win IE 
	if(navigator.userAgent && ie && win || navigator.userAgent && !plugin){
		//output html
		var htmlSource = "";
		htmlSource += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
		htmlSource +=  'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + playerVer + ',0,00,0"';
		htmlSource += 'width="' + targetObj.width + '" height="' + targetObj.height + '">';
		htmlSource += '<param name="allowScriptAccess" value="sameDomain" />';
		htmlSource += '<param name="movie" value="' + targetObj.data +'" />';
		htmlSource += '<param name="quality" value="high" />';
		htmlSource += '<param name="bgcolor" value="' + targetObj.bgcolor +'" />';
		htmlSource += '<embed src="' + targetObj.data + ' " ' ;
		htmlSource += 'quality="high"' ;
		htmlSource += 'bgcolor="' + targetObj.bgcolor +'"' ;
		htmlSource += 'width="' + targetObj.width +'"' ;
		htmlSource += 'height="' + targetObj.height +'"' ;
		htmlSource += 'allowScriptAccess="sameDomain"' ;
		htmlSource += 'type="application/x-shockwave-flash"' ;
		htmlSource += 'pluginspage="http://www.macromedia.com/go/getflashplayer" />' ;
		htmlSource += '<\/object>';
		document.write(htmlSource);
	}

	//Mac IE 5,NN 3,Safari,Opera
	else{
		var playerVarReg = new RegExp("\\s([0-9]+\\.[0-9]+)\\s","i");
		var playerVarRes = plugin.description.match(playerVarReg);
		var getPlayerVer = parseInt(RegExp.$1);

		playerFlag = getPlayerVer >= playerVer;
			//output html
			if(playerFlag){
				var htmlSource = "";
				htmlSource += '<object data="' + targetObj.data +'" type="application/x-shockwave-flash" width="' + targetObj.width + '" height="' + targetObj.height + '">';
				htmlSource += '<param name="movie" value="' + targetObj.data +'" />';
				htmlSource += '<param name="quality" value="high" />';
				htmlSource += '<param name="bgcolor" value="' + targetObj.bgcolor +'" />';
				htmlSource += '<\/object>';
				document.write(htmlSource);
			}
			else{
			//output html
				var htmlSource = "";
				htmlSource += '<div style="width:764px; height:290px;">';
				htmlSource += 'This content requires the Adobe Flash Player.';
				htmlSource += '<a href="http://www.adobe.com/go/getflash/" target="_blank">Get Flash<\/a>';
				htmlSource += '<\/div>';
				document.write(htmlSource);
			}
	}
	document.close();
}
