/*=======================================================================================
*  파일명: 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:	투명도관련변수.
*
*/
var flashCommon = 1;
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' );
}
function insertFlash9(swf, width, height, bgcolor, id, flashvars,trans, tabbing )
{
	insertFlashWithVersion( swf, width, height, bgcolor, id, flashvars, trans, '9,0,124,0', tabbing );
}
function insertFlashWithVersion(swf, width, height, bgcolor, id, flashvars, trans, verstr, tabbing )
{
	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 += '<param name="SeamlessTabbing" value="'+tabbing+'"/>';
		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];
		if (oFlash == undefined) {
			oFlash = document[objectid];
		}
	}else{
		if( navigator.appVersion.indexOf('Chrome') >= 0 ){
			oFlash = window[objectid];
		}else{
			oFlash = document[objectid];
			if(oFlash == undefined) {
				oFlash = window[objectid];
			}
		}
	}
	return oFlash;
}
/**
* 현재 브라우져별 현재 창의 크기를 리턴
*/
function browserSize( flag ) {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
	    myWidth = window.innerWidth;
	    myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	    //IE 6+ in 'standards compliant mode'
	    myWidth = document.documentElement.clientWidth;
	    myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    //IE 4 compatible
	    myWidth = document.body.clientWidth;
	    myHeight = document.body.clientHeight;
	}
	if (flag == 'width') {
		return myWidth;
	} else {
		return myHeight;
	}
}
/**
* 현재 브라우져의 스크롤 크기를 리턴
*/
function getScrollXY() {
	var scrOfX = 0, scrOfY = 0;
  	if( typeof( window.pageYOffset ) == 'number' ) {
    	//Netscape compliant
    	scrOfY = window.pageYOffset;
    	scrOfX = window.pageXOffset;
  	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    	//DOM compliant
    	scrOfY = document.body.scrollTop;
    	scrOfX = document.body.scrollLeft;
  	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    	//IE6 standards compliant mode
    	scrOfY = document.documentElement.scrollTop;
    	scrOfX = document.documentElement.scrollLeft;
  	}
  	return [ scrOfX, scrOfY ];
}
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 );
}

