
editornum = 0;
tmpeditdata = new String();
addFont = '<option value="gulim">gulim</option><option value="dotum">dotum</option>';

function is_int(n) { 
	var s = n.toString(), l = s.length; 
	if (l > 11) return false; 
	for (var i = (s.charAt(0) == '-') ? 1 : 0; i < l; i++) { 
		switch (s.charAt(i)) { 
			case '0': 
			case '1': 
			case '2': 
			case '3': 
			case '4': 
			case '5': 
			case '6': 
			case '7': 
			case '8': 
			case '9': break; 
			default : return false; 
		} 
	} 
	return !(n < -2147483648 || n > 2147483647); 
}

function igearconf(tdiv,obj){

	this.rootpath = igearpos;
	this.imgpath = this.rootpath + "img/";
	this.fontDefsize = "8pt";	
	this.fontDefname = "verdana";
	this.fontDefcolor = "#000000";
	this.topMenucolor = "#f0f0f0";	
	this.width = "100";
	this.height = "330";
	this.widthflag = "";
	this.heightflag = "";

	this.editornum = editornum;

	this.frmobj = obj;
	this.doc = document;
	this.nowtogglestat = "html";
	this.previewnm = "mainedit_preview_" + this.editornum;
	this.textnm = "mainedit_text_" + this.editornum;
	this.htmlnm = "mainedit_html_" + this.editornum;
	this.menudiv = "menudiv_" + this.editornum;
	this.bodydiv = "bodydiv_" + this.editornum;
	this.footerdiv = "footerdiv_" + this.editornum;
	this.topmenu_html = "topmenu_html_" + this.editornum;
	this.topmenu_text = "topmenu_text_" + this.editornum;
	this.cntinputnm = "content";
	this.targetdiv = tdiv;
	this.brw = navigator.appName == 'Microsoft Internet Explorer' ? "ie" : "etc";
	this.htmlfrm_css = '';

	this.highlight = false;
	this.highlighttype = 'html';
	this.highlightcsstype = 'html';

	this.editortopmenu = true;
	this.editortogglemenu = true;
}

function igeareditor(frmobj , rtpath){	
	this.conf = new igearconf(frmobj);
	this.conf.rootpath = rtpath;
	this.conf.imgpath = rtpath + "img/";
}

igeareditor.prototype.defcss = function(tframe , tarea){
	var dcss = new String();
	
	if(typeof(tarea) == "undefined"){

		dcss = '<style>';
		dcss += 'td,pre,select{border:1px dashed #a1a1a1;color:' + this.conf.fontDefcolor + ';font-size:' + this.conf.fontDefsize +'; font-family:' + this.conf.fontDefname + ',dotum;line-height:145%;text-align:justify;margin:5px;}.f8pt{font-size:8pt;}.f9pt{font-size:9pt;}.f12pt{font-size:12pt;}.f16pt{font-size:16pt;}.f20pt{font-size:20pt;}.f26pt{font-size:26pt;};';
		if(this.conf.highlight) dcss += 'body{font-size:8pt;font-family:verdana;background:url(../common/images/dot/dot_textline.gif);line-height:160%;padding:2px;margin:0px;color:#3c3c3c;}';
		else dcss += 'body{font-size:8pt;font-family:' + this.conf.fontDefname + ',dotum;margin:5px;line-height:145%;text-align:justify}';
		dcss += 'p{margin:0px;}';
		dcss +=	'</style>';
		this.conf.htmlfrm_css = dcss;
		try{
			window[tframe].document.designMode = "on";
		}catch(e){ dyn_alert(e.message); }

		window[tframe].document.open("text/html");
		window[tframe].document.write(dcss);
		window[tframe].document.close();
		
	}
	else document.getElementById(this.conf.textnm).className = "itextarea";
}

igeareditor.prototype.init = function(){ // editor drawing
	
	
	this.conf.widthflag = is_int(this.conf.width) && this.conf.width > 101 ? "px" : "";
	if(this.conf.width < 101) this.conf.widthflag  = "%";
	this.conf.heightflag = is_int(this.conf.height) && this.conf.height > 101  ? "px" : "";
	this.editor = {html : this.conf.previewnm["document"],text : this.conf.previewnm["document"],preview : this.conf.previewnm["document"]};

	this.body();
	if(this.conf.editortopmenu != true && this.conf.highlight == true) getid(this.conf.menudiv).style.display = 'none';
	this.menu(); // menu viewer start
	this.footer(); // menu viewer start
	this.pallet(); // pallet start
	++editornum;
}

