﻿function GnxFlashActivate ( strFlashUrl , n4Width , n4Height , strWmode , strId , strClassName ) {
	document.writeln( GnxGetFlashActivateString( strFlashUrl , n4Width , n4Height , strWmode , strId , strClassName ) );
}

/* 사용법
<script type="text/javascript" language="JavaScript">
// <![CDATA[
	GnxFlashActivate('http://s.nx.com/S2/Bigshot2/swf/sub_nav.swf',890,175,'opaque','TopNavi','TopNavi');
// ]]>
</script>
*/

function GnxGetFlashActivateString ( strFlashUrl , n4Width , n4Height , strWmode , strId , strClassName ) {
	//width,height 여부 & 묶음 (width,height가 없을때는 0 으로 선언)
	if (n4Width != 0) {
		objSize_attribute = " width='"+ n4Width +"' height='"+ n4Height +"'";
	} else {
		objSize_attribute = "";
	}
	//id 여부 (ID 셀렉렉터가 없을경우 0으로선언)
	if (strId != 0) {
		objId_attribute = " id='" + strId + "'";
		objId_IE_attribute = " id='" + strId + "'";
	} else {
		objId_attribute = "";
		objId_IE_attribute = "";
	}
	//class 여부 (class가 없을때는 0 으로 선언)
	if (strClassName != 0) {
		className_attribute = " class='" + strClassName + "'";
	} else {
		className_attribute = "";
	}
	//wmode 여부 (wmode가 없을때는 0 으로 선언)
	if (strWmode != 0) {
		wmode_param = "<param name='wmode' value='" + strWmode + "' />";
		wmode_attribute = " wmode='" + strWmode + "'";
	} else {
		wmode_param = "";
		wmode_attribute = "";
	}
	var textToWrite = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' " + objSize_attribute + objId_IE_attribute + className_attribute + ">\n";
	textToWrite += "<param name='movie' value='"+ strFlashUrl +"' />\n";
	textToWrite += "<param name='quality' value='high' />\n";
	textToWrite += "<param name=bgcolor value='transparent'>\n";
	textToWrite += "<param name='swliveconnect' value='true' />\n";
	textToWrite += "<param name='allowScriptAccess' value='always' />\n";
	textToWrite += "<param name='menu' value='false' />\n";
	textToWrite += wmode_param+"\n";
	textToWrite += "<embed src='"+strFlashUrl+"' quality='high' bgcolor='transparent' width='"+n4Width+"' height='"+n4Height+"' wmode='"+strWmode+"' swliveconnect='true' menu='false' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'  allowScriptAccess='always'></embed>\n";
	textToWrite += "</object>\n";
	return 	textToWrite;
}

function GnxSetFlashActiveteToControl( strFlashUrl , n4Width , n4Height , strWmode , strId , strClassName, targetObj ) 
{
	targetObj.insertAdjacentHTML( "beforeEnd", GnxGetFlashActivateString( strFlashUrl , n4Width , n4Height , strWmode , strId , strClassName ) );
}

function GnxSetObjectToControl( stringWhere, objectString, targetObj )
{
	targetObj.insertAdjacentHTML( stringWhere, objectString );
}

function GnxFlashActivateWithLayer( strFlashUrl , n4Width , n4Height , strWmode , strObjectId , strClassName, strDivID, n4XOffset, n4YOffset ) {
	document.writeln( "<div id='" + strDivID + "' style='position:absolute;top:" + n4XOffset + "px;left:" + n4YOffset + "px;'>" );
	GnxFlashActivate( strFlashUrl , n4Width , n4Height , strWmode , strObjectId , strClassName );
	document.writeln( "</div>" );
}

// 쫑이닷컴 플레쉬 서비스 특성상 iframe이용.
/* 사용법
<script type="text/javascript" language="JavaScript">
// <![CDATA[
	GnxFlashActivateWithIframe('http://s.nx.com/S2/nexon2005/image/gworld/data/smaple.swf',500,500,'banner02','banner02');
// ]]>
</script>
*/
function GnxFlashActivateWithIframe( strFlashUrl , n4Width , n4Height , strIframeId , strClassName ) {
	document.writeln("<iframe id='" + strIframeId + "' src='" + strFlashUrl + "' width='" + n4Width + "' height='" + n4Height + "' class='" + strClassName + "' border='0' frameborder='0'></iframe>");
}

function swf(src, w, h)
{
	html = '';
	html += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+w+'" height="'+h+'">';
	html += '<param name="movie" value="'+src+'">';
	html += '<param name="allowScriptAccess" value="always">';
	html += '<param name="quality" value="high">';
	html += '<param name="bgcolor" value="transparent">';
	html += '<param name="wmode" value="transparent">';
	html += '<param name="swliveconnect" value="true">';
	html += '<param name="menu" value="false">';
	html += '<embed src="'+src+'" quality=high bgcolor="transparent" width="'+w+'" wmode="transparent" height="'+h+'" swliveconnect="true" menu="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"  allowScriptAccess="always"></embed>';
	html += '<\/object>';
	document.write(html);
}