var IE = (document.all)?true:false;
var se_obj = null;
var mode = "edit";
var tmp_focus;
function html_run()
{
	var f = eval("document."+HTML["form"]);


	//icon
	document.writeln("<style>@import url('"+HTML["url"]+"style.css');</style>");
	document.writeln("<div id=\"htmlcolor\" style=\"position:absolute;display:none;\"></div>");
	document.writeln("<div style=\"height:"+HTML["height"]+"px;\">");
	document.writeln("<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" width=\""+HTML["width"]+"\" style=\"border:1px solid #CCCCCC;display:none;\" bgcolor=\"#F0F0F0\" id=\"menu_table2\">");
	document.write("<tr><td style=\"padding-left:5px;\">HTML¸ðµå</td></tr>");
	document.write("</table>");

	document.writeln("<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" width=\""+HTML["width"]+"\" style=\"border:1px solid #CCCCCC;\" bgcolor=\"#F0F0F0\" id=\"menu_table\">");
	document.write("<tr height=\"25\"><td style=\"padding-left:5px;\">");
	document.write(icon_view("Print","print.gif","ÀÎ¼â"));
	document.write(icon_view("SaveAs","saveas.gif","ÀúÀå"));
	document.write(icon_view("Undo","undo.gif","½ÇÇàÃë¼Ò"));
	document.write(icon_view("Redo","redo.gif","µÇ»ì¸®±â"));
	document.write(icon_view("SelectAll","selectall.gif","ÀüÃ¼¼±ÅÃ"));
	document.write(icon_open("CreateLink","link.gif","¸µÅ©"));
	document.write(icon_view("UnLink","link_no.gif","¸µÅ©Áö¿ì±â"));
	document.write(icon_color("forecolor","forecolor.gif","±ÛÀÚ»ö"));
	document.write(icon_color("backcolor","backcolor.gif","±ÛÀÚ¹è°æ»ö"));
	document.write(icon_view("Bold","blod.gif","±½°Ô"));
	document.write(icon_view("Italic","italic.gif","±â¿ïÀÌ±â"));
	document.write(icon_view("Underline","underline.gif","¹ØÁÙ"));
	document.write(icon_view("Strikethrough","strikethrough.gif","strike"));
	document.write(icon_view("Superscript","superscript.gif","À§Ã·ÀÚ"));
	document.write(icon_view("Subscript","subscript.gif","¾Æ·¡Ã·ÀÚ"));
	document.write(icon_view("JustifyLeft","justifyleft.gif","¿ÞÂÊÁ¤·Ä"));
	document.write(icon_view("JustifyCenter","justifycenter.gif","°¡¿îµ¥Á¤·Ä"));
	document.write(icon_view("JustifyRight","justifyright.gif","¿À¸¥ÂÊÁ¤·Ä"));
	document.write(icon_view("JustifyFull","justifyfull.gif","¾çÂÊÁ¤·Ä"));
	document.write(icon_view("InsertOrderedList","insertorderedlist.gif","¹®´Ü¹øÈ£"));
	document.write(icon_view("InsertUnorderedList","insertunorderedlist.gif","¸Ó¸®Ç¥"));
	document.write(icon_view("InsertHorizontalRule","inserthorizontalrule.gif","¼±"));
	document.writeln("</td></tr>");
	document.write("<tr height=\"20\"><td style=\"padding-left:5px;\">");
	if(HTML["img_upload"]=="ok")document.writeln(icon_open("imgup","image.gif"));
	if(HTML["upload"]=="ok")document.writeln(icon_open("upload","fileupload.gif"));
	if(HTML["media"]=="ok")document.writeln(icon_open("media","media.gif"));
	if(HTML["link_url"]=="ok")document.writeln(icon_open("link_url","link_url.gif"));
	if(HTML["trackback"]=="ok")document.writeln(icon_open("trackback","trackback.gif"));
	document.write("<select onchange=\"html_modify('fontname', this.value)\" style=\"font-size:9pt;width:100px;\">" +
                     "<option value=\"±¼¸²\">±¼¸²</option>" +
                     "<option value=\"¹ÙÅÁ\">¹ÙÅÁ</option>" +
                     "<option value=\"µ¸¿ò\">µ¸¿ò</option>" +
                     "<option value=\"±Ã¼­\">±Ã¼­</option>" +
                     "<option value=\"Arial\">Arial</option>" +
                     "<option value=\"Arial Black\">Arial Black</option>" +
                     "<option value=\"Courier\">Courier</option>" +
                     "<option value=\"Times New Roman\">Times New Roman</option>" +
                     "<option value=\"Verdana\">Verdana</option>" +
                    "</select>");
	document.write("<select style=\"font-size:9pt;\" onchange=\"html_modify('fontsize', this.value)\">" +
                     "<option value=\"1\">Å©±â1</option>" +
                     "<option value=\"2\">2</option>" +
                     "<option value=\"3\">3</option>" +
                     "<option value=\"4\">4</option>" +
                     "<option value=\"5\">5</option>" +
                     "<option value=\"6\">6</option>" +
                    "</select>");
	document.writeln("</td></tr>");
	document.writeln("</table>");

	//iframe
	document.writeln("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\""+HTML["width"]+"\" height=\"100%\" style=\"border:1px solid #CCCCCC;\">");
	document.writeln("<tr><td>");
	document.writeln("<iframe id=\"html_"+HTML["name"]+"\" contentEditable=\"true\" name=\"html_"+HTML["name"]+"\"  width=\"100%\" height=\"100%\" align=\"left\" scrolling=\"auto\" frameborder=\"no\" onblur=\"html_focus_tmp();\"></iframe>");
	document.writeln("</td></tr>");
	document.writeln("</table>");
	document.writeln("</div>");

	//file_view
	document.writeln("<div style=\"padding-top:5px;\">");
	document.writeln("<select name=\"file_view[]\" size=\"6\"style=\"width:"+HTML["width"]+";\" multiple>");
	document.writeln("<option value=\"\">================¼±ÅÃÇÏ¼¼¿ä================</option>");
	document.writeln("</select>");
	document.writeln("<div style=\"padding-top:5px;\">");
	document.writeln("<a href=\"javascript:;\" onclick=\"wiz_file_del();\"><img src=\""+HTML["url"]+"img/file_del.gif\" border=\"0\" width=\"25\" height=\"16\" align=\"absmiddle\"></a>");
	//document.writeln("<a href=\"javascript:;\" onclick=\"wiz_file_modify();\"><img src=\""+HTML["url"]+"img/file_modify.gif\" border=\"0\" width=\"25\" height=\"16\" align=\"absmiddle\"></a>");
	document.writeln("<font style=\"font-family:"+HTML["font_face"]+";font-size:"+HTML["font_size"]+";\" > ÃÑ "+HTML["file_size"]+"MB ÇöÀç <input type=\"text\" name=\"file_kb\" size=\"3\" style=\"border:0px;height:15px;\" value=\"0\" readonly=\"readonly\" dir=\"rtl\">KB");
	document.writeln("<input type=\"hidden\" name=\"file_by\" value=\"0\" readonly=\"readonly\">");
	document.writeln("<a href=\"javascript:;\" onclick=\"html_mode();\"><img id=\"html_edit\" name=\"html_edit\" src=\""+HTML["url"]+"img/html.gif\" border=\"0\" width=\"32\" height=\"16\" align=\"absmiddle\" alt=\"html_mode\"></a> <img name=\"html_edit\" src=\""+HTML["url"]+"img/editor.gif\" border=\"0\" width=\"1\" height=\"1\"></span>");
	document.writeln("</div>");
	document.writeln("</div>");



	setTimeout( function(){
		if(IE)
		{
			this.obj = eval("html_"+HTML["name"]).document;
			this.obj.designMode = "on";
			this.obj.execCommand("2D-Position", true, true);
			this.obj.execCommand("MultipleSelection", true, true);
			this.obj.execCommand("LiveResize", true, true);
		}
		else
		{
			this.obj = document.getElementById("html_"+HTML["name"]);
			this.obj.contentWindow.document.designMode="on";
		}
		eval("html_"+HTML["name"]).document.open("text/html", "replace");
		eval("html_"+HTML["name"]).document.write("<body contentEditable=\"true\">");
		eval("html_"+HTML["name"]).document.write("</body>");
		eval("html_"+HTML["name"]).document.close();
		if(IE)
		{
			window.frames["html_"+HTML["name"]].document.body.focus();
			window.frames["html_"+HTML["name"]].document.body.innerHTML = eval("f."+HTML["name"]).value;
			html_css();
		}
		else
		{
			eval("html_"+HTML["name"]).document.body.focus();
			eval("html_"+HTML["name"]).document.body.innerHTML = eval("f."+HTML["name"]).value;
		}
		eval("html_"+HTML["name"]).document.body.contentEditable = true;
		eval("html_"+HTML["name"]).document.body.style.fontFamily = HTML["font_face"];
		eval("html_"+HTML["name"]).document.body.style.fontSize = HTML["font_size"];
		eval("html_"+HTML["name"]).document.body.style.backgroundColor = HTML["backgroundcolor"];
		eval("html_"+HTML["name"]).document.body.style.lineheight = 0;
	}, 10 );





}