igeareditor.prototype.tag2str = function(str){

	str = str.replace(/</i,'&lt;');
	str = str.replace(/&/i,'&amp;');
	str = str.replace(/>/i,'&gt;');
	return str;
}


igeareditor.prototype.str2tag = function(str){

	str = str.replace(/&lt;/i,'<');
	str = str.replace(/&amp;/i,'&');
	str = str.replace(/&gt;/i,'>');
	return str;
}

igeareditor.prototype.p2br = function(str){
	
	/*
	str = str.replace(/&lt;P&gt;/i,'<BR>');
	str = str.replace(/&lt;\/P&gt;/i,'');
	str = str.replace(/&nbsp;/i,'');
	str = str.replace(/<P>/i,'<BR>');
	str = str.replace(/<\/P>/i,'');
	str = str.replace(/&nbsp;/i,'');
	str = str.replace(/<P>&nbsp;<\/P>/i,'');
	str = str.replace(/&lt;P&gt;&nbsp;&lt;\/P&gt;/i,'');
	return str;
	*/
}

igeareditor.prototype.body = function(){
	
	var retdata = new String();
	

	retdata = (this.conf.editortogglemenu == true ? '<div>\
		<div style="cursor:pointer;float:left"><img src="' + this.conf.imgpath + 'ico_tab101.gif" align="absmiddle" id="topmenu_html_'+ this.conf.editornum +'" border="0" onclick="topmenu_toggle(this,' + this.conf.editornum + ',\'html\')" style="cursor:pointer;"></div> \
		<div style="cursor:pointer;"><img src="' + this.conf.imgpath + 'ico_tab302.gif" align="absmiddle" id="topmenu_text_'+ this.conf.editornum +'" border=0 onclick="topmenu_toggle(this,' + this.conf.editornum + ',\'text\')" style="cursor:pointer;"></div> \
	</div>' : '') + '<div style="width:' + this.conf.width  + this.conf.widthflag + ';height:'+ this.conf.height + this.conf.heightflag +';border:1px #cdcdcd solid;min-width:520px;"> \
		<div style="height:29px;background:#f0f0f0;" id="menudiv_'+ this.conf.editornum +'"></div> \
		<div style="background:#f0f0f0;color:#000000;padding:5px;display:none;" id="edmenudiv_'+ this.conf.editornum +'"></div> \
		<div id="bodydiv_'+ this.conf.editornum +'"></div> \
		<div id="footerdiv_'+ this.conf.editornum +'"></div> \
	</div>';
	
	this.conf.targetdiv.innerHTML = retdata;	
	this.conf.targetdiv.style.display = "block";
}

igeareditor.prototype.footer = function(){
}

