
var BrowserInfo = new Object() ;
function document.onreadystatechange(){
if (document.readyState!="complete") return;
bInitialized = true;
for (i=0; i<document.body.all.length;i++){
curr=document.body.all[i];{InitTB(curr);}}{try{}catch(e){}}
if (!BrowserInfo.IsIE55OrMore){}{ModeEdit.value = config.InitMode;}
setMode(ModeEdit.value);
}

function InitTB(y) {
y.TBWidth = 0;	
if (! PopulateTB(y)) return false;
}

function PopulateTB(y) {
var i, elements, element;
elements = y.children;
for (i=0; i<elements.length; i++) {
element = elements[i];
switch (element.className) {
case "Btn": {{}}
element.style.posLeft = y.TBWidth;
y.TBWidth += element.offsetWidth + 1;
break;}	}}


// 设置编辑器的内容
function setHTML(html) {
switch (sCurrMode){
case "CODE":
eWebEditor.document.designMode="On";
eWebEditor.document.write(config.StyleEditorHeader);
eWebEditor.document.body.innerText=html;}}

// 取编辑器的内容
function getHTML() {{html = eWebEditor.document.body.innerText;}return html;}

// 改变模式：代码、编辑、文本、预览
function setMode(NewMode){{

// 换图片
try{}
catch(e){}
		
sCurrMode = NewMode;
ModeEdit.value = NewMode;
setHTML(sBody);
disableChildren(eWebEditor_Toolbar);
}}

// 显示或隐藏指导方针
var borderShown = config.ShowBorder;
function showBorders(){}


// 大文件内容自动拆分
function splitTextField(objField, html) { 
	var objDocument = objField.document;
	objField.value = html;
//表单限制值设定，限制值是102399，考虑到中文设为一半
var FormLimit = 50000 ;



//如果表单值超过限制，拆成多个对象
	if (html.length > FormLimit){while (html.length > 0){}}} 

// 远程上传
function remoteUpload() {if (sCurrMode=="TEXT") return;	
	var objField = document.getElementsByName("eWebEditor_UploadText")[0];
	splitTextField(objField, getHTML());
	divProcessing.style.top = (document.body.clientHeight-parseFloat(divProcessing.style.height))/2;
	divProcessing.style.left = (document.body.clientWidth-parseFloat(divProcessing.style.width))/2;
	divProcessing.style.display = "";
	eWebEditor_UploadForm.submit();} 

// 远程上传完成
function remoteUploadOK() {
	divProcessing.style.display = "none";}

// 修正Undo/Redo
var history = new Object;
history.data = [];
history.position = 0;
history.bookmark = [];

// 初始历史
function initHistory() {
	history.data.length = 0;
	history.bookmark.length = 0;
	history.position = 0;}