function icon_view(ex,img,alt)
{
	icons = "<span onclick=\"html_modify('"+ex+"');\" onfocus=\"this.blur()\" style=\"cursor:pointer;padding-left:2px;\"><img src=\""+HTML["url"]+"img/"+img+"\" border=\"0\" width=\"20\" height=\"20\" align=\"absmiddle\" alt=\""+alt+"\"></span>";
	return icons;
}
function icon_open(ex,img)
{
	icons = "<span onclick=\"open_page('"+ex+"',arguments[0]);\" onfocus=\"this.blur()\" style=\"cursor:pointer;padding-left:2px;\"><img src=\""+HTML["url"]+"img/"+img+"\" border=\"0\" align=\"absmiddle\"></span>";
	return icons;
}
function edit_insert_other(tp)
{
	window.frames["html_"+HTML["name"]].document.body.innerHTML += tp;
}
function html_focus()
{
	obj = eval("html_"+HTML["name"]);
	if(IE)
	{
		if(!obj.document.selection.createRange().text)
		{
			obj.focus();
			return true;
		}
	}
	else
	{
		if(!obj.document.createRange().text)
		{
			obj.focus();
			return true;
		}
	}
}
function html_focus_tmp()
{
	obj = eval("html_"+HTML["name"]);
	if(IE)
	{
		tmp_focus = obj.document.selection.createRange();
	}
	else
	{
		tmp_focus = obj.document.createRange();
	}
}

