function DomElm(elm){
	this.elm = document.getElementById(elm);
	this.obj = elm + "Obj";
	eval(this.obj + "= this");
	this.style = this.elm.style;
	return this;
}

DomElm.prototype.getY = function(){
	return this.elm.offsetTop;
}

DomElm.prototype.getX = function(){
	return this.elm.offsetLeft;
}

DomElm.prototype.setHTML = function(html){
	this.elm.innerHTML = "<b>"+html+"</b>";
}
//Deceleracion valores entre 10 y 50
//a mayor valor frena mas despacio
//valor por defecto 20
DomElm.prototype.frena = function(finalX, finalY, deceleracion, intervalo){
	this.finalX = finalX;
	this.finalY = finalY;
	this.x = this.getX();
	this.y = this.getY();
	this.deceleracion = deceleracion || 20;
	this.intervalo = intervalo || 20;
	this.frenar();
}

DomElm.prototype.frenar = function(){
	this.x = (this.finalX - this.x + 1) / this.deceleracion  + this.x;
	this.y = (this.finalY - this.y + 1) / this.deceleracion  + this.y;
	this.style.left = this.x;
	this.style.top  = this.y;
	if (Math.abs(this.finalX - this.getX()) < 1 && Math.abs(this.finalY - this.getY()) < 1){
		this.style.left = this.finalX;
		this.style.top  = this.finalY;
	}
	else{
		setTimeout(this.obj+".frenar()",this.intervalo);
	}
}
