/******************************************************/

var Mover = Class.create();
Mover.prototype = {
	speed	: 5,
	id		: 'texto',
	// Inicia
	initialize: function(){},
	// init
	Init: function(){
		this.obj = $(this.id);
		this.dim = Element.getDimensions(this.id);
		this.obj.style.left=0;
		this.obj.style.top=0;
		this.tempo	= 0;
	},
	// Move para direita
	Direita: function(){
		if(!this.temp) this.temp = 0;
		if (parseInt(this.obj.style.left)<=((this.dim.width-50)*(-1))) return;
		this._MoveDireita();
		this.temp += this.speed;
		this.tempo=setTimeout("Mover.Direita()",20);
	},
	// Move para esquerda
	Esquerda: function(){
		if(!this.temp) this.temp = 0;
		this._MoveEsquerda();
		this.temp += this.speed;
		this.tempo=setTimeout("Mover.Esquerda()",20);
	},
	// Move para direita
	_MoveDireita: function(){
		var esq = parseInt(this.obj.style.left);
		var tmp = (esq<0) ? (esq*(-1)) : esq;
		this.obj.style.left = esq-this.speed+"px"
	},
	// Move para esquerda
	_MoveEsquerda: function(){
		if (parseInt(this.obj.style.left)<=-2)
			this.obj.style.left=parseInt(this.obj.style.left)+this.speed+"px"
	},
	// Para
	Parar: function(){
		this.temp = 0;
		clearTimeout(this.tempo);
	}
};
Mover = new Mover();


