// 浏览器版本检测
var BrowserInfo = new Object() ;
BrowserInfo.MajorVer = navigator.appVersion.match(/MSIE (.)/)[1] ;
BrowserInfo.MinorVer = navigator.appVersion.match(/MSIE .\.(.)/)[1] ;
BrowserInfo.IsIE55OrMore = BrowserInfo.MajorVer >= 6 || ( BrowserInfo.MajorVer >= 5 && BrowserInfo.MinorVer >= 5 ) ;

function Editor(content){
	oEditor = document.wrEditor;
	var strHtml = '<html><hand><script>function killErrors(){return true;}window.onerror = killErrors;</script><style>body,a,table,div,span,td,th,input,select{font-size:9pt;font-family:"宋体,Verdana,Arial";Color:#000000;}body{margin:5;background-color:#FFFFFF;SCROLLBAR-BASE-COLOR:#EFEFEF}table,td{border:1px #709FCB dashed}span,div,li,ul{border:1px #FF00FF dashed}a{color:#0000FF; font-size:14px;}</style></hand><body>'+content+'</body></html>';
	oEditor.document.open();
	oEditor.document.write(strHtml);
	oEditor.document.body.innerHTML;
	oEditor.document.close();
	oEditor.document.designMode="off";
}

function iframe_s(){
Editor(document.form1.content.value)
}


function GetEditor(TextBox){
  oEditor = document.wrEditor;
  TextBox.value = oEditor.document.body.innerHTML;
}

function check(){
oLinkField.value = getContent();
} 
oLinkField.form.onsubmit=check;

//在当前位置插入文字
function InsertHTML(html){
  HtmlEdit.focus();
  rng=HtmlEdit.document.selection.createRange();
  rng.text=html;
  HtmlEdit.focus();
}

//在选取内容前后添加内容
function Insert(h,b){
  var sText=HtmlEdit.document.selection.createRange();
  InsertHTML(h + sText.text + b)
}

// 显示无模式对话框
function ShowDialog(url, width, height, optValidate) {
	if (optValidate) {
		if (!validateMode()) return;
	}
	HtmlEdit.focus();
	var arr = showModalDialog(url, window, "dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:no;status:no");
	HtmlEdit.focus();
}

// 改变编辑区高度
function sizeChange(size){
	if (!BrowserInfo.IsIE55OrMore){
		alert("此功能需要IE5.5版本以上的支持！");
		return false;
	}
	for (var i=0; i<parent.frames.length; i++){
		if (parent.frames[i].document==self.document){
			var obj=parent.frames[i].frameElement;
			var height = parseInt(obj.offsetHeight);
			if (height+size>=300){
				obj.height=height+size;
			}
			break;
		}
	}
}
