/*
* Leandro Lemos
* Classe de Animação
*/

var Animate = function(){
	var _a, _b, _c, _d;//temporizadores
	
	this.clear = function(){
		clearInterval(_a);
		clearInterval(_b);
		clearInterval(_c);
		clearInterval(_d);
		_a = _b = _c = _d = "";
	}
	//aumentar verticalmente
	//Parametros (objeto, altura final, incremento, velocidade em ms)
	this._vExpand = function(obj,finalHeight,num,time){
		this.clear();
		_a = setInterval(function(){
			var _ch = obj.offsetHeight;//altura atual

			if (_ch >= finalHeight) {
				clearInterval(_a)
			}
			
			var _next = _ch + num;
			_next = (_next>finalHeight) ? finalHeight : _next;
			obj.style.height = _next + "px";
				
		},time)
	}
	
	//diminuir verticalmente
	//Parametros (objeto, altura final, incremento, velocidade em ms)
	this._vContract=function(obj,finalHeight,num,time){
		this.clear();
		_b = setInterval(function(){
			var _ch = obj.offsetHeight;//altura atual

			if (_ch <= finalHeight) {
				clearInterval(_b)
			}

			var _next = _ch - num;
			_next = (_next<finalHeight) ? finalHeight : _next;
			obj.style.height = _next  + "px";

		},time)
	}
	//futuros métodos a implementar:
	this.zoomIn=function(obj,finalSize,num,time){
		this.clear();
		_c = setInterval(function(){
			var _ch = obj.offsetHeight;//altura atual
			if (_ch >= finalHeight) {
				clearInterval(_c)
			}
			
			var _next = _ch + num;
			_next = (_next>finalHeight) ? finalHeight : _next;
			obj.style.height = _next + "px";
			obj.style.width = _next + "px";
				
		},time)
	}
	
	this.zoomOut = function(obj,finalSize,num,time){
		this.clear();
		_d = setInterval(function(){
			var _ch = obj.offsetHeight;//altura atual

			if (_ch <= finalHeight) {
				clearInterval(_d)
			}

			var _next = _ch - num;
			_next = (_next<finalHeight) ? finalHeight : _next;
			obj.style.height = _next  + "px";
			obj.style.width = _next  + "px";

		},time)
	}
	
	this.moveLeft = function(){

	}
	
	this.moveRight = function(){
		
	}
	
	this.moveUp = function(){
		
	}
	
	this.moveDown = function(){
		
	}
	
	this.slider = function(){
		
	}

}