function html_modify(ex,fs)
{
	obj = eval("html_"+HTML["name"]);
	if(!fs)fs=false;

	if(ex=="Undo" || ex=="Redo")
	{
		obj.focus();
		texts = obj.document;
	}
	else if(ex=="InsertImage")
	{
		if(IE)
		{
			obj.focus();
			if(tmp_focus)
			{
				texts = tmp_focus;
				tmp_focus = null;
			}
			else
			{
				texts = obj.document.selection.createRange();
			}
		}
		else
		{
			texts = obj.document;
		}
	}
	else if(html_focus())
	{
		obj.focus();
		texts = obj.document;
	}
	else
	{
		if(IE)
		{
			texts = obj.document.selection.createRange();
		}
		else
		{
			texts = obj.document.createRange();
		}
	}
	html_modify_run(texts,fs,ex);
}

function mouse_e(e)
{
	if(IE)
	{
		this.tt = event.clientY + document.body.scrollTop;
		this.ll = event.clientX + document.body.scrollLeft - 40;
	}
	else
	{
		this.tt = e.pageY;
		this.ll = e.pageX;
	}
}


function html_modify_run(texts,fs,ex)
{
	texts.execCommand(ex,false,fs);
}

function icon_color(ex,img)
{
	icons = "<span onclick=\"html_color('"+ex+"',arguments[0]);\" onfocus=\"this.blur()\" style=\"cursor:pointer;padding-left:2px;\"><img src=\""+HTML["url"]+"img/"+img+"\" border=\"0\" width=\"20\" height=\"20\" align=\"absmiddle\"></span>";
	return icons;
}