igeareditor.prototype.menu = function(){

	var retdata = new String();
	retdata = '<div style="min-width:520px;"> \
		<div style="float:left;padding:5px;"><select name="selfont" title="폰트선택" alt="폰트선택" onchange="igearcommand(\''+ this.conf.editornum +'\',\'FontName\',\'null\',this.options[this.options.selectedIndex].value);">'+ addFont +'<option value="arial">arial</option><option value="verdana">verdana</option><option value="tahoma">tahoma</option></select></div> \
		<div style="float:left;padding:5px;"><select name="selfont" title="폰트사이즈" alt="폰트사이즈" onchange="igearcommand(\''+ this.conf.editornum +'\',\'FontSize\',\'null\',this.options[this.options.selectedIndex].value)"><option value="1">8pt</option><option value="2" selected>9pt</option><option value="3">12pt</option><option value="4">16pt</option><option value="5">20pt</option><option value="6">26pt</option></select></div> \
		<div style="cursor:pointer;width:18px;float:left;padding:5px;"><img title="진하게" alt="진하게" src="' + this.conf.imgpath + 'ico_bold.gif" onclick="menu_toggle(this);igearcommand(\''+ this.conf.editornum +'\',\'Bold\',null,this.value);" align="absmiddle"  width="16"></div> \
		<div style="cursor:pointer;width:18px;float:left;padding:5px;"><img title="이탤릭체" alt="이탤릭체" onclick="menu_toggle(this);igearcommand(\''+ this.conf.editornum +'\',\'Italic\',null,this.value);" align="absmiddle"  src="' + this.conf.imgpath + 'ico_italic.gif" align="absmiddle" width="16"></div> \
		<div style="cursor:pointer;width:18px;float:left;padding:5px;"><img title="언더라인" alt="언더라인" onclick="menu_toggle(this);igearcommand(\''+ this.conf.editornum +'\',\'Underline\',null,this.value);" align="absmiddle"  src="' + this.conf.imgpath + 'ico_underline.gif" align="absmiddle" width="16"></div> \
		<div style="cursor:pointer;width:18px;float:left;padding:5px;"><img title="폰트색상입히기" alt="폰트색상입히기" onclick="menu_toggle(this);igearcommand(\''+ this.conf.editornum +'\',\'ForeColor\',null);" align="absmiddle"  src="' + this.conf.imgpath + 'ico_fgcolor.gif" align="absmiddle" width="16"></div> \
		<div style="cursor:pointer;width:18px;float:left;padding:5px;"><img title="배경색상입히기" alt="배경색상입히기" onclick="menu_toggle(this);igearcommand(\''+ this.conf.editornum +'\',\'BackColor\',null);" align="absmiddle"  src="' + this.conf.imgpath + 'ico_bgcolor.gif" align="absmiddle" width="18"></div> \
		<div style="cursor:pointer;width:18px;float:left;padding:5px;"><img title="링크" alt="링크" onclick="menu_toggle(this);igearcommand(\''+ this.conf.editornum +'\',\'CreateLink\',null,this.value);" align="absmiddle"  src="' + this.conf.imgpath + 'ico_link.gif" align="absmiddle" width="18"></div> \
		<div style="cursor:pointer;width:18px;float:left;padding:5px;"><img title="이미지업로드" alt="이미지업로드" onclick="menu_toggle(this);igearcommand(\''+ this.conf.editornum +'\',\'image\');" align="absmiddle"  src="' + this.conf.imgpath + 'ico_upimage.gif" align="absmiddle" width="18"></div> \
		<div style="cursor:pointer;width:18px;float:left;padding:5px;"><img title="테이블삽입" alt="테이블삽입" onclick="menu_toggle(this);igearcommand(\''+ this.conf.editornum +'\',\'table\');" align="absmiddle"  src="' + this.conf.imgpath + 'ico_table.gif" align="absmiddle" width="17"></div> \
		<div style="cursor:pointer;width:18px;float:left;padding:5px;"><img title="포인트(번호)" alt="포인트(번호)" onclick="menu_toggle(this);igearcommand(\''+ this.conf.editornum +'\',\'InsertOrderedList\',null,this.value);" align="absmiddle"  src="' + this.conf.imgpath + 'ico_olist.gif" align="absmiddle"></div> \
		<div style="cursor:pointer;width:18px;float:left;padding:5px;"><img title="포인트(도트)" alt="포인트(도트)" onclick="menu_toggle(this);igearcommand(\''+ this.conf.editornum +'\',\'InsertUnorderedList\',null,this.value);" align="absmiddle"  src="' + this.conf.imgpath + 'ico_ulist.gif" align="absmiddle"></div> \
		<div style="cursor:pointer;width:18px;float:left;padding:5px;"><img title="왼쪽정렬" alt="왼쪽정렬" onclick="menu_toggle(this);igearcommand(\''+ this.conf.editornum +'\',\'JustifyLeft\',null,this.value);" align="absmiddle"  src="' + this.conf.imgpath + 'ico_left.gif" align="absmiddle"></div> \
		<div style="cursor:pointer;width:18px;float:left;padding:5px;"><img title="가운데정렬" alt="가운데정렬" onclick="menu_toggle(this);igearcommand(\''+ this.conf.editornum +'\',\'JustifyCenter\',null,this.value);" align="absmiddle"  src="' + this.conf.imgpath + 'ico_center.gif" align="absmiddle"></div> \
		<div style="cursor:pointer;width:18px;float:left;padding:5px;"><img title="오른쪽정렬" alt="오른쪽정렬" onclick="menu_toggle(this);igearcommand(\''+ this.conf.editornum +'\',\'JustifyRight\',null,this.value);" align="absmiddle"  src="' + this.conf.imgpath + 'ico_right.gif" align="absmiddle"></div> \
	</div>';
	this.conf.doc.getElementById(this.conf.menudiv).innerHTML = retdata;
}

