/*
htmlEditer 1.0 封装原有的编辑器
2007-11-20 by laoding
*/
var htmlEditerCounter = 0;
var htmlEditerHashTable = [];
function htmlEdit(){
	this.width = "100%";
	this.height ="100%";
	this.name = "";
	this.modifyId = "";
	this.basePath = "";		
	this.isInit = false;
	this.create = function(act){
		if(this.name == ""){alert("您还为定义这个编辑域的名称");return false}
		this.id = this.getId();
		htmlEditerHashTable[this.id] = this;
		var tempValue = this.modifyId!=""?this.$(this.modifyId).innerHTML:"";
		var writeStr ='<div style="display:none" id="img'+this.name+'"></div>';
		writeStr += '<textarea type="text" style="display:none" name="'+this.name+'" id="'+this.id+'">'+tempValue+'</textarea>';
		writeStr += '<iframe id="editsframe" src="'+this.basePath+'edit.jsp?textId='+this.name+'&id='+this.id+'" style="width:'+this.width+'px;height:'+this.height+'px;" width="'+this.width+'" height="'+this.height+'" scrolling="no" frameborder="0" marginheight="0" marginwidth="0" id="'+this.id+'"></iframe>';
		if(act)return writeStr;
		document.write(writeStr);
		return true;
	};
	this.reload = function (){
		this.$("editsframe").src = this.basePath+'edit.jsp?textId='+this.name+'&id='+this.id;
	};
	this.getId = function(){
		htmlEditerCounter ++;
		return "_htmlEditer_" + htmlEditerCounter;
	};
	this.setValue = function(){
		this.$(this.name).value = this.getHtmlValue();
	};
	this.getHtmlValue = function(){
		return
	};
	this.getTextValue = function(){};
	this.insertHtmlValue = function(){};
	this.setHtmlValue = function(){};
	this.$ = function(sid){return document.getElementById(sid);}
	this.frameLoadSuccess = function(){
		this.isInit = true;
		if(this.modifyId != ""){
			try{
				this.insertHtmlValue(this.$(this.modifyId).innerHTML);
			}catch(e){}
		};
		this.loadSuccess();
	};
	this.loadSuccess = function(){};
	this.setSubmitText = function(str){
		this.$("img" + this.name).innerHTML += str;
	};
}