// ################## Script For Flash & ActiveX #########################

// +++++++++++++  MakeFlashString(source, id, width, height, wmode) ++++++++
// 
// source: source url --> ÇÃ·¡½¬ ÆÄÀÏÀÇ °æ·Î
// id: flash id 
// width: source width
// height: source height
// wmode: wmode --> "none, transparent, opaque"
// otherparam : Ãß°¡ ÆÄ¶ó¹ÌÅÍ "<param name='myParam' value='myValue' />
// 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// +++++++++++++  MakeObjectString(classid, codebase, name, id, width,height, param) ++++++++
// 
// classid: classid --> ÇÃ·¡½¬ ÆÄÀÏÀÇ °æ·Î
// codebase: cabÆÄÀÏ À§Ä¡ ¹× ¹öÀüÁ¤º¸ 
// name :
// id :
// width: source width
// height: source height
// 
// wmode: wmode --> "none, transparent, opaque"
// param : Ãß°¡ ÆÄ¶ó¹ÌÅÍ "<param name='myParam' value='myValue' />
// 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// Example 
// DocumentWrite(MakeFlashString('image/ml_flash.swf','emb1','330','520','opaque'));
// SetInnerHTML(document.all.mm, MakeFlashString('image/ml_flash.swf','emb1','330','520','opaque'));
// @@ÁÖÀÇ »çÇ× 
//  - »óÈ£ÀÛ¿ë ¾ø´Â ÄÁÅÙÃ÷´Â DocumentWrite, SetInnerHTML µÑ´Ù »ç¿ë °¡´É
//  - »óÈ£ÀÛ¿ë ÀÖ´Â ÄÁÅÙÃ÷´Â SetInnerHTML¸¸ »ç¿ë °¡´É
// #######################################################################

//ÇÃ·¡½Ã ¸µÅ©ºÎºÐ Ãß°¡ 
function callJavascript(str) {
	//alert(str)
	var _url="../../www.kunshu.jp/center/common/asp/menucontrol.asp@cn="
	//response.redirect("../../www.naver.com/","_self")  
	window.open(_url + str ,"_self");	
}

//ÇÃ·¡½Ã JSÆÄÀÏ Ãß°¡ ¹× ¼öÁ¤
var fc_isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var fc_isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var fc_isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function checkFlashPlayerVersion(){
	var _version;
	var _e;
	try {
		var _axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.5");
		_version = _axo.GetVariable("$version");
	} catch (_e) {
		_version = -1;
	}
	return _version;
}


function MakeFlashString(_swfURL_,_flashID_,_width_,_height_,_wmode_,_flashVars_,_bgColor_){
	document.write(returnFlashContents(_swfURL_,_flashID_,_width_,_height_,_wmode_,_flashVars_,_bgColor_));
}


function returnFlashContents(_swfURL_,_flashID_,_width_,_height_,_wmode_,_flashVars_,_bgColor_){
	_wmode_ = (_wmode_ == undefined)? "transparent" : _wmode_;
	_bgColor_ = (_bgColor_ == undefined)? "#000000" : _bgColor_;
	
	if(fc_isIE && fc_isWin && !fc_isOpera){
		_object_ ='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="../../fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0/#version=9,0,0,0/default.htm" width="'+_width_+'" height="'+_height_+'" id="'+_flashID_+'" align="middle">';
		_object_ += '<param name="allowScriptAccess" value="always" />';
		_object_ += '<param name="quality" value="high" />'; 
		_object_ += '<param name="movie" value="'+_swfURL_+'" />';
		_object_ += '<param name="wmode" value="'+_wmode_+'" />'; 
		_object_ += '<param name="bgcolor" value="'+_bgColor_+'" />'; 
		_object_ += '<param name="FlashVars" value="'+_flashVars_+'">';
		_object_ += '</object>';
	}else{
		_object_ = '<embed src="'+_swfURL_+'" quality="high" wmode="'+_wmode_+'" FlashVars="'+_flashVars_+'" bgcolor="'+_bgColor_+'" width="'+_width_+'" height="'+_height_+'" name="'+_flashID_+'" align="middle" allowScriptAccess="always" showLiveConnect="true" type="application/x-shockwave-flash" pluginspage="../../www.macromedia.com/go/getflashplayer" />'; 
	}
	return _object_;
}


function findFlashObj(_flashID_){
	var tarObj = fc_isIE ? document.all[_flashID_] : document[_flashID_];	
	return tarObj;
}

// for 'Out of memory line at 56' error    - add 2007. 6. 12
function flashExternalCleanup() {
	__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";
	   	for (var prop in theObj){
	    		if (typeof(theObj[prop]) == "function"){
	     			theObj[prop]=null;
	    		}
	   	}
	  	}
	}
	if (window.onunload != __flash_unloadHandler){
		__flash_savedUnloadHandler = window.onunload;
		window.onunload = __flash_unloadHandler;
	}
}
window.onbeforeunload=flashExternalCleanup;



function MakeFlashString_back(source, id, width, height, wmode, otherParam)
{return "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"../../download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0\" width=" + width + " height=" + height + " id=" + id + " name=" + id + "><param name=wmode value=" + wmode + " /><param name=movie value=" + source + " /><param name=quality value=high /><param name=allowScriptAccess value=always />" + otherParam + "<embed src=" + source + " quality=high wmode=" + wmode + " type=\"application/x-shockwave-flash\" pluginspage=\"../../www.macromedia.com/shockwave/download/index.cgi@p1_prod_version=shockwaveflash\" width=" + width + " height=" + height + " name=" + id + "></embed></object>";}

function MakeObjectString(classid, codebase, name, id, width, height, param)
{
	return "<object classid=" + classid + " codebase=" + codebase + " name=" + name + " width=" + width + " height=" + height + " id=" + id + ">" + param + "</object>";
}

function MakeEditorString(id, data, width, height, border, frameborder)
{
	return '<object id="' + id + '" data="' + data + '" type="text/x-scriptlet" width="' + width + '" height="' + height + '" border="' + border + '" frameborder="' + frameborder + '"></object>';
}

function MakeEmbedString(src, width, height, autostart, mute)
{
	return '<embed id="MediaPlayer" src="' + src + '" width="' + width + '" height="' + height + '" autostart="' + autostart + '" mute="' + mute + '"></embed>';
}

function MakeMoviePlayerString(src, width, height, otherParam)
{
	return "<object classid=\"clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" codebase=\"../../activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715\" id=\"NSPlay\" type=\"application/x-oleobject\" standby=\"Loading Microsoft Windows Media Player components...\" width=" + width + " height=" + height + " VIEWASTEXT><PARAM NAME=\"FileName\" VALUE=\"" + src + "\">" + otherParam + "<embed type=\"application/x-mplayer2\" pluginspage=\"../../www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/default.htm\" src=\"" + src + "\" width=" + width + " height=" + height + "></embed></object>";
}

// innerHTML Type
function SetInnerHTML(target, code)
{ 
	target.innerHTML = code; 
}

// Direct Write Type
function DocumentWrite(src)
{
	document.write(src);
}