igeareditor.prototype.toggledata = function(togglemode){

	if(togglemode == "text" && this.conf.nowtogglestat != "text") tmpeditdata = eval(this.conf.htmlnm).document.body.innerHTML;
	if(togglemode == "html" && this.conf.nowtogglestat != "html") tmpeditdata = this.conf.doc.getElementById(this.conf.textnm).value;
}


igeareditor.prototype.toggle = function(mode , focusmode , absolute){
	
	var tmode = "";
	textmode = mode == "text" ?  "block" : "none";
	previewmode = mode == "preview" ?  "block" : "none";
	htmlmode = mode == "html" ?  "block" : "none";

	this.conf.doc.getElementById("body_" + this.conf.textnm).style.display = textmode;
	this.conf.doc.getElementById("body_" + this.conf.previewnm).style.display = previewmode;
	this.conf.doc.getElementById("body_" + this.conf.htmlnm).style.display = htmlmode;
	
	if(typeof(absolute) == 'undefined' && this.conf.nowtogglestat == mode) return false;
	this.conf.nowtogglestat = mode;

	
	if(textmode == "block"){
		if(focusmode == true) this.conf.doc.getElementById(this.conf.textnm).focus();
		this.conf.doc.getElementById(this.conf.textnm).value = tmpeditdata;
	}
	
	//if(focusmode == true) eval(this.conf.previewnm).focus();

	if(htmlmode == "block"){
		if(focusmode == true) eval(this.conf.htmlnm).focus();
		
		//window[this.conf.htmlnm].document.open("text/html");
		//window[this.conf.htmlnm].document.write(this.conf.htmlfrm_css + tmpeditdata);
		//window[this.conf.htmlnm].document.close();
		window[this.conf.htmlnm].document.body.innerHTML = this.conf.htmlfrm_css + tmpeditdata;
		if(typeof(edit_linkcreate) == 'undefined') edit_linkcreate = [];
		try{
			if( typeof this.conf.highlightcsstype != 'undefined' && typeof(edit_linkcreate[this.conf.htmlnm]) == 'undefined'){

				var Link = window[this.conf.htmlnm].document.createElement('link');
				var Doc = window[this.conf.htmlnm].document.documentElement;
				var Head = Doc.getElementsByTagName( 'head' );

				if( Head.length > 0 ) Head.item(0).appendChild( Link );
				else Doc.appendChild( Link );
				
				Link.rel = 'stylesheet';
				Link.type = 'text/css';
				Link.href = plugin + 'igearwebeditor/css/igear_' + this.conf.highlightcsstype + '.css';
				edit_linkcreate[this.conf.htmlnm] = true;
			}
		}catch(e){ alert(e.message);}
	}
}

function p2br(eobj){
	
	/*
	var ddom = eobj.event.keyCode;
	if(ddom == 13){
		eobj.event.returnValue = false;
		var range = eobj.document.selection.createRange();
		range.pasteHTML("<BR>\n");
		range.collapse(false);
		range.select();
	}
	*/
}

igeareditor.prototype.pallet = function(){
	
	var retdata = new String();
	retdata = '<div id="body_'+ this.conf.htmlnm +'"><iframe name="' + this.conf.htmlnm + '" frameborder="no" style="width:'+ this.conf.width + this.conf.widthflag + ';min-width:' + this.conf.width + this.conf.widthflag + ';height:' + (this.conf.height - (!this.conf.highlight ? 30 : 0)) + this.conf.heightflag + '"></iframe></div>';
	retdata += '<div id="body_'+ this.conf.previewnm +'"><iframe name="' + this.conf.previewnm + '" frameborder="no" style="width:' + this.conf.width + this.conf.widthflag + ';min-width:' + this.conf.width + this.conf.widthflag + ';height:' + (this.conf.height - (!this.conf.highlight ? 30 : 0)) + this.conf.heightflag + '"></iframe></div>';

	var textheight = this.conf.width > 100 ? this.conf.width - 15 : this.conf.width - 2;
	retdata += '<div id="body_'+ this.conf.textnm +'"><textarea id="' + this.conf.textnm + '" style="width:' + this.conf.width + this.conf.widthflag +';min-height:' + (this.conf.height - (!this.conf.highlight ? 5 : 0)) + this.conf.heightflag +  ';height:' + (this.conf.height - (!this.conf.highlight ? 5 : 0)) + this.conf.heightflag +  ';background:url('  + this.conf.imgpath + 'dot_textline.gif);line-height:140%;padding:0px;" name="' + this.conf.textnm + '"></textarea></div>';

	this.conf.doc.getElementById(this.conf.bodydiv).innerHTML = retdata;

	this.defcss( this.conf.htmlnm );
	//this.defcss( this.conf.previewnm );

	this.defcss( this.conf.textnm,true);
	this.toggle("html");

	/*
	if(this.conf.brw == "ie"){
		try{
			var convp2br = new Function("p2br(" + eval(this.conf.htmlnm).name + ")");
			eval(this.conf.htmlnm).document.body.attachEvent('onkeypress' , convp2br);
		}catch(e){};
	}
	*/
}

