/*=======================================================================================
*  파일명: flash_common.js
*
==========================================================================================*/


/**
*	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, '8,0,0,0' );
	insertFlashWithVersion( swf, width, height, bgcolor, id, flashvars, trans, '9,0,124,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 insertFlashWithVersion(swf, width, height, bgcolor, id, flashvars, trans, verstr)
{
	var strFlashTag = new String();

	if (navigator.appName.indexOf("Microsoft") >= 0)
	{
		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="best"/>';
		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="best" ';
		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);
}



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 ){}

		}
	}
	if (window.onunload != __flash_unloadHandler){
		__flash_savedUnloadHandler = window.onunload;
		window.onunload = __flash_unloadHandler;
	}
}
//window.onbeforeunload=cleanup;

/**
*	플래시 객체 얻어오기.
*/
function getFlashObject( objectid ){
	if (navigator.appName.indexOf("Microsoft") >= 0 ){	
		oFlash = window[objectid]
	}else{	
		if( navigator.appVersion.indexOf('Chrome') >= 0 ){
			oFlash = window[objectid]
		}else{
			oFlash = document[objectid]
		}
	}
	return oFlash;	
}

/**
 * 디버깅용 함수정보 alert
 */
function defaultAlert( args ){
	var fstr = String(args.callee);
	var s = fstr.substring(0, fstr.indexOf('(') );
	s += ' ('
	for( var i = 0 ; i < args.length ; i++ ){
		if( i > 0 )
			s += ',';
		s += "'"+args[i]+"'";
	}
	s += ' )'
	alert( s );
}

/**
*	메뉴 플래시 클릭 함수.
*/
function bx_menu_click( link, arg1, arg2 ){
	if( link != '' ){
		//defaultAlert( arguments );
		if(arg1=='blank'){
			winObj = window.open(link,'new_win');
		} else if(arg1 == ''){
			location.href = link;
		} else{
			eval(arg1).location.href = link;
		}
	}
}	

