function eXcell_edimg(cell){
	try{
		this.cell = cell;
		this.grid = this.cell.parentNode.grid;
	}catch(er){}
	this.getValue = function(){
		 if(this.cell.firstChild.tagName=="IMG"){
			if(this.cell.image){
				this.cell.image = this.cell.image.replace("resize.php?img=","").replace(/&.*/,"");
			}
		  	return (this.cell.image!=null?this.cell.image:"")+(this.cell.titFl!=null?"^"+this.cell.tit:"");
		}
		 else if(this.cell.firstChild.tagName=="A"){
		 	var out = (this.cell.image!=null?this.cell.image:"")+(this.cell.titFl!=null?"^"+this.cell.tit:"");
		 	out+="^"+this.cell.lnk;
			if(this.cell.trg)
				out+="^"+this.cell.trg
			return out;
		 }
	}
	this.getTitle = function(){
		return this.cell.tit
	}
	this.edit = function(){
					this.val = this.getValue();
					if(!this.val) this.val="";
					alert(this.val)
					this.obj = document.createElement("TEXTAREA");
                    this.obj.className="dhx_textarea";

					this.obj.onclick = function(e){(e||event).cancelBubble = true}
					var arPos = this.grid.getPosition(this.cell);//,this.grid.objBox
                    if (!this.cell._clearCell)
    					this.obj.value = this.val;

					this.obj.style.display = "";
					this.obj.style.textAlign = this.cell.align;
					if (_isFF){
						var z_ff=document.createElement("DIV");
						z_ff.appendChild(this.obj);
						z_ff.style.overflow="auto";
						z_ff.className="dhx_textarea";
						this.obj.style.margin="0px 0px 0px 0px";
					    this.obj.style.border="0px";
	  					this.obj=z_ff;
						}
					document.body.appendChild(this.obj);//nb:
					this.obj.onkeydown=function(e){
						var ev=(e||event);
						if (ev.keyCode==9) {
							globalActiveDHTMLGridObject.entBox.focus();
							globalActiveDHTMLGridObject.doKey({keyCode:ev.keyCode,shiftKey:ev.shiftKey,srcElement:"0"});
							return false;
							}
					}

					this.obj.style.left = arPos[0]+"px";
					this.obj.style.top = arPos[1]+this.cell.offsetHeight+"px";
					if(this.cell.scrollWidth<200)
						var pw=200;
					else
						var pw=this.cell.scrollWidth;
					this.obj.style.width = pw+(_isFF?18:16)+"px"
					if (_isFF){
						 this.obj.firstChild.style.width = parseInt(this.obj.style.width)+"px";
						 this.obj.firstChild.style.height = this.obj.offsetHeight-3+"px";
						 }

					   this.obj.focus();
					   if (_isFF) this.obj.firstChild.focus();
					   else this.obj.focus()

				}
	this.detach = function(){
					var a_val="";
					if (_isFF) a_val=this.obj.firstChild.value;
					else a_val=this.obj.value;
                    if (a_val=="") {
                        this.cell._clearCell=true;
                        }
                    else this.cell._clearCell=false;
					this.setValue(a_val);
					//isIE()?this.obj.removeNode(true):this.grid.objBox.removeChild(this.obj);
					document.body.removeChild(this.obj);

					return this.val!=this.getValue();
	}
}
eXcell_edimg.prototype = new eXcell;
eXcell_edimg.prototype.setValue = function(val){
					var title = val;
					if(val.indexOf("^")!=-1){
						var ar = val.split("^");
						val = ar[0]
						title = ar[1];
						//link
						if(ar.length>2){
							this.cell.lnk = ar[2]
							
						}
						this.cell.titFl = "1";
					}
if((val=="")||!val||(val=="undefined")||(val.indexOf("resize.php?img=undefined&")!=-1)){
						this.setCValue("&nbsp;");
						return;
					}
					//this.setCValue("<div style='height:100%; width:100%; background-image:url("+(val||"")._dhx_trim()+"); background-repeat:no-repeat; background-position:center middle;'>&nbsp;</div>",val);
					if(val&&val.indexOf("resize.php")=="-1")
					val = "resize.php?img="+val+"&height=59";
					this.setCValue("<img src='"+(val||"")._dhx_trim()+"' border='0'>", val);
					
					this.cell.image = val;
					if(this.cell.lnk){
						this.cell.innerHTML = "<a href='"+this.cell.lnk+"' target='_self'>"+this.cell.innerHTML+"</a>"
					}
					this.cell.tit = title;
				}