igeareditor.prototype.datasync = function(frmobj,cmd){
	
	var getdata = "";
	if(cmd == "select"){ // editor -> form
		if(typeof(eval(this.conf.htmlnm).document) != "undefined") getdata = eval(this.conf.htmlnm).document.body.innerHTML;
		else getdata = this.conf.doc.getElementById( this.conf.textnm).innerText;
		frmobj.value = getdata;
	}
	else{ // form -> editor
		getdata = frmobj.value;
		if(typeof(eval(this.conf.htmlnm).document) != "undefined") eval(this.conf.htmlnm).document.body.innerHTML = getdata;
		else this.conf.doc.getElementById( this.conf.textnm).innerText = getdata;
		frmobj.value = getdata;
	}
}

igeareditor.prototype.genmgr = function(cmd,param1,param2){
	var docnm = eval(this.conf.htmlnm);
	docnm.focus();
	var range = this.conf.brw == "ie" ? docnm.document.selection.createRange(): (typeof(docnm.getSelection) == 'function' ? docnm.getSelection : docnm.document.getSelection());
	if (range != null && this.conf.brw == "ie") range.select();

	if(cmd == "CreateLink"){
		window.open(this.conf.imgpath + "../igeareditor_innerLink.php?targetedt=" + this.conf.htmlnm , 'ed_popup_link' , 'width=500,height=310');
	}
	else {
		docnm.document.execCommand(cmd, eval(param1), param2);
		if(cmd == "FontSize") setfont(docnm);
	}
}

igeareditor.prototype.table = function(){

	var docnm = eval(this.conf.htmlnm);
	var tdata = "";
	docnm.focus();
	var range = this.conf.brw == "ie" ? docnm.document.selection.createRange(): (typeof(docnm.getSelection) == 'function' ? docnm.getSelection : docnm.document.getSelection());
	window.open(this.conf.imgpath + "../igeareditor_innerTable.php?targetedt=" + this.conf.htmlnm , 'ed_popup_table' , 'width=500,height=480');
}

igeareditor.prototype.image = function(){


	var docnm = eval(this.conf.htmlnm);
	var tdata = "";
	docnm.focus();
	var range = this.conf.brw == "ie" ? docnm.document.selection.createRange(): (typeof(docnm.getSelection) == 'function' ? docnm.getSelection : docnm.document.getSelection());
	window.open(this.conf.imgpath + "../igeareditor_innerImage.php?requri=" + encodeURIComponent(window.location.href) +"&targetedt=" + this.conf.htmlnm , 'ed_popup_image' , 'width=500,height=300');
}

igeareditor.prototype.color = function(cmd,param1){
	var docnm = eval(this.conf.htmlnm);
	var tdata = "";
	docnm.focus();
	var range = this.conf.brw == "ie" ? docnm.document.selection.createRange(): (typeof(docnm.getSelection) == 'function' ? docnm.getSelection : docnm.document.getSelection());
	window.open(this.conf.imgpath + "../igeareditor_innerColorpicker.php?targetedt=" + this.conf.htmlnm + "&cmd=" + cmd + "&param1=" + param1, 'ed_popup_color' , 'width=400,height=220');
}

function setfont(obj,size){
	var a = obj.document.getElementsByTagName('FONT');
	var fontsize="";
	for (var i=0; i < a.length ; ++i){
		
		switch(a[i].getAttribute('size')){
			case "1":
				fontsize = "f8pt";
			break;
			case "2":
				fontsize = "f9pt";
			break;
			case "3":
				fontsize = "f12pt";
			break;
			case "4":
				fontsize = "f16pt";
			break;
			case "5":
				fontsize = "f20pt";
			break;
			case "6":
				fontsize = "f26pt";
			break;
		}
		a[i].setAttribute('className' , fontsize);
	}
}
function menu_toggle(obj){

	if(obj.className == "butt_onclick") obj.className = "butt_def";
	else obj.className = "butt_onclick";
}