function html_color(ex,e)
{
	mouse_e(e);
	var f = document.getElementById("htmlcolor");
	var color = Array(

	"#ffffff", "#e5e4e4", "#d9d8d8", "#c0bdbd", "#a7a4a4", "#8e8a8b", "#827e7f", "#767173", "#5c585a", "#000000",
    "#fefcdf", "#fef4c4", "#feed9b", "#fee573", "#ffed43", "#f6cc0b", "#e0b800", "#c9a601", "#ad8e00", "#8c7301",
    "#ffded3", "#ffc4b0", "#ff9d7d", "#ff7ade", "#ff6600", "#e95d00", "#d15502", "#ba4b01", "#a44201", "#8d3901",
    "#ffd2d0", "#ffbab7", "#fe9a95", "#ff7a73", "#ff483f", "#fe2419", "#f10b00", "#d40a00", "#940000", "#6d201b",
    "#ffdaed", "#ffb7dc", "#ffa1d1", "#ff84c3", "#ff57ac", "#fd1289", "#ec0078", "#d6006d", "#bb005f", "#9b014f",
    "#e2f0fe", "#c7e2fe", "add5fe", "#92c7fe", "#6eb5ff", "#48a2ff", "#2690fe", "#0162f4", "#013add", "#0021b0",
    "#d3fdff", "#acfafd", "#7cfaff", "#4af7fe", "#1de6fe", "#01deff", "#00cdec", "#01b6de", "#00a0c2", "#0084a0",
    "#edffcf", "#dffeaa", "#d1fd88", "#befa5a", "#a8f32a", "#8fd80a", "#79c101", "#3fa701", "#307f00", "#156200");
	cnt = color.length;
	color_ = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border:1px solid #CCCCCC;font-size:9pt;background-color:#FFFFFF;width:100px;\">";
	color_ += "<tr height=\"3\"><td colspan=\"10\"></td></tr>";
	color_ += "<tr><td align=\"center\" colspan=\"10\"><div style=\"width:95%;border:1px solid #CCCCCC;\">»ö ³Ö±â</div></td></tr>";
	color_ += "<tr height=\"3\"><td colspan=\"10\"></td></tr>";
	color_ += "<tr height=\"10\"><td>";
	for(i=0;i<cnt;i++)
	{
		if(i%5==0 && i!=0)
		{
			color_ += "</td></tr><tr height=\"10\"><td>";
		}
		color_ += "<td style=\"background-color:"+color[i]+";width:20px;height:4px;\" onmousedown=\"html_modify('"+ex+"','"+color[i]+"');\" onclick=\"html_div_hidden();\"></td>";
	}
	color_ += "<tr height=\"3\"><td colspan=\"10\"></td></tr>";
	color_ += "<tr><td align=\"center\" colspan=\"10\"><div style=\"width:95%;border:1px solid #CCCCCC;\" onclick=\"html_div_hidden();\">´Ý±â</div></td></tr>";
	color_ += "<tr height=\"3\"><td colspan=\"10\"></td></tr>";
	color_ += "</td></tr>";
	color_ += "</table>";
	f.style.display = "block";
	f.style.top = this.tt;
	f.style.left = this.ll;
	f.innerHTML = color_;
}
function insert_html(t)
{
	var obj = eval("html_"+HTML["name"]);var ht;
	if(tmp_focus)
	{
		ht = tmp_focus;
		tmp_focus = null;
	}
	else
	{
		html_focus();
		ht = obj.document.selection.createRange();
	}
	if(ht!=null)ht.pasteHTML(t);
	close_divs();
}
function open_page(ex,e)
{
	obj = eval("html_"+HTML["name"]);
	switch(ex)
	{
		case "imgup":
			open_divs("include/insert_image.php?wuser_id="+HTML["wuser_id"],"500","222",e);
		break;
		case "media":
			open_divs("include/media.php?wuser_id="+HTML["wuser_id"],"340","445",e);
		break;
		case "upload":
			open_divs("include/upload.php?wuser_id="+HTML["wuser_id"],"300","85",e);
		break;
		case "CreateLink":
			open_divs("include/insert_link.php?wuser_id="+HTML["wuser_id"],"300","150",e);
			se_obj = obj.document.selection.createRange();
		break;
		case "link_url":
			open_divs("include/link_url.php?wuser_id="+HTML["wuser_id"],"300","150",e);
		break;
		case "trackback":
			open_divs("include/trackback.php?wuser_id="+HTML["wuser_id"],"300","150",e);
		break;
		default :
			return false;
	}
}

