/*=======================================================================================
*  파일명: insertFlash.js
*  최종수정
*		2007.11.16 // Flex swf파일 로드를 위한 insertFlash9() 추가 // Flex팀 최봉산.
*
==========================================================================================*/


/**
*	flash 태그가 찍히도록 합니다.
*   GNB, LNB 등 플래시swf를 로드하는데 적합합니다.
*
*	param
*		swf:	swf 파일의 경로( ex: /pib/bank/inq/QuickInquiry.swf  or   ../inqQuickInquiry.swf )
*		width:	너비 ( px )
*		height: 높이 ( px )
*		bgcolor: 배경색 ( ex: #FFFFFF )
*		id:		<object 태그의 id값
*		flashvars:	플래시변수, 공백이어도 됩니다.
*		trans:	투명도관련변수.
*		
*/
function insertFlash(swf, width, height, bgcolor, id, flashvars,trans)
{
	insertFlashWithVersion( swf, width, height, bgcolor, id, flashvars, trans, '10,0,0,0' );
}


/**
*	9버전의 플래시플레이어를 필요로하는 flash 태그가 찍히도록 합니다.
*   Flex 화면을 표시하는데는 이 함수를 써야 합니다.
*
*	param
*		위의 insertFlash() 와 동일
*
*/
function insertFlash9(swf, width, height, bgcolor, id, flashvars,trans)
{
	insertFlashWithVersion( swf, width, height, bgcolor, id, flashvars, trans, '9,0,124,0' );
}

function insertFlash10(swf, width, height, bgcolor, id, flashvars,trans)
{
	insertFlashWithVersion( swf, width, height, bgcolor, id, flashvars, trans, '10,0,22,87' );
}


function insertFlashWithVersion(swf, width, height, bgcolor, id, flashvars, trans, verstr)
{
	var strFlashTag = new String();

	if (navigator.appName.indexOf("Microsoft") != -1)
	{
		strFlashTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
		strFlashTag += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+verstr+'" ';
		strFlashTag += 'id="' + id + '" width="' + width + '" height="' + height + '">';
		strFlashTag += '<param name="movie" value="' + swf + '"/>';

		if(flashvars != null) {strFlashTag += '<param name="flashvars" value="' + flashvars + '"/>'};
		strFlashTag += '<param name="quality" value="high"/>';
		strFlashTag += '<param name="allowFullScreen" value="true" />';
		strFlashTag += '<param name="bgcolor" value="' + bgcolor + '"/>';
		strFlashTag += '<param name="menu" value="false"/>';
		strFlashTag += '<param name="salign" value="LT"/>';
		strFlashTag += '<param name="scale" value="noscale"/>';
		strFlashTag += '<param name="wmode" value="' + trans + '"/>';
		strFlashTag += '<param name="allowScriptAccess" value="always"/>';
		strFlashTag += '</object>';
	}
	else
	{
		strFlashTag += '<embed src="' + swf + '" ';
		strFlashTag += 'quality="high" ';
		strFlashTag += 'allowFullScreen="true"  ';
		strFlashTag += 'bgcolor="' + bgcolor + '" ';
		strFlashTag += 'width="' + width + '" ';
		strFlashTag += 'height="' + height + '" ';
		strFlashTag += 'menu="false" ';
		strFlashTag += 'scale="noscale" ';
		strFlashTag += 'id="' + id + '" ';
		strFlashTag += 'salign="LT" ';
		strFlashTag += 'wmode="' + trans + '" ';
		strFlashTag += 'allowScriptAccess="always" ';
		if(flashvars != null) {strFlashTag += 'flashvars="' + flashvars + '" '};
		strFlashTag += 'type="application/x-shockwave-flash" ';
		strFlashTag += 'pluginspage="http://www.macromedia.com/go/getflashplayer">';
		strFlashTag += '</embed>';
	}

	document.write(strFlashTag);
	

		
		// Form Tag안에 있는 Flash는 객체 id가 없다는 에러에 대한 수정
//		var obj = document.getElementById(id);
//		document.body.appendChild(obj);
//		obj.outerHTML = "";
}



function cleanup() 
{
	__flash_unloadHandler = function(){
		externalProbSet = true;
		obj = document.getElementsByTagName('OBJECT');
		for (i=0;i<obj.length;i++){
			var theObj = eval(obj[i]);
			theObj.style.display = "none";

			try{	
				for (var prop in theObj){
					if (typeof(theObj[prop]) == "function"){
						theObj[prop]=null
					}
				}
			}catch( ignored ){}	// /com/wccom011_01s.jsp 에서 '요소가 없습니다.' 오류가 나서 묶었음.

		}
	}
	if (window.onunload != __flash_unloadHandler){
		__flash_savedUnloadHandler = window.onunload;
		window.onunload = __flash_unloadHandler;
	}
}
//window.onbeforeunload=cleanup;