function tabpress(){
	alert(window.event.keyCode);
}
function topmenu_toggle(imgobj,editno,editmode){
	var nowedit = editno;
	var docc = igeared[nowedit].conf.doc;

	if(editmode == "text"){
		docc.getElementById(igeared[nowedit].conf.menudiv).style.display = "none";
		docc.getElementById(igeared[nowedit].conf.topmenu_html).src = igeared[nowedit].conf.imgpath + "ico_tab102.gif";
		imgobj.src = igeared[nowedit].conf.imgpath + "ico_tab301.gif";
	}else{
		docc.getElementById(igeared[nowedit].conf.menudiv).style.display = "block";
		docc.getElementById(igeared[nowedit].conf.topmenu_text).src = igeared[nowedit].conf.imgpath + "ico_tab302.gif";
		imgobj.src = igeared[nowedit].conf.imgpath + "ico_tab101.gif";
	}
	igeared[nowedit].toggledata(editmode);
	igeared[nowedit].toggle(editmode , true);
}
function igearcommand(editno,cmd,param1,param2){
	
		if(cmd =="table") igeared[editno].table();
		else if(cmd =="image") igeared[editno].image();
		else if(cmd == "ForeColor" || cmd == "BackColor") igeared[editno].color(cmd,param1);
		else igeared[editno].genmgr(cmd,param1,param2);
}
function editortrans(){
	
	for (var i=0; i < igeared.length; ++i){
		var nowstat = igeared[i].conf.nowtogglestat;
		igeared[i].toggledata("text");
		igeared[i].toggle("text",false);	
		if(nowstat != 'text') igeared[i].toggle("html",false);

	}
}

function text2editortrans(editnum , tdata , togglemode , coloring , coloringtype){
	
	tdata = typeof(tdata) == 'undefined' ? '' : tdata;
	tmpeditdata = tdata;
	igeared[editnum].toggle("text" , '' , true);
	igeared[editnum].toggle("html" , togglemode);
	if(typeof(coloring) != 'undefined') igeared[editnum].conf.highlight = true;
	else  igeared[editnum].conf.highlight = false;
	if(typeof(coloringtype) != 'undefined') igeared[editnum].conf.highlighttype = coloringtype;
	editorhighlight(editnum);
}

function editorhighlight(editnum){

	// highlight 
	if(!!window.igear_languages && igeared[editnum].conf.highlight == true && igeared[editnum].conf.highlighttype && typeof(Highlight) != 'undefined'){
			var light_type = igeared[editnum].conf.highlighttype;
			var light_instant = igearclass(Highlight);
			var revert = new light_instant({
				
				type : light_type,
				langs : window.igear_languages , 
				doc : window[igeared[editnum].conf.htmlnm].document,		// document 
				nodeList : window[igeared[editnum].conf.htmlnm].document.body.childNodes
			});
	}
}

function printeditor(obj , prtnum , topmenu , width , height , highlight , togglemenu , innermenu){

	if(typeof plugin == "undefined") plugin = "./";
	igeared[prtnum] = new igeareditor(obj, plugin + "igeareditor/");
	igeared[prtnum].conf.highlight = typeof(highlight) == 'undefined' ? false : true;
	width = width ? width : '100%';
	height = height ? height : '300';
	igeared[prtnum].conf.width = (typeof(width) == 'undefined' ? "570" : width);
	if(typeof(height) != 'undefined') igeared[prtnum].conf.height = height;
	topmenu = typeof(topmenu) == 'undefined' ? true : topmenu;
	igeared[prtnum].conf.editortopmenu = topmenu == true ? true : false;
	igeared[prtnum].conf.editortogglemenu = typeof(togglemenu) == 'undefined' ? true : false;
	igeared[prtnum].init();
	if(typeof(innermenu) != 'undefined'){
		innermenu += '<button onclick="igearcommand(\''+ igeared[prtnum].conf.editornum +'\',\'image\');" class="button8_w">이미지업로드</button>';
		getid('edmenudiv_'+ igeared[prtnum].conf.editornum).innerHTML = innermenu;
		getid('edmenudiv_'+ igeared[prtnum].conf.editornum).style.display = '';
	}

}