function open_divs(url,ww,hh,e)
{
	mouse_e(e);
	var f = document.getElementById("htmlcolor");
	if(!document.getElementById("html_div_"+HTML["name"]))
	{
		f.innerHTML = "<iframe src=\"\" id=\"html_div_"+HTML["name"]+"\" name=\"html_div_"+HTML["name"]+"\"  width=\""+ww+"\" height=\""+hh+"\" align=\"left\" scrolling=\"no\" frameborder=\"no\"></iframe>";
	}
	else
	{
		document.getElementById("html_div_"+HTML["name"]).style.width = ww;
		document.getElementById("html_div_"+HTML["name"]).style.height = hh;
	}
	f.style.display = "block";
	f.style.top = this.tt;
	f.style.left = this.ll;
	eval("html_div_"+HTML["name"]).location.href = HTML["url"]+url;
}

function close_divs()
{
	var f = document.getElementById("htmlcolor");
	f.style.display = "none";
}

function html_div_hidden()
{
	var f = document.getElementById("htmlcolor");
	f.style.display = "none";
}
function create_link(link)
{
	var tmp_link = null;
	obj = eval("html_"+HTML["name"]);
	se_obj.select();
    if(IE) 
	{
        obj.document.execCommand("UnLink", false);
        obj.document.execCommand("CreateLink", false, link.url);
    }

    if(IE) 
	{
		tmp_link = obj.document.selection.createRange().parentElement();
    }
    if(link.target) tmp_link.target = link.target;
    if(link.title) tmp_link.title = link.title;
	close_divs();
}
function insertImage (img)
{
	var tmp_img = null;
	obj = eval("html_"+HTML["name"]);
	html_modify("InsertImage",img.src)
	html_focus();
    if(IE) 
	{
		tmp_img = obj.document.selection.createRange().item(0);
		if(IE)
		{
			tmp_img.attachEvent("ondblclick",ModifyImage);//ie
		}
		else
		{
			tmp_img.addEventListener("dblclick",ModifyImage,false);//
		}
    }
	else
	{
        var sel = obj.getSelection();
		var range; 
        if (sel.rangeCount>0) {
            range = sel.getRangeAt(0);
			ID_IMG = range.cloneContents();
			tmp_img = ID_IMG.childNodes[0];
        }
	}


	if(tmp_img)
	{
		if(img.border) tmp_img.border = parseInt(img.border);
		if(img.hspace) tmp_img.hspace = parseInt(img.hspace);
		if(img.vspace) tmp_img.vspace = parseInt(img.vspace);
		if(img.width)  tmp_img.style.width  = parseInt(img.width);
		if(img.height) tmp_img.style.height = parseInt(img.height);
		if(img.alt)    tmp_img.alt    = img.alt;
		if(img.align)  tmp_img.align  = img.align;
	}


	if(img.old_name && img.re_name && img.filesize)
	{
		var f = eval("document."+HTML["form"]);
		i = f["file_view[]"].length;
		f["file_view[]"].options[i] = new Option(img.old_name,img.re_name+"/"+img.old_name);
		f.file_tmp.value += img.re_name+":";
		f.file_by.value = parseInt(f.file_by.value)+parseInt(img.filesize);
		f.file_kb.value = parseInt(parseInt(f.file_by.value)/1000);
	}
	close_divs();
}

