/************************************************/
/* Object Embed Script v1.0											*/
/* Author : ÀÌ°ÇÁØ															*/
/* Update : 2008.04.14													*/
/************************************************/
/* Usage : ¾Æ·¡¿Í °°ÀÌ ÄÚµù ¹Ù¶ø´Ï´Ù.						*/
/*************************************************
<script type="text/javascript">
	var fls = new setEmbed();
	fls.init('../../images/common/starter_v02_sub.swf', 344, 222);
	fls.parameter('flashvars', 'serverDomain=../../');
	fls.setAlt('<p>ÇÃ·¡½Ã ¹«ºñ¸¦ °¨»óÇÏ±â À§ÇØ¼­´Â Flash Player¸¦ ¼³Ä¡ÇØ¾ß ÇÕ´Ï´Ù.<br />ÀÌ°÷¿¡¼­ Flash Player¸¦ <a href="http://www.macromedia.com/go/getflashplayer" target="_black">´Ù¿î·Îµå</a> ¹ÞÀ¸¼¼¿ä.</p>');
	fls.show();
</script>
<noscript>
	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="344" height="222">
		<param name="movie" value="../../images/common/starter_v02_sub.swf?serverDomain=../../" />
		<param name="quality" value="high" />
		<param name="wmode" value="transparent" />
		<param name="menu" value="false" />
		<!--[if !IE]> <-->
		<object data="../../images/common/starter_v02_sub.swf?serverDomain=../../" type="application/x-shockwave-flash" width="344" height="222">
			<param name="quality" value="high" />
 			<param name="wmode" value="transparent" />
			<param name="menu" value="false" />
			<param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer" />
		<!--> <![endif]-->

		<p>
			ÇÃ·¡½Ã ¹«ºñ¸¦ °¨»óÇÏ±â À§ÇØ¼­´Â Flash Player¸¦ ¼³Ä¡ÇØ¾ß ÇÕ´Ï´Ù.<br />
			ÀÌ°÷¿¡¼­ Flash Player¸¦ <a href="http://www.macromedia.com/go/getflashplayer" target="_black">´Ù¿î·Îµå</a> ¹ÞÀ¸¼¼¿ä.
		</p>

		<!--[if !IE]> <-->
		</object>
		<!--> <![endif]-->
	</object>
</noscript>
*************************************************/

function setEmbed() {
	var obj = new String;
	var parameter = new String;
	var clsid = new String;
	var codebase = new String;
	var pluginspace = new String;
	var embedType = new String;
	var src = new String;
	var width = new String;
	var height = new String;
	var style = new String;
	var oid = new String;
	var althtml = new String;

	this.init = function(s ,w , h, sty, oid, alt, getType) {
		getType = (getType) ? getType.toUpperCase() : '';

		/* ===== flash case ===== */
		if ( getType == 'FLASH') {
			clsid = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
			codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0';
			pluginspage = 'http://www.macromedia.com/go/getflashplayer';
			embedType = 'application/x-shockwave-flash';
		/* ===== movie case ===== */
		} else if (getType == 'MOVIE' ) {
			clsid='clsid:22d6f312-b0f6-11d0-94AB-0080c74c7e95';
			codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715';
			//embedType="application/x-oleobject";
			embedType='application/x-mplayer2';
			pluginspage='http://www.microsoft.com/windows/mediaplayer/download/default.asp';
			/* ===== default case (=flash) ===== */
		} else {
			clsid = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
			codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0';
			pluginspage = 'http://www.macromedia.com/go/getflashplayer';
			embedType = 'application/x-shockwave-flash';
		}

		if ( !s || !w || !h)
			alert('Input correct parameters');
		
		this.setSrc(s);
		this.setWidth(w);
		this.setHeight(h);
		this.setStyle(sty);
		this.setAlt(alt);

		/* default parameter */
		this.parameter('quality', 'high');
		this.parameter('wmode', 'transparent');
		this.parameter('menu', 'false');
	}

	this.parameter = function( parm , value ) {														// parameter Ãß°¡
		parameter += '<param name="'+parm +'" value="'+ value + '" />\n';
	}

	this.setSrc = function(nsrc) {src = nsrc;}														// SRC URL
	this.setWidth = function(nwidth) {width = nwidth;}										// °¡·Î
	this.setHeight = function(nheight) {height = nheight;}								// ¼¼·Î
	this.setId = function(nid) {oid = (nid) ? nid : '';}									// Object ID
	this.setStyle = function(nstyle) {style = (nstyle) ? nstyle : '';}		// Stylesheet
	this.addStyle = function(nstyle) {style += (nstyle) ? nstyle : '';}		// Stylesheet Ãß°¡ 
	this.setAlt = function(nalt) {althtml = (nalt) ? nalt : '';}					// ´ëÃ¼ÄÁÅÙÃ÷ HTML

	this.show = function(targetId) {
		if(window.ActiveXObject) {
			obj = '<object classid="'+ clsid +'" codebase="'+ codebase +'" width="'+ width +'" height="'+ height +'"';
			if(style != '') obj += ' style= "' + style + '"';
			if(oid != '') obj += ' id="'+oid+'"';
			obj += '>\n';
			obj += '<param name="movie" value="'+ src +'" />\n';
			obj += parameter;
			if(althtml != '') obj += althtml + '\n';	// ´ëÃ¼ÄÁÅÙÃ÷ »ðÀÔ
			obj += '</object>\n';
		} else {
			obj += '<object data="' + src + '" type="'+ embedType + '" width="'+ width + '" height="'+ height +'"';
			if(style != '') obj += ' style= "' + style + '"';
			if(oid != '') obj += ' id="'+oid+'"';
			obj += '>\n';
			obj += '<param name="pluginurl" value="'+ pluginspage +'" />\n';
			obj += parameter;
			if(althtml != '') obj += althtml + '\n';	// ´ëÃ¼ÄÁÅÙÃ÷ »ðÀÔ
			obj += '</object>\n';
		}
		
		if(targetId) {
			document.getElementById(targetId).innerHTML = obj;
		} else {
			document.write( obj );
		}
	}
}
