<!--//
var selectArea = null;
var color_target = "";

function init_editor() {
	editCtrl.document.designMode = "on";
	var html = "<html><head></head><z></body></html>";
	editCtrl.document.open("text/html");
	editCtrl.document.write(html);
	editCtrl.document.close();
	editCtrl.document.body.style.fontFamily = "±¼¸²";
	editCtrl.document.body.style.fontSize = "9pt"
	editCtrl.document.body.style.textalign = "justify";
	editCtrl.document.body.style.lineHeight = "18px";
	editCtrl.document.onkeyup = showHtml;
	editCtrl.document.oncontextmenu = disableContext;
}

function disableContext() {
	return false;
}

function showHtml() {
	var html = editCtrl.document.body.innerHTML;
	document.edit_frm.body.value = html;
}

function execCmd(cmd) {
	editCtrl.focus();
	selectArea = editCtrl.document.selection.createRange();

	if (selectArea != null)
		selectArea.select();
	
	if (cmd == "createlink") {
		editCtrl.focus();
		editCtrl.document.execCommand("createlink", 3);
	}
	else
		editCtrl.document.execCommand(cmd);
}

function setFont(obj) {
	var font = obj.options[obj.selectedIndex].value;
	editCtrl.document.execCommand("FontName", null, font);
}

function setFontSize(obj) {
	var size = obj.options[obj.selectedIndex].value;
	editCtrl.document.execCommand("FontSize", null, size);
}

function setForeColor() {
	editCtrl.focus();
	selectArea = editCtrl.document.selection.createRange();

	document.all.foreColorTable.style.display = "";
	document.all.bgColorTable.style.display = "none";
}

function setBgColor() {
	editCtrl.focus();
	selectArea = editCtrl.document.selection.createRange();

	document.all.foreColorTable.style.display = "none";
	document.all.bgColorTable.style.display = "";
}

function dlg_setForeColor(color) {
	if (selectArea != null)
		selectArea.select();

	editCtrl.document.execCommand("forecolor", null, color);
	document.all.foreColorTable.style.display = "none";
}

function dlg_setBackColor(color) {
	if (selectArea != null)
		selectArea.select();

	editCtrl.document.execCommand("backcolor", null, color);
	document.all.bgColorTable.style.display = "none";
}

function dlg_insertImage(img) {
	editCtrl.focus();
	editCtrl.document.execCommand("insertimage", false, img);
}

function insertImg() {
	window.open("/community/UploadImage.asp", "img_dlg_window", "width=350,height=140");
}

//------------------------------------------------------
// @ 2008-02-03 By ¼Û¿íÀç Ãß°¡ 
// ÀÌÀ¯ : ssd °Ô½ÃÆÇ¿¡¼­ »ç¿ëÇÒ ÀÌ¹ÌÁö ¾÷·Îµå ÇÁ·Î¼¼½º 
//------------------------------------------------------
function insertImg_SSD(pBoardname) {
	window.open("/ssd/UploadImage.asp?boardname="+pBoardname, "img_dlg_window", "width=350,height=140");
}
function insertImg_win7(pBoardname) {
	window.open("/win7/UploadImage.asp?boardname="+pBoardname, "img_dlg_window", "width=350,height=140");
}
function insertImg_MID(pBoardname) {
	window.open("/MID/UploadImage.asp?boardname="+pBoardname, "img_dlg_window", "width=350,height=140");
}
//------------------------------------------------------

function init_update() {
	var f=document.edit_frm;
	editCtrl.document.body.innerHTML = f.body.value;
}
	

//-->