// ################## 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 MakeFlashString(source,id,width,height,wmode, otherParam)
{	
	return "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0\" width="+width+" height="+height+" id="+id+"><param name=wmode value="+wmode+" /><param name=movie value="+source+" /><param name=quality value=high />"+otherParam+"<embed src="+source+" quality=high wmode="+wmode+" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash\" width="+width+" height="+height+"></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 SetInnerHTML(src)
{ 
	//innerHTML = code; 
	document.write(src);
}



// Direct Write Type
function DocumentWrite(src)
{
	document.write(src);
}

function ShowVod(sfilename, iwidth, ihegiht)
{
	var _showvod = '';

	  _showvod = '<object classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" id="Player" vspace="0" hspace="0" width="'+iwidth+'" height="'+ihegiht+'">'
	  _showvod = _showvod + '<param name="Filename" value='+ sfilename +'>' // ¹Ìµð¾î¼­¹ö °æ·Î±âÀÔ
	  _showvod = _showvod + '<param name="AutoStart" value="1">'
	  _showvod = _showvod + '<param name="AnimationAtStart" value="1">'
	  _showvod = _showvod + '<param name="DisplaySize" value="4">'
	  _showvod = _showvod + '<param name="EnableContextMenu" value="false">'
	  _showvod = _showvod + '<param name="EnablePositionControls" value="-1">'
	  _showvod = _showvod + '<param name="EnableFullScreenControls" value="0">'
	  _showvod = _showvod + '<param name="Mute" value="0">'
	  _showvod = _showvod + '<param name="ShowCaptioning" value="0">'
	  _showvod = _showvod + '<param name="ShowControls" value="1">'
	  _showvod = _showvod + '<param name="ShowAudioControls" value="1">'
	  _showvod = _showvod + '<param name="ShowDisplay" value="0">'
	  _showvod = _showvod + '<param name="ShowGotoBar" value="0">'
	  _showvod = _showvod + '<param name="ShowPositionControls" value="1">'
	  _showvod = _showvod + '<param name="ShowStatusBar" value="1">'
	  _showvod = _showvod + '<param name="ShowTracker" value="1">'
	  _showvod = _showvod + '<param name="SendMouseClickEvents" value="-1">'
	  _showvod = _showvod + '<param name="BufferingTime" value="1">'
	  _showvod = _showvod + '<param name="Seek" value="1">'
	_showvod = _showvod + '</object>'
	document.write(_showvod);
	//document.write(sfilename);
}

function ShowMP3(sfilename, iwidth, ihegiht){
	document.write ("<embed src='"+sfilename+"' width='"+iwidth+"' height='"+ihegiht+"' autostart=1>");
}

function ShowFlash(sfilename, iwidth, iheight)	 //ÆÄÀÏ¸í, Æø, ³ô¹Ì	
{
	var _showflash = '';
	_showflash = ''
	_showflash = '<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0 width='+ iwidth +' height='+ iheight +'>';
	_showflash = _showflash + '<param name=movie value='+ sfilename +'>';
	_showflash = _showflash + '<param name=allowScriptAccess value=always>';
	_showflash = _showflash + '<param name=wmode value=transparent>';
	_showflash = _showflash + '<param name=quality value=high>';
	_showflash = _showflash + '<embed src='+ sfilename +' quality=high pluginspage=http://www.macromedia.com/go/getflashplayer type=application/x-shockwave-flash allowscriptaccess=always swliveconnect=true width='+ iwidth +' height='+ iheight +'></embed></object>';
  
    document.write(_showflash);
}

function urlCopy(obj)
    {
        var idxs = obj;
        if(idxs.value==''){ document.body.focus(); return; }
        idxs.select();
        var clip=idxs.createTextRange()
        clip.execCommand('copy');
        alert('µ¿¿µ»ó ¹× »çÁøÆÄÀÏÁÖ¼Ò°¡ ¸Þ¸ð¸®¿¡ ±â¾ïµÇ¾ú½À´Ï´Ù.\nCtrl + V ¸¦ ´©¸£½Ã¸é ÁÖ¼Ò¸¦ È®ÀÎÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.');
    }

function bluring(){ 
if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); 
} 
document.onfocusin=bluring; 

/**
*
*  Base64 encode / decode
*  http://www.webtoolkit.info/
*
**/
 
var Base64 = {

	// private property
	_keyStr : "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789+/=",
 
	// public method for encoding
	encode : function (input) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;
 
		input = Base64._utf8_encode(input);
 
		while (i < input.length) {
 
			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);
 
			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;
 
			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}
 
			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
 
		}
 
		return output;
	},
 
	
 
	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
 
		for (var n = 0; n < string.length; n++) {
 
			var c = string.charCodeAt(n);
 
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
 
		}
 
		return utftext;
	} 
}
