var html = Class.create(CElement,{
  initialize: function( container, id, params ) {
	
	this.type	    = "html";
	this.container  = container;
	this.index      = id ;
	
	this.value      = params.value;
	
	var br = document.createElement("br");
	br.clear = 'all';
	
	var li = document.createElement("li");
	li.id  = $(container).id + "_" +  $(container).id +  this.index;
	li.onclick =  function() { var h = new Function("selectEntry('"+li.id+"')"); h();}
	
	var deleteBtn = document.createElement("input");
		
	deleteBtn.type      = "button";
	deleteBtn.className = "deleteButton";
	deleteBtn.value     = "";
	deleteBtn.onclick   =  function() { var h = new Function("Effect.Fade('"+li.id+"');window.setTimeout('deleteEntry(\""+li.id+"\")',1000);" ); h();}
	
	li.appendChild( deleteBtn );
	li.appendChild( br );
	
	this.li	     = li;
	this.eDelete = deleteBtn;
	this.eArea   = null;	
	
	li.innerHTML = this.value;
	
	$(container).appendChild(li);
	
  },
  
  onUpdate : function(){
	
  
  },
  
  onFocus : function() {
	
	
	this.li.style.height = 150;
	
	this.eArea = document.createElement("textarea");
	this.eArea.style.position = "absolute";
	this.eArea.style.left     = this.li.style.left;
	this.eArea.style.top      = this.li.style.top;
	this.eArea.name 	      = "input_" + this.index;
	this.eArea.id			  = "input_" + this.index;
	
	

	this.eArea.innerHTML = this.value;
	this.li.innerHTML = "";
	this.li.appendChild(this.eArea);
	this.li.style.padding = 0;
	//this.li.style.paddingTop = 10;
	
	var d = Element.getDimensions(this.li);
	
	
	tinyMCE.init({
		mode : "exact",
		elements:"input_" + this.index,
		theme : "advanced",
		width : d.width,
		height: (d.height-50)
	});
	
	
	
  },
	
  onBlur : function() {
	
	tinyMCE.triggerSave();
	this.value = this.eArea.value;
	this.li.innerHTML = this.value;
	 

  }
});