function ModifyImage()
{
	var f = document.getElementById("htmlcolor");
	if(!document.getElementById("html_div_"+HTML["name"]))
	{
		f.innerHTML = "<iframe src=\"\" id=\"html_div_"+HTML["name"]+"\" name=\"html_div_"+HTML["name"]+"\"  width=\"300\" height=\"200\" align=\"left\" scrolling=\"no\" frameborder=\"no\"></iframe>";
	}
	else
	{
		document.getElementById("html_div_"+HTML["name"]).style.width = "300";
		document.getElementById("html_div_"+HTML["name"]).style.height = "200";
	}
	f.style.display = "block";

	eval("html_div_"+HTML["name"]).location.href = HTML["url"]+"include/modify_image.php";
	obj = eval("html_"+HTML["name"]);
	if(IE)
	{
		se_obj = obj.document.selection.createRange().item(0);
	}
	else
	{
        var sel = obj.getSelection();
		var range; 
        if (sel.rangeCount>0) {
            range = sel.getRangeAt(0);
			ID_IMG = range.cloneContents();
			se_obj = ID_IMG.childNodes[0];
        }
	}
}



function ModifyChangImage(img)
{
	tmp_img = se_obj;

    if(IE) 
	{
		tmp_img.attachEvent("ondblclick",ModifyImage);//ie
    }
	else
	{
		tmp_img.addEventListener("dblclick",ModifyImage,false);//
	}
    if(img.border) tmp_img.border = parseInt(img.border);
    if(img.hspace) tmp_img.hspace = parseInt(img.hspace);
    if(img.vspace) tmp_img.vspace = parseInt(img.vspace);
    if(img.width)  tmp_img.style.width  = parseInt(img.width);
    if(img.height) tmp_img.style.height = parseInt(img.height);
    if(img.alt)    tmp_img.alt    = img.alt;
    if(img.align)  tmp_img.align  = img.align;
	close_divs();
}

function insertfile(file)
{
	if(file.old_name && file.re_name && file.filesize)
	{
		var f = eval("document."+HTML["form"]);
		i = f["file_view[]"].length;
		f["file_view[]"].options[i] = new Option(file.old_name,file.re_name+"/"+file.old_name+"/"+file.no);
		f.file_tmp.value += file.re_name+":";
		f.file_by.value = parseInt(f.file_by.value)+parseInt(file.filesize);
		f.file_kb.value = parseInt(parseInt(f.file_by.value)/1000);
	}
	close_divs();
}
function http_fun()
{
	if(document.all)
	{
		http = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		http = new XMLHttpRequest();
	}
	return http;
}
function wiz_file_modify(e)
{
	var f = eval("document."+HTML["form"]);
	i = f["file_view[]"].selectedIndex;
	if(i>0)
	{
		file_name = f["file_view[]"][i].value.split("/");
		open_divs("include/upload.php?wuser_id="+HTML["wuser_id"]+"&file_name="+file_name[0]+"&i="+i+"&no="+file_name[2],"300","85",e);
	}
	else
	{
		alert('¼öÁ¤ÇÒ ÆÄÀÏÀ» ¼±ÅÃÇØÁÖ¼¼¿ä');
	}
}
function wiz_file_del() 
{
	http = http_fun();
	var f = eval("document."+HTML["form"]);
	i = f["file_view[]"].selectedIndex;
	if(i>0)
	{
		filename = f["file_view[]"].options[i].value;

		url = HTML["url"]+"include/delete_image.php";
		http.onreadystatechange = wiz_file_del_optn;
		http.open("POST", url, true);
		http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		http.send("filename="+filename+"&wuser_id="+HTML["wuser_id"]);
	}
	else
	{
		alert('»èÁ¦ÇÏ½Ç ÆÄÀÏÀ» ¼±ÅÃÇØÁÖ¼¼¿ä');
	}
} 

