function Scroll()
{
	this.current_timeout;
	this.dir; //direcao
	//defino os valores padrão
	this.box_width = 688;
	this.box_width_item = 230;
	this.box_itens_name = "box_itens";
	this.sufixo = 'lancamento';
	this.anterior = '';
	this.proximo = ''
	this.move = true;
	this.left_;
	this.qtdeItensVitrine = 3;
}


Scroll.prototype.start_animation = function (mov)
{
	this.current_timeout = setTimeout("Scroll.anime()",50);
	this.dir = Math.round(mov);
}

Scroll.prototype.animation = function animation(mov)
{
	this.dir = Math.round(mov);
	anime();
}

Scroll.prototype.anime = function ()
{
	this.move = true;
	this.proximo = '';
	this.anterior='';
	
	var v = document.getElementById(this.box_itens_name + '_' + this.sufixo);
	
	this.left_ = parseInt(v.style.left);
	
	v.style.left = this.get_prosition();
}

Scroll.prototype.get_prosition = function ()
{
	var left='';
	
	if(this.dir>0 && this.left_ >= 0)
	{
		this.move = false;
		left = '0px';
		this.anterior = 'opacity';
	}
	
	if(this.dir<0 && this.left_ <= (this.box_width - this.box_width_item*this.qtdeItensVitrine)*-1)
	{
		this.move = false;
		left = ((this.box_width - this.box_width_item*this.qtdeItensVitrine)*-1)+'px';
		this.proximo = 'opacity';
	}
	/*
	document.getElementById("anterior").className = this.anterior;
	document.getElementById("proximo").className = this.proximo;
	*/
	if(this.move)
	{
		left = (this.left_ + this.dir) + 'px';
		this.current_timeout = setTimeout("Scroll.anime()",50);
	}
	
	return left;
}

Scroll.prototype.stop_animation =  function stop_animation()
{
	clearTimeout(this.current_timeout);
}

var Scroll = new Scroll();

function Tab()
{
	this.classNameOver = 'aba_over';
	this.classNameOn = 'aba_on'
	
	this.classNameTabOff = 'aba_lancamento_off';
	this.idTabOn = 'aba_lancamento';
	this.total = new Array();
}

Tab.prototype.over = function(id, over)
{
	var aba = document.getElementById(id);
	aba.style.cursor = 'pointer';
	if(id != this.idTabOn)
	{
		if(over)
		{
			this.classNameTabOff = aba.className;
			aba.className = this.classNameOver;
		}
		else
		{
			aba.className = this.classNameTabOff;
		}
	}
}

Tab.prototype.turnOn = function(id, qtde)
{
	if(this.idTabOn != id)
	{
		var aba = document.getElementById(id);
		var abaOn = document.getElementById(this.idTabOn);
		abaOn.className = this.idTabOn + '_off';
		aba.className = this.classNameOn;
		this.idTabOn = id;
		
		mudarAba(id.substr(4,id.length), qtde);
		
		if(this.total[id.substr(4,id.length)] > 3)
		{
			document.getElementById("anterior").style.display = '';
			document.getElementById("proximo").style.display = '';
		}
		else
		{
			document.getElementById("anterior").style.display = 'none';
			document.getElementById("proximo").style.display = 'none';
		}
	}
}

var Tab = new Tab();

function mudarAba(sufixo, qtde)
{
	document.getElementById(Scroll.box_itens_name+ '_' +Scroll.sufixo).style.display='none';
	Scroll.sufixo = sufixo;
	Scroll.box_width = Scroll.box_width_item*qtde+10;
	document.getElementById(Scroll.box_itens_name+ '_' +Scroll.sufixo).style.width = Scroll.box_width;
	document.getElementById(Scroll.box_itens_name+ '_' +Scroll.sufixo).style.display='';
}