/***********************************************************************
*	program			:	ejEditor v.2.2
*	author			:	tae hun lim (soonsoo@gmail.com)
*	last modified	:	2011-10-25 12:34:11
***********************************************************************/
var ejEditor = function() {
	//	에디터명 & 버전
	this._ejInfo		=	"ejEditor v.2.2";
	//	리사이즈바 높이
	this._ejRsh			=	13;
	//	에디터 경로
	this._ejPath		=	"/Editor";
	//	버튼 경로
	this._ejBtn			=	this._ejPath + "/button";
	//	이모티콘 경로
	this._ejEmo			=	this._ejPath + "/emoticon";
	//	이미지 업로드 경로
	this._ejData		=	"/Data/Editor";
	//	다음맵 사용여부
	this._ejDMap		=	false;
	//	첫번째 에디터에 자동포커스 여부
	this._ejFocus		=	false;
	this._ejFcsId		=	null;
	//	에디터로 전환된 textarea 개수
	this._tCnt			=	0;
	//	접두사
	this._ejPfx			=	"ej-edt-";
	//	에디터모드
	this._gmode			=	1;
	//	textarea 배열
	this._tarea			=	new Array();
	//	textarea 가로사이즈
	this._twidth		=	new Array();
	//	에디터 iframe
	this._ifrm			=	new Array();
	//	이전 출력된 레이저
	this._ejOld			=	new Array();
	//	range
	this.rng			=	new Array();

	//	메뉴 출력 여부
	this._ej_menu_prt	=	[
	//	모드		글꼴		크기		글자색		배경색		볼드		기울임		언더바		취소선		왼쪽정렬	중앙정렬	오른쪽정렬	양쪽정렬	
		true,		true,		true,		true,		true,		true,		true,		true,		true,		true,		true,		true,		true,
	//	들여쓰기	내어쓰기	무작위목록	순서목록	줄간격		링크		테이블		이미지		동영상		플래시		인용구		이모티콘	특수문자
		true,		true,		true,		true,		true,		true,		true,		true,		true,		true,		true,		false,		true
	];

	this._layid			=	['font','size','fcolor','bcolor','lheight','link','table','image','movie','flash','quote','emoticon','special','map'];
	this._tfont			=	['굴림' , '굴림체' ,'돋움' , '돋움체' , '바탕' , '바탕체'  , '궁서' , 'Arial','Tahoma','Verdana','Times New Roman'];
	this._ffont			=	['gulim','gulimche','dotum','dotumche','batang','batangche','gungsuh','arial','tahoma','verdana','timesnewroman'];
	this._tfsize		=	['10','12','14','16','18','20','22'];
	this._fslh			=	['18','18','18','22','24','26','28'];
	this._fsreal		=	['1', '2', '3', '4', '5', '6', '7'];
	this._lheight		=	['120%','140%','160%','180%','200%','250%'];
	this._ejcolor		=	[
		'ff0000','ff4646','ff5a5a','ff6e6e','ff8282','ff9696','ffaaaa','ffbebe','ffd2d2','ffe6e6','0000ff','0078ff','46beff','3cc2ff','1eddff','5ae0ff','78f3ff','3cfbff','96ffff','c8ffff',
		'ff8200','ffa01e','ffb937','ffcd28','ffd73c','ffe150','faeb78','faf58c','fafaaa','fafad2','006400','1e821e','3ca03c','40a940','5ec75e','6dd66d','80e12a','94eb3e','a8f552','c6ff70',
		'ff1493','ff28a7','ff3cbb','ff50cf','ff64e3','ff8cff','ffa0ff','ffb4ff','ffc8ff','ffdcff','9400d3','9e0add','a814e7','b21ef1','bc28fb','df75db','e97fe5','f389ef','fd93f9','ff9dff',
		'8b4513','8b6331','ae5e1a','cc7c38','e0904c','ef9f5b','ffa98f','ffc7ad','ffdbc1','ffefd5','000000','464646','5a5a5a','6e6e6e','828282','969696','aaaaaa','bebebe','dcdcdc','ffffff'
	];
	this._ejemot		=	[
		'01.gif','02.gif','03.gif','04.gif','05.gif','06.gif','07.gif','08.gif','09.gif','10.gif','11.gif','12.gif','13.gif','14.gif','15.gif','16.gif','17.gif','18.gif','19.gif','20.gif'
	];
	this._schar			=	new Array();
	this._schar[0]		=	[
		"　","※","☆","★","○","●","◎","◇","◆","□","■","△","▲","▽","▼","→","←","↑","↓","↔","〓","◁","◀","▷","▶","♤","♠","♡","♥","♧","♣","⊙","◈","▣","◐","◑","▒","▤","▥","▨",
		"▧","▦","▩","♨","☏","☎","☜","☞","¶","‡","↕","↗","↙","↖","↘","♭","♩","♪","♬","㉿","㈜","№","㏇","™","㏂","㏘","℡","®","ª","º","¹","²","³","⁴","ⁿ","₁","₂","₃","₄"
	];
	this._schar[1]		=	[
		"㏄","㎣","㎤","㎥","㎦","㎙","㎚","㎛","㎜","㎝","㎞","㎟","㎠","㎡","㎢","㏊","㎍","㎎","㎏","㏏","㎈","㎉","㏈","㎧","㎨","㎰","㎱","㎲","㎳","㎴","㎵","㎶","㎷","㎸","㎹","㎀","㎁","㎂","㎃","㎄",
		"㎺","㎻","㎼","㎽","㎾","㎿","㎐","㎑","㎒","㎓","㎔","Ω","㏀","㏁","㎊","㎋","㎌","㏖","㏅","㎭","㎮","㎯","㏛","㎩","㎪","㎫","㎬","㏝","㏐","㏓","ⅰ","ⅱ","ⅲ","ⅳ","ⅴ","ⅵ","ⅶ","ⅷ","ⅸ","ⅹ",
		"Ⅰ","Ⅱ","Ⅲ","Ⅳ","Ⅴ","Ⅵ","Ⅶ","Ⅷ","Ⅸ","Ⅹ","½","⅓","⅔","¼","¾","⅛","⅜","⅝","⅞"
	];
	this._schar[2]		=	[
		"─","│","┌","┐","┘","└","├","┬","┤","┴","┼","━","┃","┏","┓","┛","┗","┣","┳","┫","┻","╋","┠","┯","┨","┷","┿","┝","┰","┥","┸","╂","┒","┑","┚","┙","┖","┕","┎","┍",
		"┞","┟","┡","┢","┦","┧","┩","┪","┭","┮","┱","┲","┵","┶","┹","┺","┽","┾","╀","╁","╃","╄","╅","╆","╇","╈","╉","╊"
	];
	this._schar[3]		=	[
		"㉠","㉡","㉢","㉣","㉤","㉥","㉦","㉧","㉨","㉩","㉪","㉫","㉬","㉭","㉮","㉯","㉰","㉱","㉲","㉳","㉴","㉵","㉶","㉷","㉸","㉹","㉺","㉻","㈀","㈁","㈂","㈃","㈄","㈅","㈆","㈇","㈈","㈉","㈊","㈋",
		"㈌","㈍","㈎","㈏","㈐","㈑","㈒","㈓","㈔","㈕","㈖","㈗","㈘","㈙","㈚","㈛","ⓐ","ⓑ","ⓒ","ⓓ","ⓔ","ⓕ","ⓖ","ⓗ","ⓘ","ⓙ","ⓚ","ⓛ","ⓜ","ⓝ","ⓞ","ⓟ","ⓠ","ⓡ","ⓢ","ⓣ","ⓤ","ⓥ","ⓦ","ⓧ",
		"ⓨ","ⓩ","①","②","③","④","⑤","⑥","⑦","⑧","⑨","⑩","⑪","⑫","⑬","⑭","⑮"
	];
	this._schar[4]		=	[
		"ぁ","あ","ぃ","い","ぅ","う","ぇ","え","ぉ","お","か","が","き","ぎ","く","ぐ","け","げ","こ","ご","さ","ざ","し","じ","す","ず","せ","ぜ","そ","ぞ","た","だ","ち","ぢ","っ","つ","づ","て","で","と",
		"ど","な","に","ぬ","ね","の","は","ば","ぱ","ひ","び","ぴ","ふ","ぶ","ぷ","へ","べ","ぺ","ほ","ぼ","ぽ","ま","み","む","め","も","ゃ","や","ゅ","ゆ","ょ","よ","ら","り","る","れ","ろ","ゎ","わ","ゐ",
		"ゑ","を","ん"
	];
	this._schar[5]		=	[
		"ァ","ア","ィ","イ","ゥ","ウ","ェ","エ","ォ","オ","カ","ガ","キ","ギ","ク","グ","ケ","ゲ","コ","ゴ","サ","ザ","シ","ジ","ス","ズ","セ","ゼ","ソ","ゾ","タ","ダ","チ","ヂ","ッ","ツ","ヅ","テ","デ","ト",
		"ド","ナ","ニ","ヌ","ネ","ノ","ハ","バ","パ","ヒ","ビ","ピ","フ","ブ","プ","ヘ","ベ","ペ","ホ","ボ","ポ","マ","ミ","ム","メ","モ","ャ","ヤ","ュ","ユ","ョ","ヨ","ラ","リ","ル","レ","ロ","ヮ","ワ","ヰ",
		"ヱ","ヲ","ン","ヵ","ヶ"
	];

	//	에디터로 변경
	this.init();
};
ejEditor.prototype = {
	init : function() {
		if(this._ejInfo.substring(0,8) != "ejEditor") {
			var	notEdt = 0;
			if(notEdt == 0) {
				alert("에디터 정보를 변경하시면 사용 할 수 없습니다.");
				notEdt++;
			}
		}
		else {
			var _taorg		=	$("textarea");
			for(var i = 0; i < _taorg.length; i++) {
				if($(_taorg[i]).attr("lang") && $(_taorg[i]).attr("lang").substring(0,9) == "ej-editor") {
					this._tarea[this._tCnt]		=	$(_taorg[i]).attr("id");
					this._twidth[this._tCnt]	=	$(_taorg[i]).width();
					if(i == 0)	this._ejFcsId	=	this._tarea[this._tCnt];
					this._tCnt++;
				}
			}

			for(var i = 0; i < this._tarea.length; i++) {
				var _torg	=	document.getElementsByName(this._tarea[i])[0];
				//	create iframe
				this._ifrm[i]	=	document.createElement("iframe");
				$(this._ifrm[i]).attr({"id":"_ejt"+this._tarea[i],"scrolling":"auto","frameBorder":"no","marginWidth":"0","marginHeight":"0"});
				$(this._ifrm[i]).css({"clear":"both","width":this._twidth[i]+"px","height":($(_torg).height()-this._ejRsh)+"px","overflow":"auto","border":"1px solid #ddd","padding":"3px","background":"#fff"});
				_torg.parentNode.insertBefore(this._ifrm[i],_torg);
				$(_torg).css({"clear":"both","width":this._twidth[i]+"px","color":"#999","font-size":"12px","font-family":"gulim","margin":"0","padding":"3px","border":"1px solid #ddd","background":"#fff","display":"none"});

				this._ifrm[i].contentWindow.document.open();
				this._ifrm[i].contentWindow.document.write("<html>");
				this._ifrm[i].contentWindow.document.write("<head>");
				this._ifrm[i].contentWindow.document.write("<title>"+this._ejInfo+"</title>");
				this._ifrm[i].contentWindow.document.write("<link href=\"" + this._ejPath + "/editor.css\" rel=\"stylesheet\" type=\"text/css\" />");
				this._ifrm[i].contentWindow.document.write("</head><body>" + _torg.value + "</body></html>");
				this._ifrm[i].contentWindow.document.close();
				this._ifrm[i].contentWindow.document.designMode = "on";
				$(this._ifrm[i].contentWindow.document).bind('mousedown keydown keyup focus blur', function() {
					ejEditor.edt2html();
				});
				$(_torg).bind('mousedown keydown keyup focus blur', function() {
					ejEditor.html2edt();
				});

				//	에디터 하단 리사이즈 영역 세팅
				//$("#_ejt" + _tarea[i]).ejResizeEditor();
				//$("#_ejt" + this._tarea[i]).after('<div id="_resize_ejt' + this._tarea[i] + '" style="width:' + (this._twidth[i] + 6) + 'px;" class="ej-editor-resize-bar" />').resizable({'maxHeight':9999,'plusHeight':this._ejRsh});

				//	엔터입력
				$(this._ifrm[i].contentWindow.document).bind("keydown", {_ifrm:this._ifrm[i],rng:this.rng,rngNo:i}, function(e) {
					var evt		=	e || window.event;
					var keyCode	=	evt.keyCode || evt.charCode;
					var	rng		=	(window.getSelection) ? this.getSelection() : this.selection.createRange();
					if(keyCode == 13 && $.browser.msie && $.browser.version != "9.0") {
						if(rng.parentElement().tagName != "LI") {
							rng.pasteHTML("<br />");
							ejEditor.cEvt(e, true);
							rng.select();
						}
					}
					e.data.rng[e.data.rngNo]	=	rng;
				});
				$(this._ifrm[i].contentWindow.document).bind("click focus", {rng:this.rng,rngNo:i}, function(e) {
					var	rng		=	(window.getSelection) ? this.getSelection() : this.selection.createRange();
					e.data.rng[e.data.rngNo]	=	rng;
					ejEditor.layClose();
				});
				$(this._ifrm[i].contentWindow.document).bind("keypress blur mousedown mouseup", {rng:this.rng,rngNo:i}, function(e) {
					var	rng		=	(window.getSelection) ? this.getSelection() : this.selection.createRange();
					e.data.rng[e.data.rngNo]	=	rng;
				});

				//	1=툴바전체출력, 2=글꼴/정렬메뉴출력, 3=글꼴/기능메뉴출력, 4=글꼴메뉴출력
				var	_tbst		=	($(_torg).attr("lang").substring(9,10)) ? $(_torg).attr("lang").substring(9,10) : 1;
				var	_tbsrc		=	($(_torg).attr("lang").substring(10,11)) ? $(_torg).attr("lang").substring(10,11) : 1;
				//	툴바 출력
				var _tbars		=	this.toolber(_tbst, _tbsrc, i);
				$(this._ifrm[i]).before(_tbars);
			}
		}
		if(this._ejFocus == true && this._ejFcsId != null) {
			$("#_ejt" + this._ejFcsId).focus();
		}
	},
	cEvt : function (e, c) {
		e = e || window.event;
		e.returnValue = false;
		if(e.preventDefault) e.preventDefault();
		if(c) {
			e.cancelBubble = true;
			if(e.stopPropagation) e.stopPropagation();
		}
	},
	toolber : function(ts, is, i) {
		var	_zidx	=	999 - i;
		var _tbar	=	'';
		//	_tbar start
		_tbar		+=	'<ul class="ej-edt-menu">';
		if(is == 1) {
			//	source & editor change
			if(this._ej_menu_prt[0] == true) {
				_tbar		+=	'<li style="float:left; list-style:none; margin:0; padding:0 3px 0 0; z-index:' + _zidx + ';">';
				_tbar		+=	'<a href="javascript:;" onclick="ejEditor.mode(\''+this._tarea[i]+'\',\''+i+'\');" title="소스편집" id="_modeSrc'+i+'"><img src="'+this._ejBtn+'/btn_source.gif" border="0" alt="소스편집" /></a>';
				_tbar		+=	'<a href="javascript:;" onclick="ejEditor.mode(\''+this._tarea[i]+'\',\''+i+'\');" title="에디터" id="_modeEdt'+i+'" style="display:none;"><img src="'+this._ejBtn+'/btn_editor.gif" border="0" alt="에디터" /></a>';
				_tbar		+=	'</li>';
			}
			//	글꼴선택
			if(this._ej_menu_prt[1] == true) {
				_tbar		+=	'<li style="position:relative; float:left; list-style:none; margin:0; padding:0; z-index:' + _zidx + ';">';
				_tbar		+=	'<a href="javascript:;" onclick="ejEditor.layShow('+i+',\'font'+i+'\');" title="글꼴선택"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_font_family.gif" border="0" alt="글꼴선택" /></a>';
				_tbar		+=	'<div id="'+this._ejPfx+'font'+i+'" style="position:absolute; top:20px; left:0; width:130px; overflow:hidden; border:1px solid #ccc; background:#f5f5f5; display:none;">';
				_tbar		+=	'<ul style="list-style:none; margin:0; padding:0;">';
				for(var c = 0; c < this._ffont.length; c++) {
					_tbar	+=	'<li style="list-style:none; margin:0; padding:0;"><a href="javascript:;" onclick="ejEditor.action(\'fontname\',false,\''+this._ffont[c]+'\',\''+i+'\');" class="ej-edt-a1" style="height:18px; font:normal 12px/18px '+this._ffont[c]+';">'+this._tfont[c]+'</a></li>';
				}
				_tbar		+=	'</ul>';
				_tbar		+=	'</div>';
				_tbar		+=	'</li>';
			}
			//	폰트사이즈
			if(this._ej_menu_prt[2] == true) {
				_tbar		+=	'<li style="position:relative; float:left; list-style:none; margin:0 0 0 -1px; padding:0 3px 0 0; z-index:' + _zidx + ';">';
				_tbar		+=	'<a href="javascript:;" onclick="ejEditor.layShow('+i+',\'size'+i+'\');" title="글꼴크기"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_font_size.gif" border="0" alt="글꼴크기" /></a>';
				_tbar		+=	'<div id="'+this._ejPfx+'size'+i+'" style="position:absolute; top:20px; left:0; width:250px; overflow:hidden; border:1px solid #ccc; background:#f5f5f5; display:none;">';
				_tbar		+=	'<ul style="list-style:none; margin:0; padding:0;">';
				for(var c = 0; c < this._tfsize.length; c++) {
					_tbar	+=	'<li style="list-style:none; margin:0; padding:0;"><a href="javascript:;" onclick="ejEditor.action(\'fontsize\',false,\''+this._fsreal[c]+'\',\''+i+'\');" class="ej-edt-a1" style="height:'+this._fslh[c]+'px; font:normal '+this._tfsize[c]+'px/'+this._fslh[c]+'px gulim;">가나다ABCDabcd ('+this._tfsize[c]+'px)</a></li>';
				}
				_tbar		+=	'</ul>';
				_tbar		+=	'</div>';
				_tbar		+=	'</li>';
			}
			///////////////////////////////////// 여기부터 기본출력버튼 //////////////////////////////////////////
			//	전경색선택
			if(this._ej_menu_prt[3] == true) {
				_tbar		+=	'<li style="position:relative; float:left; list-style:none; margin:0; padding:0; z-index:' + _zidx + ';">';
				_tbar		+=	'<a href="javascript:;" onclick="ejEditor.layShow('+i+',\'fcolor'+i+'\');" title="전경색"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_font_color.gif" border="0" alt="전경색" /></a>';
				_tbar		+=	'<div id="'+this._ejPfx+'fcolor'+i+'" style="position:absolute; top:20px; left:0; width:158px; border:1px solid #ccc; background:#f5f5f5; display:none;">';
				_tbar		+=	'<ul style="list-style:none; width:142px; margin:8px; padding:0; overflow:hidden;">';
				for(var c = 0; c < this._ejcolor.length; c++) {
					_tbar	+=	'<li style="float:left; list-style:none; margin:1px; padding:0;"><a href="javascript:;" onclick="ejEditor.action(\'forecolor\',false,\'#'+this._ejcolor[c]+'\',\''+i+'\');" class="ej-edt-a2" style="background-color:#'+this._ejcolor[c]+';" title="'+this._ejcolor[c]+'"><img src="'+this._ejBtn+'/btn_blank.gif" width="12" height="12" border="0" alt="'+this._ejcolor[c]+'" /></a></li>';
				}
				_tbar		+=	'</ul>';
				_tbar		+=	'</div>';
				_tbar		+=	'</li>';
			}
			//	배경색선택
			if(this._ej_menu_prt[4] == true) {
				_tbar		+=	'<li style="position:relative; float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
				_tbar		+=	'<a href="javascript:;" onclick="ejEditor.layShow('+i+',\'bcolor'+i+'\');" title="배경색"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_back_color.gif" border="0" alt="배경색" /></a>';
				_tbar		+=	'<div id="'+this._ejPfx+'bcolor'+i+'" style="position:absolute; top:20px; left:0; width:158px; border:1px solid #ccc; background:#f5f5f5; display:none;">';
				_tbar		+=	'<ul style="list-style:none; width:142px; margin:8px; padding:0; overflow:hidden;">';
				for(var c = 0; c < this._ejcolor.length; c++) {
					_tbar	+=	'<li style="float:left; list-style:none; margin:1px; padding:0;"><a href="javascript:;" onclick="ejEditor.action(\'backcolor\',false,\'#'+this._ejcolor[c]+'\',\''+i+'\');" class="ej-edt-a2" style="background-color:#'+this._ejcolor[c]+';" title="'+this._ejcolor[c]+'"><img src="'+this._ejBtn+'/btn_blank.gif" width="12" height="12" border="0" alt="'+this._ejcolor[c]+'" /></a></li>';
				}
				_tbar		+=	'</ul>';
				_tbar		+=	'</div>';
				_tbar		+=	'</li>';
			}
			//	굵게
			if(this._ej_menu_prt[5] == true) {
				_tbar		+=	'<li style="float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
				_tbar		+=	'<a href="javascript:;" onclick="ejEditor.action(\'bold\',false,null,\''+i+'\');" title="굵게"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_bold.gif" border="0" alt="굵게" /></a>';
				_tbar		+=	'</li>';
			}
			//	이탤릭
			if(this._ej_menu_prt[6] == true) {
				_tbar		+=	'<li style="float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
				_tbar		+=	'<a href="javascript:;" onclick="ejEditor.action(\'italic\',false,null,\''+i+'\');" title="기울임"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_emphasis.gif" border="0" alt="기울임" /></a>';
				_tbar		+=	'</li>';
			}
			//	밑줄
			if(this._ej_menu_prt[7] == true) {
				_tbar		+=	'<li style="float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
				_tbar		+=	'<a href="javascript:;" onclick="ejEditor.action(\'underline\',false,null,\''+i+'\');" title="밑줄"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_underline.gif" border="0" alt="밑줄" /></a>';
				_tbar		+=	'</li>';
			}
			//	취소선
			if(this._ej_menu_prt[8] == true) {
				_tbar		+=	'<li style="float:left; list-style:none; margin:0 0 0 -1px; padding:0 3px 0 0; z-index:' + _zidx + ';">';
				_tbar		+=	'<a href="javascript:;" onclick="ejEditor.action(\'StrikeThrough\',false,null,\''+i+'\');" title="취소선"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_strike.gif" border="0" alt="취소선" /></a>';
				_tbar		+=	'</li>';
			}
			///////////////////////////////////// 여기까지 기본출력버튼 //////////////////////////////////////////
			if(ts == 1 || ts == 2) {
				///////////////////////////////////// 여기부터 정렬/간격버튼 //////////////////////////////////////////
				//	왼쪽정렬
				if(this._ej_menu_prt[9] == true) {
					_tbar		+=	'<li style="float:left; list-style:none; margin:0; padding:0; z-index:' + _zidx + ';">';
					_tbar		+=	'<a href="javascript:;" onclick="ejEditor.action(\'justifyleft\',false,null,\''+i+'\');" title="왼쪽정렬"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_align_left.gif" border="0" alt="왼쪽정렬" /></a>';
					_tbar		+=	'</li>';
				}
				//	중앙정렬
				if(this._ej_menu_prt[10] == true) {
					_tbar		+=	'<li style="float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
					_tbar		+=	'<a href="javascript:;" onclick="ejEditor.action(\'justifycenter\',false,null,\''+i+'\');" title="중앙정렬"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_align_center.gif" border="0" alt="중앙정렬" /></a>';
					_tbar		+=	'</li>';
				}
				//	우측정렬
				if(this._ej_menu_prt[11] == true) {
					_tbar		+=	'<li style="float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
					_tbar		+=	'<a href="javascript:;" onclick="ejEditor.action(\'justifyright\',false,null,\''+i+'\');" title="우측정렬"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_align_right.gif" border="0" alt="우측정렬" /></a>';
					_tbar		+=	'</li>';
				}
				//	양쪽정렬
				if(this._ej_menu_prt[12] == true) {
					_tbar		+=	'<li style="float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
					_tbar		+=	'<a href="javascript:;" onclick="ejEditor.action(\'justifyfull\',false,null,\''+i+'\');" title="양쪽정렬"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_align_justify.gif" border="0" alt="양쪽정렬" /></a>';
					_tbar		+=	'</li>';
				}
				//	들여쓰기
				if(this._ej_menu_prt[13] == true) {
					_tbar		+=	'<li style="float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
					_tbar		+=	'<a href="javascript:;" onclick="ejEditor.action(\'indent\',false,null,\''+i+'\');" title="들여쓰기"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_indent.gif" border="0" alt="들여쓰기" /></a>';
					_tbar		+=	'</li>';
				}
				//	내어쓰기
				if(this._ej_menu_prt[14] == true) {
					_tbar		+=	'<li style="float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
					_tbar		+=	'<a href="javascript:;" onclick="ejEditor.action(\'outdent\',false,null,\''+i+'\');" title="내어쓰기"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_outdent.gif" border="0" alt="내어쓰기" /></a>';
					_tbar		+=	'</li>';
				}
				//	순서없는목록
				if(this._ej_menu_prt[15] == true) {
					_tbar		+=	'<li style="float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
					_tbar		+=	'<a href="javascript:;" onclick="ejEditor.action(\'insertunorderedlist\',false,null,\''+i+'\');" title="순서없는목록"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_unord_list.gif" border="0" alt="순서없는목록" /></a>';
					_tbar		+=	'</li>';
				}
				//	순서있는목록
				if(this._ej_menu_prt[16] == true) {
					_tbar		+=	'<li style="float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
					_tbar		+=	'<a href="javascript:;" onclick="ejEditor.action(\'insertorderedlist\',false,null,\''+i+'\');" title="순서있는목록"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_ord_list.gif" border="0" alt="순서있는목록" /></a>';
					_tbar		+=	'</li>';
				}
				//	줄간격
				if(this._ej_menu_prt[17] == true) {
					_tbar		+=	'<li style="position:relative; float:left; list-style:none; margin:0 0 0 -1px; padding:0 3px 0 0; z-index:' + _zidx + ';">';
					_tbar		+=	'<a href="javascript:;" onclick="ejEditor.layShow('+i+',\'lheight'+i+'\');" title="줄간격"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_line_height.gif" border="0" alt="줄간격" /></a>';
					_tbar		+=	'<div id="'+this._ejPfx+'lheight'+i+'" style="position:absolute; top:20px; left:0; width:60px; overflow:hidden; border:1px solid #ccc; background:#f5f5f5; display:none;">';
					_tbar		+=	'<ul style="list-style:none; margin:0; padding:0;">';
					for(var c = 0; c < this._lheight.length; c++) {
						_tbar	+=	'<li style="list-style:none; margin:0; padding:0;"><a href="javascript:;" onclick="ejEditor.lheight(\''+this._tarea[i]+'\',\''+i+'\',\''+this._lheight[c]+'\');" class="ej-edt-a1" style="height:18px; font:normal 12px/18px gulim;">'+this._lheight[c]+'</a></li>';
					}
					_tbar		+=	'</ul>';
					_tbar		+=	'</div>';
				}
				///////////////////////////////////// 여기까지 정렬/간격버튼 //////////////////////////////////////////
			}

			if(ts == 1 || ts == 3) {
				///////////////////////////////////// 여기까지 추가기능버튼 //////////////////////////////////////////
				//	링크
				if(this._ej_menu_prt[18] == true) {
					_tbar		+=	'<li style="position:relative; float:left; list-style:none; margin:0; padding:0; z-index:' + _zidx + ';">';
					_tbar		+=	'<a href="javascript:;" onclick="ejEditor.layShow('+i+',\'link'+i+'\');" title="링크"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_url.gif" border="0" alt="링크" /></a>';
					_tbar		+=	'<div id="'+this._ejPfx+'link'+i+'" class="ej-edt-pop-wrap" style="position:absolute; top:20px; left:-120px; width:250px; overflow:hidden; border:1px solid #ccc; background:#f5f5f5; display:none;">';
					_tbar		+=	'<fieldset>';
					_tbar		+=	'<legend>링크추가</legend>';
					_tbar		+=	'<dl>';
					_tbar		+=	'<dt>U R L</dt>';
					_tbar		+=	'<dd class="once"><input id="'+this._ejPfx+'frm-linkurl'+i+'" type="text" class="ej-inp long" /></dd>';
					_tbar		+=	'</dl>';
					_tbar		+=	'<dl>';
					_tbar		+=	'<dt>텍스트</dt>';
					_tbar		+=	'<dd class="once"><input id="'+this._ejPfx+'frm-lintext'+i+'" type="text" class="ej-inp long" /></dd>';
					_tbar		+=	'</dl>';
					_tbar		+=	'<dl>';
					_tbar		+=	'<dt>타 겟</dt>';
					_tbar		+=	'<dd class="once">';
					_tbar		+=	'<input id="'+this._ejPfx+'frm-target1'+i+'" name="'+this._ejPfx+'frm-target'+i+'" type="radio" checked="checked" /> <label for="'+this._ejPfx+'frm-target1'+i+'">새창</label> &nbsp;';
					_tbar		+=	'<input id="'+this._ejPfx+'frm-target2'+i+'" name="'+this._ejPfx+'frm-target'+i+'" type="radio" /> <label for="'+this._ejPfx+'frm-target2'+i+'">현재창</label>';
					_tbar		+=	'</dd>';
					_tbar		+=	'</dl>';
					_tbar		+=	'</fieldset>';
					_tbar		+=	'<div class="ej-edt-btn_area">';
					_tbar		+=	'<input type="button" value="적용" class="ej-edt-pop-btn" onclick="ejEditor.ins_link('+i+');" />&nbsp;';
					_tbar		+=	'<input type="button" value="취소" class="ej-edt-pop-btn" onclick="ejEditor.layClose();" />';
					_tbar		+=	'</div>';
					_tbar		+=	'</div>';
					_tbar		+=	'</li>';
				}
				//	테이블
				if(this._ej_menu_prt[19] == true) {
					var	stblLf	=	(this._ejDMap) ? -120 : -123;
					_tbar		+=	'<li style="position:relative; float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
					_tbar		+=	'<a href="javascript:;" onclick="ejEditor.layShow('+i+',\'table'+i+'\');" title="테이블"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_table.gif" border="0" alt="테이블" /></a>';
					_tbar		+=	'<div id="'+this._ejPfx+'table'+i+'" class="ej-edt-pop-wrap" style="position:absolute; top:20px; left:'+stblLf+'px; width:260px; overflow:hidden; border:1px solid #ccc; background:#f5f5f5; display:none;">';
					_tbar		+=	'<fieldset>';
					_tbar		+=	'<legend>테이블추가</legend>';
					_tbar		+=	'<dl>';
					_tbar		+=	'<dt>가로셀</dt>';
					_tbar		+=	'<dd class="double"><input id="'+this._ejPfx+'frm-tblcols'+i+'" type="text" value="3" maxlength="2" class="ej-inp short" onblur="ejEdtOnlyNo(this);" /> 개</dd>';
					_tbar		+=	'<dt>세로셀</dt>';
					_tbar		+=	'<dd class="double"><input id="'+this._ejPfx+'frm-tblrows'+i+'" type="text" value="3" maxlength="2" class="ej-inp short" onblur="ejEdtOnlyNo(this);" /> 개</dd>';
					_tbar		+=	'</dl>';
					_tbar		+=	'<dl>';
					_tbar		+=	'<dt>안쪽여백</dt>';
					_tbar		+=	'<dd class="double"><input id="'+this._ejPfx+'frm-tblcpad'+i+'" type="text" maxlength="2" class="ej-inp short" onblur="ejEdtOnlyNo(this);" /> px</dd>';
					_tbar		+=	'<dt>셀여백</dt>';
					_tbar		+=	'<dd class="double"><input id="'+this._ejPfx+'frm-tblspac'+i+'" type="text" maxlength="2" class="ej-inp short" onblur="ejEdtOnlyNo(this);" /> px</dd>';
					_tbar		+=	'</dl>';
					_tbar		+=	'<dl>';
					_tbar		+=	'<dt>정렬</dt>';
					_tbar		+=	'<dd class="double">';
					_tbar		+=	'<select id="'+this._ejPfx+'frm-tblagn'+i+'">';
					_tbar		+=	'<option value="left">left</option>';
					_tbar		+=	'<option value="center">center</option>';
					_tbar		+=	'<option value="right">right</option>';
					_tbar		+=	'<dd class="double"></dd>';
					_tbar		+=	'</select>';
					_tbar		+=	'</dd>';
					_tbar		+=	'<dt>테두리</dt>';
					_tbar		+=	'<dd class="double"><input id="'+this._ejPfx+'frm-tblbrd'+i+'" value="1" maxlength="2" class="ej-inp short" onblur="ejEdtOnlyNo(this);" /></dd>';
					_tbar		+=	'</dl>';
					_tbar		+=	'<dl>';
					_tbar		+=	'<dt>가로</dt>';
					_tbar		+=	'<dd class="double"><input id="'+this._ejPfx+'frm-tblwdt'+i+'" type="text" maxlength="3" class="ej-inp short" onblur="ejEdtOnlyNo(this);" /> px</dd>';
					_tbar		+=	'<dt>세로</dt>';
					_tbar		+=	'<dd class="double"><input id="'+this._ejPfx+'frm-tblhet'+i+'" type="text" maxlength="3" class="ej-inp short" onblur="ejEdtOnlyNo(this);" /> px</dd>';
					_tbar		+=	'</dl>';
					_tbar		+=	'</fieldset>';
					_tbar		+=	'<div class="ej-edt-btn_area">';
					_tbar		+=	'<input type="button" value="적용" class="ej-edt-pop-btn" onclick="ejEditor.ins_tbl('+i+');" />&nbsp;';
					_tbar		+=	'<input type="button" value="취소" class="ej-edt-pop-btn" onclick="ejEditor.layClose();" />';
					_tbar		+=	'</div>';
					_tbar		+=	'</div>';
					_tbar		+=	'</li>';
				}
				//	이미지
				if(this._ej_menu_prt[20] == true) {
					var	simgLf	=	(this._ejDMap) ? -130 : -163;
					_tbar		+=	'<li style="position:relative; float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
					_tbar		+=	'<a href="javascript:;" onclick="ejEditor.layShow('+i+',\'image'+i+'\');" title="이미지"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_image.gif" border="0" alt="이미지" /></a>';
					_tbar		+=	'<div id="'+this._ejPfx+'image'+i+'" class="ej-edt-pop-wrap" style="position:absolute; top:20px; left:'+simgLf+'px; width:280px; overflow:hidden; border:1px solid #ccc; background:#f5f5f5; display:none;">';
						_tbar		+=	'<ul style="list-style:none; width:260px; height:150px; margin:8px; padding:0 0 0 1px; overflow:hidden;">';
							_tbar		+=	'<li style="float:left; list-style:none; padding:0;"><a href="javascript:;" onclick="ejEditor.img_ajax(\'url\', \''+i+'\');" id="'+this._ejPfx+'img-tab-url'+i+'" class="ej-edt-tab1 ej-edt-tab-on">URL등록</a>';
								_tbar		+=	'<div id="ej_image_url' + i + '" style="position:absolute; top:30px; left:0px; width:278px; list-style:none; display:block;">';
								_tbar		+=	'<fieldset>';
								_tbar		+=	'<legend>이미지등록</legend>';
								_tbar		+=	'<dl>';
								_tbar		+=	'<dt>U R L</dt>';
								_tbar		+=	'<dd class="u-once"><input id="'+this._ejPfx+'frm-imgurl'+i+'" type="text" class="ej-inp long" /></dd>';
								_tbar		+=	'</dl>';
								_tbar		+=	'<dl>';
								_tbar		+=	'<dt>가로</dt>';
								_tbar		+=	'<dd class="double"><input id="'+this._ejPfx+'frm-imgwdt'+i+'" type="text" maxlength="4" class="ej-inp short" onblur="ejEdtOnlyNo(this);" /> px</dd>';
								_tbar		+=	'<dt>세로</dt>';
								_tbar		+=	'<dd class="double"><input id="'+this._ejPfx+'frm-imghet'+i+'" type="text" maxlength="4" class="ej-inp short" onblur="ejEdtOnlyNo(this);" /> px</dd>';
								_tbar		+=	'<dt style="clear:both;">정렬</dt>';
								_tbar		+=	'<dd class="u-once">';
								_tbar		+=	'<select id="'+this._ejPfx+'frm-imgflt'+i+'">';
								_tbar		+=	'<option value="">없음</option>';
								_tbar		+=	'<option value="left">왼쪽</option>';
								_tbar		+=	'<option value="right">오른쪽</option>';
								_tbar		+=	'</select>';
								_tbar		+=	'</dd>';
								_tbar		+=	'</dl>';
								_tbar		+=	'</fieldset>';
								_tbar		+=	'<div class="ej-edt-btn_area">';
								_tbar		+=	'<input type="button" value="적용" class="ej-edt-pop-btn" onclick="ejEditor.ins_img('+i+');" />&nbsp;';
								_tbar		+=	'<input type="button" value="취소" class="ej-edt-pop-btn" onclick="ejEditor.layClose();" />';
								_tbar		+=	'</div>';
								_tbar		+=	'</div>';
							_tbar		+=	'</li>';
							_tbar		+=	'<li style="float:left; list-style:none; padding:0;"><a href="javascript:;" onclick="ejEditor.img_ajax(\'up\', \''+i+'\');" id="'+this._ejPfx+'img-tab-up'+i+'" class="ej-edt-tab1">직접등록</a>';
								_tbar		+=	'<div id="ej_image_up' + i + '" style="position:absolute; top:30px; left:0px; width:278px; list-style:none; display:none;">';
								_tbar		+=	'<fieldset>';
								_tbar		+=	'<legend>이미지업로드</legend>';
								_tbar		+=	'<dl style="float:left; width:135px;">';
								_tbar		+=	'<dt style="clear:both;">등록</dt>';
								_tbar		+=	'<dd class="upload"><input id="ej_img_up_btn' + i + '" type="button" value="찾아보기" style="width:70px; height:20px; font-size:11px;" class="ej-edt-pop-btn" /></dd>';
								_tbar		+=	'<dt style="clear:both;">가로</dt>';
								_tbar		+=	'<dd class="upload"><input id="'+this._ejPfx+'frm-upimgwdt'+i+'" type="text" maxlength="4" class="ej-inp short" onblur="ejEdtOnlyNo(this);" /> px</dd>';
								_tbar		+=	'<dt style="clear:both;">세로</dt>';
								_tbar		+=	'<dd class="upload"><input id="'+this._ejPfx+'frm-upimghet'+i+'" type="text" maxlength="4" class="ej-inp short" onblur="ejEdtOnlyNo(this);" /> px</dd>';
								_tbar		+=	'<dt style="clear:both;">정렬</dt>';
								_tbar		+=	'<dd class="upload">';
								_tbar		+=	'<select id="'+this._ejPfx+'frm-upimgflt'+i+'">';
								_tbar		+=	'<option value="">없음</option>';
								_tbar		+=	'<option value="left">왼쪽</option>';
								_tbar		+=	'<option value="right">오른쪽</option>';
								_tbar		+=	'</select>';
								_tbar		+=	'</dd>';
								_tbar		+=	'</dl>';
								_tbar		+=	'<p id="ej_img_up_preview' + i + '" class="preview">미리보기</p>';
								_tbar		+=	'</fieldset>';
								_tbar		+=	'<div class="ej-edt-btn_area">';
								_tbar		+=	'<input type="button" value="적용" class="ej-edt-pop-btn" onclick="ejEditor.ins_upimg('+i+');" />&nbsp;';
								_tbar		+=	'<input type="button" value="취소" class="ej-edt-pop-btn" onclick="ejEditor.layClose();" />';
								_tbar		+=	'</div>';
								_tbar		+=	'</div>';
							_tbar		+=	'</li>';
						_tbar		+=	'</ul>';
					_tbar		+=	'</div>';
					_tbar		+=	'</li>';
				}
				//	동영상
				if(this._ej_menu_prt[21] == true) {
					var	smovLf	=	(this._ejDMap) ? -145 : -183;
					_tbar		+=	'<li style="position:relative; float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
					_tbar		+=	'<a href="javascript:;" onclick="ejEditor.layShow('+i+',\'movie'+i+'\');" title="동영상"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_movie.gif" border="0" alt="동영상" /></a>';
					_tbar		+=	'<div id="'+this._ejPfx+'movie'+i+'" class="ej-edt-pop-wrap" style="position:absolute; top:20px; left:'+smovLf+'px; width:280px; overflow:hidden; border:1px solid #ccc; background:#f5f5f5; display:none;">';
					_tbar		+=	'<fieldset>';
					_tbar		+=	'<legend>동영상등록</legend>';
					_tbar		+=	'<dl>';
					_tbar		+=	'<dt>U R L</dt>';
					_tbar		+=	'<dd class="u-once"><input id="'+this._ejPfx+'frm-movurl'+i+'" type="text" class="ej-inp long" /></dd>';
					_tbar		+=	'</dl>';
					_tbar		+=	'<dl>';
					_tbar		+=	'<dt>가로</dt>';
					_tbar		+=	'<dd class="double"><input id="'+this._ejPfx+'frm-movwdt'+i+'" type="text" maxlength="3" class="ej-inp short" onblur="ejEditor.onlyno(this);" /> px</dd>';
					_tbar		+=	'<dt>세로</dt>';
					_tbar		+=	'<dd class="double"><input id="'+this._ejPfx+'frm-movhet'+i+'" type="text" maxlength="3" class="ej-inp short" onblur="ejEditor.onlyno(this);" /> px</dd>';
					_tbar		+=	'</dl>';
					_tbar		+=	'</fieldset>';
					_tbar		+=	'<div class="ej-edt-btn_area">';
					_tbar		+=	'<input type="button" value="적용" class="ej-edt-pop-btn" onclick="ejEditor.ins_mov('+i+');" />&nbsp;';
					_tbar		+=	'<input type="button" value="취소" class="ej-edt-pop-btn" onclick="ejEditor.layClose();" />';
					_tbar		+=	'</div>';
					_tbar		+=	'</div>';
					_tbar		+=	'</li>';
				}
				//	플래시
				if(this._ej_menu_prt[22] == true) {
					var	sflaLf	=	(this._ejDMap) ? -165 : -203;
					_tbar		+=	'<li style="position:relative; float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
					_tbar		+=	'<a href="javascript:;" onclick="ejEditor.layShow(\''+i+'\',\'flash'+i+'\');" title="플래시"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_flash.gif" border="0" alt="플래시" /></a>';
					_tbar		+=	'<div id="'+this._ejPfx+'flash'+i+'" class="ej-edt-pop-wrap" style="position:absolute; top:20px; left:'+sflaLf+'px; width:280px; overflow:hidden; border:1px solid #ccc; background:#f5f5f5; display:none;">';
					_tbar		+=	'<fieldset>';
					_tbar		+=	'<legend>플래시등록</legend>';
					_tbar		+=	'<dl>';
					_tbar		+=	'<dt>U R L</dt>';
					_tbar		+=	'<dd class="u-once"><input id="'+this._ejPfx+'frm-swfurl'+i+'" type="text" class="ej-inp long" /></dd>';
					_tbar		+=	'</dl>';
					_tbar		+=	'<dl>';
					_tbar		+=	'<dt>가로</dt>';
					_tbar		+=	'<dd class="double"><input id="'+this._ejPfx+'frm-swfwdt'+i+'" type="text" maxlength="3" class="ej-inp short" onblur="ejEditor.onlyno(this);" /> px</dd>';
					_tbar		+=	'<dt>세로</dt>';
					_tbar		+=	'<dd class="double"><input id="'+this._ejPfx+'frm-swfhet'+i+'" type="text" maxlength="3" class="ej-inp short" onblur="ejEditor.onlyno(this);" /> px</dd>';
					_tbar		+=	'</dl>';
					_tbar		+=	'</fieldset>';
					_tbar		+=	'<div class="ej-edt-btn_area">';
					_tbar		+=	'<input type="button" value="적용" class="ej-edt-pop-btn" onclick="ejEditor.ins_swf('+i+');" />&nbsp;';
					_tbar		+=	'<input type="button" value="취소" class="ej-edt-pop-btn" onclick="ejEditor.layClose();" />';
					_tbar		+=	'</div>';
					_tbar		+=	'</div>';
					_tbar		+=	'</li>';
				}
				//	인용구
				if(this._ej_menu_prt[23] == true) {
					var	squotLf	=	(this._ejDMap) ? -155 : -193;
					_tbar		+=	'<li style="position:relative; float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
					_tbar		+=	'<a href="javascript:;" onclick="ejEditor.layShow('+i+',\'quote'+i+'\');" title="인용구"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_quote.gif" border="0" alt="인용구" /></a>';
					_tbar		+=	'<div id="'+this._ejPfx+'quote'+i+'" class="ej-edt-pop-wrap" style="position:absolute; top:20px; left:'+squotLf+'px; width:250px; overflow:hidden; border:1px solid #ccc; background:#f5f5f5; display:none;">';
					_tbar		+=	'<div class="ej-quote-div" style="border:1px solid #ff0000; background:#ffe6e6;"><a href="javascript:;" onclick="ejEditor.ins_qut('+i+',\'ff0000\',\'ffe6e6\');"><span></span></a></div>';
					_tbar		+=	'<div class="ej-quote-div" style="border:1px solid #0078ff; background:#c8ffff;"><a href="javascript:;" onclick="ejEditor.ins_qut('+i+',\'0078ff\',\'c8ffff\');"><span></span></a></div>';
					_tbar		+=	'<div class="ej-quote-div" style="border:1px solid #ff8200; background:#fafad2;"><a href="javascript:;" onclick="ejEditor.ins_qut('+i+',\'ff8200\',\'fafad2\');"><span></span></a></div>';
					_tbar		+=	'<div class="ej-quote-div" style="border:1px solid #1e821e; background:#c6ff70;"><a href="javascript:;" onclick="ejEditor.ins_qut('+i+',\'1e821e\',\'c6ff70\');"><span></span></a></div>';
					_tbar		+=	'<div class="ej-quote-div" style="border:1px solid #9400d3; background:#ffdcff;"><a href="javascript:;" onclick="ejEditor.ins_qut('+i+',\'9400d3\',\'ffdcff\');"><span></span></a></div>';
					_tbar		+=	'</div>';
					_tbar		+=	'</li>';
				}
				//	이모티콘
				if(this._ej_menu_prt[24] == true && this._ejemot && this._ejemot.length > 0) {
					var	semoLf	=	(this._ejDMap) ? -80 : -118;
					_tbar		+=	'<li style="position:relative; float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
					_tbar		+=	'<a href="javascript:;" onclick="ejEditor.layShow('+i+',\'emoticon'+i+'\');" title="이모티콘"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_emoticon.gif" border="0" alt="이모티콘" /></a>';
					_tbar		+=	'<div id="'+this._ejPfx+'emoticon'+i+'" class="ej-edt-pop-wrap" style="position:absolute; top:20px; left:'+semoLf+'px; width:155px; border:1px solid #ccc; background:#f5f5f5; display:none;">';
					_tbar		+=	'<ul style="list-style:none; width:140px; height:100px; margin:8px; padding:0 0 0 1px; overflow:hidden;">';
					for(var c = 0; c < this._ejemot.length; c++) {
						_tbar	+=	'<li style="float:left; list-style:none; margin:1px; padding:0;"><a href="javascript:;" onclick="ejEditor.ins_emo('+i+',\''+this._ejemot[c]+'\');" class="ej-edt-a3" title="emo_'+this._ejemot[c]+'"><img src="'+this._ejEmo+"/emo_"+this._ejemot[c]+'" align="middle" border="0" /></a></li>';
					}
					_tbar		+=	'</ul>';
					_tbar		+=	'</div>';
					_tbar		+=	'</li>';
				}
				//	특수문자
				if(this._ej_menu_prt[25] == true && this._schar && this._schar.length > 0) {
					var	scharLf	=	(this._ejDMap) ? -235 : -273;
					_tbar		+=	'<li style="position:relative; float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
					_tbar		+=	'<a href="javascript:;" onclick="ejEditor.layShow('+i+',\'special'+i+'\');" title="특수문자"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_specialchar_'+((this._ejDMap) ? "off":"on")+'.gif" border="0" alt="특수문자" /></a>';
					_tbar		+=	'<div id="'+this._ejPfx+'special'+i+'" class="ej-edt-pop-wrap" style="position:absolute; top:20px; left:'+scharLf+'px; width:290px; border:1px solid #ccc; background:#f5f5f5; display:none;">';
					_tbar		+=	'<ul style="list-style:none; width:278px; height:150px; margin:8px; padding:0 0 0 1px; overflow:hidden;">';
					for(var c = 0; c < this._schar.length; c++) {
						var	dis	=	(c == 0)	?	"block" : "none";
						var	css	=	(c == 0)	?	" ej-edt-tab-on" : "";
						_tbar	+=	'<li style="float:left; list-style:none; padding:0;"><a href="javascript:ejEditor.sel_tab(\''+i+'\',\''+c+'\');" id="'+this._ejPfx+'spec-tab'+i+"-"+c+'" class="ej-edt-tab2'+css+'">문자' + (c + 1) + '</a>';
						_tbar	+=	'<ul id="ej_special_' + i + c + '" style="position:absolute; top:30px; left:-32px; width:278px; list-style:none; display:' + dis + ';">';
						for(var s = 0; s < this._schar[c].length; s++) {
							_tbar	+=	'<li style="float:left; list-style:none; margin:1px; padding:0;"><a href="javascript:ejEditor.sel_chr(\''+this._ejPfx+'frm-specialchar'+i+'\',\''+this._schar[c][s]+'\');" class="ej-edt-a4" title="'+this._schar[c][s]+'">'+this._schar[c][s]+'</a></li>';
						}
						_tbar	+=	'</ul>';
						_tbar	+=	'</li>';
					}
					_tbar		+=	'</ul>';
					_tbar		+=	'<fieldset>';
					_tbar		+=	'<legend>특수문자 입력</legend>';
					_tbar		+=	'<dl>';
					_tbar		+=	'<dt>선택문자</dt>';
					_tbar		+=	'<dd class="u-once"><input id="'+this._ejPfx+'frm-specialchar'+i+'" type="text" class="ej-no-inp long" readonly="readonly" /></dd>';
					_tbar		+=	'</dl>';
					_tbar		+=	'</fieldset>';
					_tbar		+=	'<div class="ej-edt-btn_area">';
					_tbar		+=	'<input type="button" value="적용" class="ej-edt-pop-btn" onclick="ejEditor.ins_chr('+i+');" />&nbsp;';
					_tbar		+=	'<input type="button" value="취소" class="ej-edt-pop-btn" onclick="ejEditor.layClose();" />';
					_tbar		+=	'</div>';
					_tbar		+=	'</div>';
					_tbar		+=	'</li>';
				}
				//	지도
				if(this._ejDMap) {
					_tbar		+=	'<li style="position:relative; float:left; list-style:none; margin:0 0 0 -1px; padding:0; z-index:' + _zidx + ';">';
					_tbar		+=	'<a href="javascript:;" onclick="alert(\'서비스 예정입니다.\');" title="지도"><img class="'+this._ejPfx+'btn'+i+'" src="'+this._ejBtn+'/btn_map.gif" border="0" alt="지도" /></a>';
					_tbar		+=	'</li>';
				}
				///////////////////////////////////// 여기까지 추가기능버튼 //////////////////////////////////////////
			}
		}
		_tbar		+=	'</ul>';
		return _tbar;
	},
	//	에디터모드 1=에디터, 0=소스편집
	mode : function(t, i) {
		this._gmode	=	1;
		//	view html
		if($('#_modeEdt'+i).css('display') == 'none') {
			this._gmode	=	0;
			ejEditor.layClose();
			//	이전에 띄웠던 레이어창 정보 비우기
			for(var x = 0; x < this._tCnt; x++) this._ejOld[x] = null;
			ejEditor.opacity(i,'0.3','disabled');
			$('#_ejt'+t).hide();
			$('#_modeSrc'+i).hide();
			$('#_modeEdt'+i).show();
			document.getElementsByName(t)[0].style.display				=	"block";
			document.getElementsByName(t)[0].value						=	document.getElementById('_ejt' + t).contentWindow.document.body.innerHTML;
			document.getElementsByName(t)[0].focus();
			$("#_resize_ejt" + t).hide();
		}
		else {
			this._gmode	=	1;
			ejEditor.opacity(i,'1.0','');
			$('#_ejt' + t).show();
			$('#_modeSrc'+i).show();
			$('#_modeEdt'+i).hide();
			document.getElementsByName(t)[0].style.display				=	"none";
			document.getElementById('_ejt' + t).contentWindow.document.body.innerHTML		=	document.getElementsByName(t)[0].value;
			document.getElementById('_ejt' + t).contentWindow.focus();
			$("#_resize_ejt" + t).show();
		}
	},
	//	opacity
	opacity : function(i, opa, dis) {
		$(".ej-edt-menu > li > a > img."+this._ejPfx+"btn"+i).css({"opacity":opa}).attr({"disabled":dis});
	},
	edt2html : function() {
		for(var i = 0; i < this._tarea.length; i++) {
			document.getElementsByName(this._tarea[i])[0].value	 =	document.getElementById("_ejt" + this._tarea[i]).contentWindow.document.body.innerHTML;
		}
	},
	html2edt : function() {
		for(var i = 0; i < this._tarea.length; i++) {
			document.getElementById("_ejt" + this._tarea[i]).contentWindow.document.body.innerHTML	=	document.getElementsByName(this._tarea[i])[0].value;
		}
	},
	//	기본 스타일
	action : function(exe, bool, value, i) {
		//ejOldLayer = "";
		if($(this._ifrm[i]).css('display') != 'none') {
			if(!$.browser.msie && exe == "backcolor")	exe = 'hilitecolor';
			this._ifrm[i].contentWindow.document.execCommand(exe, bool, value);
			ejEditor.edt2html();
			ejEditor.layClose();
		} else {
			ejEditor.layClose();
		}
	},
	//	줄간격
	lheight : function(t, i, lh) {
		if(document.selection)							var	txt	=	this.rng[i].htmlText;
		else if($.browser.safari || $.browser.opera)	var	txt	=	ejEditor.gscoHtml(t);
		else											var	txt	=	ejEditor.gffHtml(document.getElementById('_ejt' + t).contentWindow.document.getSelection());
		var	source	=	'<div style="line-height:' + lh + ';">' + txt + '</div><br />';
		ejEditor.ins_html(i, source);
		ejEditor.layClose();
	},
	//	ff
	gffHtml : function(html) {
		html		=	html.replace(new RegExp(/[<][^>]*[>]/gi),"");
		html		=	html.replace(/(\r\n|\r|\n)/ig, "<br />");
		return html;
	},
	//	safari & crome & opera
	gscoHtml : function(t) {
		var rng = null, html = "";
		if(document.getElementById('_ejt' + t).contentWindow.document.selection && document.getElementById('_ejt' + t).contentWindow.document.selection.createRange) {
			rng			=	document.getElementById('_ejt' + t).contentWindow.document.selection.createRange();
			html		=	document.getElementById('_ejt' + t).htmlText||"";
		}
		else if(document.getElementById('_ejt' + t).contentWindow.getSelection){
			rng			=	document.getElementById('_ejt' + t).contentWindow.getSelection();
			if(rng.rangeCount > 0 && document.getElementById('_ejt' + t).contentWindow.XMLSerializer) {
				rng		=	rng.getRangeAt(0);
				html	=	new XMLSerializer().serializeToString(rng.cloneContents());
			}
		}
		return html;
	},
	//	링크등록
	ins_link : function(i) {
		if($('#'+this._ejPfx+'frm-linkurl'+i).val() == "") {
			alert("링크URL을 입력하세요.");
			$('#'+this._ejPfx+'frm-linkurl'+i).focus();
			return false;
		}
		var	url		=	$('#'+this._ejPfx+'frm-linkurl'+i).val();
		var	name	=	($('#'+this._ejPfx+'frm-lintext'+i).val() != "") ? $('#'+this._ejPfx+'frm-lintext'+i).val() : $('#'+this._ejPfx+'frm-linkurl'+i).val();
		var	target	=	($('#'+this._ejPfx+'frm-target1'+i).is(":checked") == true) ? "_blank" : "_self";
		var	source	=	'<a href="' + url + '" target="' + target + '">' + name + '</a>';
		ejEditor.ins_html(i, source);
		$('#'+this._ejPfx+'frm-linkurl'+i).val("");
		$('#'+this._ejPfx+'frm-lintext'+i).val("");
		$('#'+this._ejPfx+'frm-target1'+i).attr("checked","checked");
		ejEditor.layClose();
	},
	//	테이블입력
	ins_tbl : function(i) {
		var cols=2, rows=2,	border=0, cpadding=-1, cspacing=-1, align, width, height;
		if($('#'+this._ejPfx+'frm-tblcols'+i).val() == "") {
			alert("가로개수를 입력하세요.");
			$('#'+this._ejPfx+'frm-tblcols'+i).focus();
			return false;
		}
		if($('#'+this._ejPfx+'frm-tblrows'+i).val() == "") {
			alert("세로개수를 입력하세요.");
			$('#'+this._ejPfx+'frm-tblrows'+i).focus();
			return false;
		}
		cols		=	$('#'+this._ejPfx+'frm-tblcols'+i).val();
		rows		=	$('#'+this._ejPfx+'frm-tblrows'+i).val();
		border		=	($('#'+this._ejPfx+'frm-tblbrd'+i).val())		?	$('#'+this._ejPfx+'frm-tblbrd'+i).val() : 0;
		cpadding	=	($('#'+this._ejPfx+'frm-tblcpad'+i).val())		?	$('#'+this._ejPfx+'frm-tblcpad'+i).val() : 0;
		cspacing	=	($('#'+this._ejPfx+'frm-tblspac'+i).val())		?	$('#'+this._ejPfx+'frm-tblspac'+i).val() : 0;
		align		=	($('#'+this._ejPfx+'frm-tblagn'+i).val())		?	$('#'+this._ejPfx+'frm-tblagn'+i).val() : "left";
		width		=	($('#'+this._ejPfx+'frm-tblwdt'+i).val())		?	$('#'+this._ejPfx+'frm-tblwdt'+i).val() : 400;
		height		=	($('#'+this._ejPfx+'frm-tblhet'+i).val())		?	$('#'+this._ejPfx+'frm-tblhet'+i).val() : (rows * 20);
		var	source	=	"";
		source		+=	'<table border="'+border+'" cellpadding="'+cpadding+'" cellspacing="'+cspacing+'" width="'+width+'" height="'+height+'">';
		for(var y = 0; y < rows; y++) {
			source += "<tr>";
			for(var x = 0; x < cols; x++)
				source += '<td>&nbsp;</td>';
			source += "</tr>";
		}
		source += "</table><br />";
		ejEditor.ins_html(i, source);
		$('#'+this._ejPfx+'frm-tblcols'+i).val("3");
		$('#'+this._ejPfx+'frm-tblrows'+i).val("3");
		$('#'+this._ejPfx+'frm-tblbrd'+i).val("1");
		$('#'+this._ejPfx+'frm-tblcpad'+i).val("");
		$('#'+this._ejPfx+'frm-tblspac'+i).val("");
		$('#'+this._ejPfx+'frm-tblagn'+i).val("left");
		$('#'+this._ejPfx+'frm-tblwdt'+i).val("");
		$('#'+this._ejPfx+'frm-tblhet'+i).val("");
		ejEditor.layClose();
	},
	//	이미지등록
	ins_img : function(i) {
		if($('#'+this._ejPfx+'frm-imgurl'+i).val() == "") {
			alert("이미지 URL을 입력하세요.");
			$('#'+this._ejPfx+'frm-imgurl'+i).focus();
			return false;
		}
		var	url		=	$('#'+this._ejPfx+'frm-imgurl'+i).val();
		var	width	=	($('#'+this._ejPfx+'frm-imgwdt'+i).val())		?	$('#'+this._ejPfx+'frm-imgwdt'+i).val() : 0;
		var	height	=	($('#'+this._ejPfx+'frm-imghet'+i).val())		?	$('#'+this._ejPfx+'frm-imghet'+i).val() : 0;
		var	align	=	($('#'+this._ejPfx+'frm-imgflt'+i).val())		?	$('#'+this._ejPfx+'frm-imgflt'+i).val() : "";
		var	source	=	'<img src="' + url + '" style="';
		source		+=	(width > 0)		?	"width:"+width+"px; " : "";
		source		+=	(height > 0)	?	"height:"+height+"px; " : "";
		source		+=	(align)			?	"float:"+align+"; " : "";
		source		+=	'" />';
		ejEditor.ins_html(i, source);
		$('#'+this._ejPfx+'frm-imgurl'+i).val("");
		$('#'+this._ejPfx+'frm-imgwdt'+i).val("");
		$('#'+this._ejPfx+'frm-imghet'+i).val("");
		$('#'+this._ejPfx+'frm-imgflt'+i).val("");
		ejEditor.layClose();
	},
	//	이미지 업로드
	ins_upimg : function(i) {
		if($('#ej_img_up_preview'+i).children().is("img") == false) {
			alert("이미지를 업로드하세요.");
			return false;
		}
		var	url		=	$('#ej_img_up_preview'+i+' > img').attr("src");
		var	width	=	($('#'+this._ejPfx+'frm-upimgwdt'+i).val())		?	$('#'+this._ejPfx+'frm-upimgwdt'+i).val() : 0;
		var	height	=	($('#'+this._ejPfx+'frm-upimghet'+i).val())		?	$('#'+this._ejPfx+'frm-upimghet'+i).val() : 0;
		var	align	=	($('#'+this._ejPfx+'frm-upimgflt'+i).val())		?	$('#'+this._ejPfx+'frm-upimgflt'+i).val() : "";
		var	source	=	'<img src="' + url + '" style="';
		source		+=	(width > 0)		?	"width:"+width+"px;" : "";
		source		+=	(height > 0)	?	"height:"+height+"px;" : "";
		source		+=	(align)			?	"float:"+align+"; " : "";
		source		+=	'" alt="사용자 등록 이미지" />';
		ejEditor.ins_html(i, source);
		$('#ej_img_up_preview'+i).html("미리보기");
		$('#'+this._ejPfx+'frm-upimgwdt'+i).val("");
		$('#'+this._ejPfx+'frm-upimghet'+i).val("");
		$('#'+this._ejPfx+'frm-upimgflt'+i).val("");
		ejEditor.layClose();
	},
	//	ajax image upload
	img_ajax : function(t, i) {
		var folder = this._ejData;
		if(t == "up") {
			$("#ej_image_up" + i).show();
			$("#ej_image_url" + i).hide();
			$("#"+this._ejPfx+"img-tab-up"+i).addClass('ej-edt-tab-on');
			$("#"+this._ejPfx+"img-tab-url"+i).removeClass('ej-edt-tab-on');
			//	ajax upload
			new AjaxUpload('#ej_img_up_btn' + i, {
				action	:	this._ejPath+'/ej.upload.php',
				name	:	'ej_edt_file',
				data	:	{},
				onSubmit : function(file , ext) {
					if (ext && /^(jpg|png|jpeg|gif)$/.test(ext)) {
						this.setData({
							'preview'	:	'ej_img_up_preview'+i,
							'ej_dom'	:	ejEditor.host(),
							'up_dir'	:	folder
						});
						$('#ej_img_up_preview' + i).text('업로드중');
					} else {
						$('#ej_img_up_preview' + i).text('등록불가!');
						return false;
					}
				},
				onComplete: function(file, response) {
					if(response == "noneimage") {
						$('#ej_img_up_preview' + i).text('');
						alert("이미지 파일이 아닙니다.");
					}
					else if(response == "filesize") {
						$('#ej_img_up_preview' + i).text('');
						alert("파일용량 초과입니다.");
					}
					else if(response == "nonefile") {
						$('#ej_img_up_preview' + i).text('');
						alert("등록 할 파일이 없습니다.");
					}
					else if(response == "nonetarget") {
						$('#ej_img_up_preview' + i).text('');
						alert("미리보기 타켓이 설정되지 않았습니다.");
					}
				}
			});
		}
		else {
			$("#ej_image_url" + i).show();
			$("#ej_image_up" + i).hide();
			$("#"+this._ejPfx+"img-tab-url"+i).addClass('ej-edt-tab-on');
			$("#"+this._ejPfx+"img-tab-up"+i).removeClass('ej-edt-tab-on');
		}
	},
	//	동영상등록
	ins_mov : function(i) {
		if($('#'+this._ejPfx+'frm-movurl'+i).val() == "") {
			alert("동영상 URL을 입력하세요.");
			$('#'+this._ejPfx+'frm-movurl'+i).focus();
			return false;
		}
		var	url		=	$('#'+this._ejPfx+'frm-movurl'+i).val();
		var	width	=	($('#'+this._ejPfx+'frm-movwdt'+i).val())		?	$('#'+this._ejPfx+'frm-movwdt'+i).val() : 400;
		var	height	=	($('#'+this._ejPfx+'frm-movhet'+i).val())		?	$('#'+this._ejPfx+'frm-movhet'+i).val() : 300;
		var	source	=	'<embed src="' + url + '" style="width:' + width + 'px; height:' + height + 'px;"></embed>';
		ejEditor.ins_html(i, source);
		$('#'+this._ejPfx+'frm-movurl'+i).val("");
		$('#'+this._ejPfx+'frm-movwdt'+i).val("");
		$('#'+this._ejPfx+'frm-movhet'+i).val("");
		ejEditor.layClose();
	},
	//	플래시 삽입
	ins_swf : function(i) {
		if($('#'+this._ejPfx+'frm-swfurl'+i).val() == "") {
			alert("플래시 URL을 입력하세요.");
			$('#'+this._ejPfx+'frm-swfurl'+i).focus();
			return false;
		}
		var	url		=	$('#'+this._ejPfx+'frm-swfurl'+i).val();
		var	width	=	($('#'+this._ejPfx+'frm-swfwdt'+i).val())		?	$('#'+this._ejPfx+'frm-swfwdt'+i).val() : 400;
		var	height	=	($('#'+this._ejPfx+'frm-swfhet'+i).val())		?	$('#'+this._ejPfx+'frm-swfhet'+i).val() : 300;
		var	source	=	'';
		source	+=	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + width + '" height="' + height + '">';
		source	+=	'<param name="movie" value="' + url + '" />';
		source	+=	'<param name="wmode" value="transparent" />';
		source	+=	'<!--[if !IE]> <-->';
		source	+=	'<object type="application/x-shockwave-flash" data="' + url + '" width="' + width + '" height="' + height + '">';
		source	+=	'<param name="wmode" value="transparent" />';
		source	+=	'<p style="width:'+width+'px; height:'+height+'px; font-size:12px; line-height:'+height+'px; text-align:center;">사용자등록 플래시</p>';
		source	+=	'</object>';
		source	+=	'<!--> <![endif]-->';
		source	+=	'</object>';
		ejEditor.ins_html(i, source);
		$('#'+this._ejPfx+'frm-swfurl'+i).val("");
		$('#'+this._ejPfx+'frm-swfwdt'+i).val("");
		$('#'+this._ejPfx+'frm-swfhet'+i).val("");
		ejEditor.layClose();
	},
	//	인용구등록
	ins_qut : function(i, border, bcolor) {
		var	source	=	'<div class="ej-edt-quote" style="margin:3px; padding:5px; border:1px solid #' + border + '; background:#' + bcolor + '; ">입력하세요.</div>&nbsp;';
		ejEditor.ins_html(i, source);
		ejEditor.layClose();
	},
	//	이모티콘 등록
	ins_emo : function(i, emo) {
		if(emo) {
			var	source	=	'<img src="'+this._ejEmo+"/emo_"+emo+'" border="0" />';
			ejEditor.ins_html(i, source);
			ejEditor.layClose();
		}
	},
	//	특수문자 - 탭선택
	sel_tab : function(i, c) {
		for(var s = 0; s < this._schar.length; s++) {
			if(s == c) {
				$("#ej_special_" + i + s).show();
				$("#"+this._ejPfx+"spec-tab"+i+"-"+s).addClass('ej-edt-tab-on');
			}
			else {
				$("#ej_special_" + i + s).hide();
				$("#"+this._ejPfx+"spec-tab"+i+"-"+s).removeClass('ej-edt-tab-on');
			}
		}
	},
	//	선택문자 폼에 입력
	sel_chr : function(i, c) {
		$("#"+i).val($("#"+i).val() + c);
	},
	//	특수문자 등록
	ins_chr : function(i) {
		if($('#'+this._ejPfx+'frm-specialchar'+i).val() == "") {
			alert("입력하실 특수문자를 선택하세요.");
			$('#'+this._ejPfx+'frm-specialchar'+i).focus();
			return false;
		}
		var	chars	=	$('#'+this._ejPfx+'frm-specialchar'+i).val();
		var	source	=	chars;
		ejEditor.ins_html(i, source);
		$('#'+this._ejPfx+'frm-specialchar'+i).val("");
		ejEditor.layClose();
	},

	//	에디터에 html 입력
	ins_html : function(i, source) {
		var	_ifrm	=	this._ifrm[i];
		if(document.selection) {
			if(this.rng[i]) {
				var	tmp	=	false;
				var	obj	=	this.rng[i];
				for (var x in obj) {
					if(obj[x] == 1) {
						tmp = true;
						break;
					}
				}
				if(!tmp) {
					this.rng[i].select();
					this.rng[i].pasteHTML(source);
				}
				else {
					alert("오브젝트가 선택된 상태에서는 사용 할 수 없습니다.");
				}
			}
			else {
				if(this.rng[i]) {
					_ifrm.contentWindow.document.selection.createRange().pasteHTML(source);
				}
				else {
					_ifrm.contentWindow.focus();
					_ifrm.contentWindow.document.selection.createRange().pasteHTML(source);
				}
			}
		}
		else {
			ejEditor.make_html(_ifrm.contentWindow.document, source);
		}
		ejEditor.edt2html();
	},
	//	에디터에 입력 할 html 생성
	make_html : function(ifrm, html) {
		var ejRandStr	=	"_ejmk_" + Math.round(Math.random()*99999999);
		//$("#debug").append('<p>'+ejRandStr+'</p>');
		ifrm.execCommand("insertimage", false, ejRandStr);
		var pat = new RegExp("<[^<]*" + ejRandStr + "[^>]*>");
		var current_html	=	ifrm.body.innerHTML	=	ifrm.body.innerHTML.replace(pat, html);
	},
	//	숫자만 입력받기
	onlyno : function(obj) {
		var retxt	=	"";
		for(i = 0; i < obj.value.length; i++) {
			if(obj.value.charAt(i) >= 0 || obj.value.charAt(i) <= 9) {
				retxt	+=	obj.value.charAt(i);
			}
		}
		obj.value	=	retxt;
	},
	//	호스트정보 얻기
	host : function() {
		var host = location.href;
		var o_host = host.split("//");
		var url = o_host[1];
		return host.substr(0,host.indexOf("/")) + "//" + url.substr(0,url.indexOf("/"));
	},
	//	레이어보기
	layShow : function(i, m_lay) {
		ejEditor.layClose(1);
		if(m_lay != this._ejOld[i] && this._gmode == 1) {
			this._ejOld[i]	=	m_lay;
			$("#"+this._ejPfx+m_lay).slideDown(250).css({"z-index":9999});
		}
		else {
			$("#"+this._ejPfx+m_lay).fadeOut(250);
			this._ejOld[i] = null;
		}
		return false;
	},
	//	모든 레이어 닫기
	layClose : function(v) {
		var v = (v) ? v : 0;
		for(var x = 0; x < this._tCnt; x++) {
			for(var s = 0; s < this._layid.length; s++) {
				$("#"+this._ejPfx+this._layid[s] + x).hide();
			}
			if(v) this._ejOld[x] = null;
		}
		return false;
	}
};
