function fnBnDown(btn) {
	btn.style.borderTopColor = "#efece8";
	btn.style.borderBottomColor = "#888070";
	btn.style.borderLeftColor = "#efece8";
	btn.style.borderRightColor = "#888070";
}

function fnBnClick(btn) {
	btn.style.borderTopColor = "#888070";
	btn.style.borderBottomColor = "#efece8";
	btn.style.borderLeftColor = "#888070";
	btn.style.borderRightColor = "#efece8";
}

function fnBnUp(btn) {
	btn.style.borderColor = "#d9cec4";
}

// 触发编辑区
function Editor_focus() {
	var ifobj = document.getElementById("if_editor");
	ifobj.contentWindow.focus();
}

// 剪下、复制、删除、贴上、还原
function fnModify(mAction) {
	Editor_focus();
	edobj.execCommand(mAction);
}

// 字体名称
function fnFontName(mfna) {
	edobj.execCommand("FontName", false, mfna);
}

// 字体大小
function fnFontSize(mfsz) {
	edobj.execCommand("FontSize", false, mfsz);
}

// 字体格式 （粗、斜、底、删）
function fnFontType(mFontType) {
	edobj.execCommand(mFontType);
}

// 设置颜色
function fnColorType(mType) {
	var mcolor = showModalDialog("../common/colorselect.htm", false, "center:yes; dialogWidth:245px; dialogHeight:245px;status:0;");
	edobj.execCommand(mType, false, mcolor);
}

// 创建表格
function fnTableSeting() {
	var tbdata = showModalDialog("../common/tableseting.htm", false, "center:yes; dialogWidth:245px;dialogHeight:300px;status:0;");
	if (tbdata != undefined) {
		edobj.body.innerHTML = edobj.body.innerHTML + tbdata;
	}
}

// 标题 (数字、符号、缩排)
function fnOrderedList(mType) {
	Editor_focus();
	edobj.execCommand(mType);
}

// 超链接
function fnCreateLink() {
	Editor_focus();
	edobj.execCommand("CreateLink");
}

// 跑马灯
function fnMarquee() {
	Editor_focus();
	edobj.execCommand("InsertMarquee");
	alert("请双击对象，编辑对象内容");
}

// 加入水平线
function fnHorizontalRule() {
	Editor_focus();
	edobj.execCommand("InsertHorizontalRule");
}

// 复选框、单选按钮、文字输入、密码输入、文本框、button、submit、reset
function fnFormItem(mType, mAt) {
	Editor_focus();
	edobj.execCommand(mType);
	if (mAt != "") {
		alert("请双击对象，编辑对象内容");
	}
}

// 打印
function fnPrint() {
	if (ckArea() == 0)
		pvobj.value = edobj.body.innerHTML;
	else
		edobj.body.innerHTML = pvobj.value;

	edobj.execCommand("Print");
}

// 保存(个人目录)
function fnSave() {
	fnSynchronous()		// 设计区域与源文件数据同步

	edobj.execCommand("SaveAs", 0, "None");
}

// 清除数据
function fnClearCode() {
	if (confirm("确定要清除目前所编辑的数据？")) {
		pvobj.value = "";
		edobj.body.innerHTML = "";
	}
}

// 显示区切换
function fnShowHtml() {
	var eobj, hobj, iobj, sobj, f1obj, f2obj, tobj;

	eobj = document.getElementById("EditArea");
	hobj = document.getElementById("HtmlArea");
	sobj = document.getElementById("shtml");
	iobj = document.getElementById("simg");
	f1obj = document.getElementById("FuncArea1");
	f2obj = document.getElementById("FuncArea2");
	tobj = document.getElementById("stitle")

	if (hobj.style.display == "none") {
		pvobj.value = edobj.body.innerHTML;

		f1obj.style.display = "none";
		f2obj.style.display = "none";
		eobj.style.display = "none";
		hobj.style.display = "";
		sobj.title = "显示设计区域";
		iobj.title = "显示设计区域";
		stitle.innerHTML = "源文件";
	}
	else {
		edobj.body.innerHTML = pvobj.value;

		f1obj.style.display = "";
		f2obj.style.display = "";
		eobj.style.display = "";
		hobj.style.display = "none";
		sobj.title = "显示源文件";
		iobj.title = "显示源文件";
		stitle.innerHTML = "设计区域";
	}
}

// 设计区域与源文件数据同步
function fnSynchronous() {
	if (ckArea() == 0)
		pvobj.value = edobj.body.innerHTML;
	else
		edobj.body.innerHTML = pvobj.value;
}


// 取得目前显示区域
function ckArea() {
	var ckvalue = 0;
	var hobj = document.getElementById("HtmlArea");
	if (hobj.style.display == "none")
		ckvalue = 0; // 目前显示设计区域
	else
		ckvalue = 1; // 日前显示源文件

	return ckvalue;
}

// 恢复默认值
function fnReset() {
	var fmobj = document.getElementById("form1");

	if (fmobj != null)
		fmobj.reset();
}