function wiz_file_del_optn() 
{
	var f = eval("document."+HTML["form"]);

	if (http.readyState == 4) 
	{
		var textout = http.responseText;
		if(!isNaN(textout))
		{
			f["file_view[]"].options[i] = null;
		}
		else
		{
			alert(textout);
			f["file_view[]"].options[i] = null;
		}
	}
}
function link_del(t)
{
	document.getElementById(t).innerHTML = "";
	document.getElementById(t).style.display = "none";
}
function html_mode()
{
	var obj = window.frames["html_"+HTML["name"]];
	var menu_table = document.getElementById("menu_table");
	var edit_memo = obj.document.body.innerHTML;
	var edit_memo2 = obj.document.body.innerText;

	if(mode=="edit")
	{
		mode = "html";
		document.getElementById("menu_table").style.display = "none";
		document.getElementById("menu_table2").style.display = "block";
        edit_memo = edit_memo.replace (/<META(.+?)>/ig, "<meta content=\"idsu.net\" name=generator>");
        edit_memo = edit_memo.replace (/<link href=(.*?)>/ig, '');
        edit_memo = edit_memo.replace (/(<\/?)P(>)/ig, "$1DIV$2");
		obj.document.body.innerText = edit_memo;
		obj.document.body.clearAttributes;
        obj.document.body.contentEditable = true;
		document.getElementById("html_edit").src = HTML["url"]+"img/editor.gif";

	}
	else
	{
		mode = "edit";
		document.getElementById("menu_table").style.display = "block";
		document.getElementById("menu_table2").style.display = "none";
		obj.document.body.innerHTML = edit_memo2;
		obj.document.body.clearAttributes;
        obj.document.body.contentEditable = true;
		document.getElementById("html_edit").src = HTML["url"]+"img/html.gif";
		html_img_auction();
	}
}

function html_img_auction()
{
	var obj = window.frames["html_"+HTML["name"]];
	var tmp_obj = obj.document.getElementsByTagName("IMG");
	cnt = tmp_obj.length;
	for(i=0;i<cnt;i++)
	{
		if(IE)
		{
			tmp_obj[i].attachEvent("ondblclick",ModifyImage);//ie
		}
		else
		{
			tmp_obj[i].addEventListener("dblclick",ModifyImage,false);//
		}
	}
}

function html_css()
{
	var obj = window.frames["html_"+HTML["name"]];
    var el = obj.document.createElement("<link rel='stylesheet' type='text/css' href='"+HTML["url"]+"/css.css'>");
    obj.document.childNodes[0].childNodes[0].appendChild(el);
}

function in_edit(edit_memo)
{

}

function html_submit_check()
{
	if(mode!="edit")
	{
		html_mode();
	}
	var f = eval("document."+HTML["form"]);
	eval("f."+HTML["name"]).value = window.frames["html_"+HTML["name"]].document.body.innerHTML;
	cnt = f["file_view[]"].length;
	for(i=0;i<cnt;i++)
	{
		f["file_view[]"].options[i].selected = true;
	}
	if(eval("f."+HTML["name"]).value)
	{
		return 1;
	}
}
