$(function(){
	var $subPagina     = $(".box-catalogo"),
		$page          = $(".page"),
		$paginaAtiva   = $("#banner1"),
		$menuVertical  = $("ul.select-catalogo li a"),
		indice			= 0,
		widthFull		= "";
		
	$page.css("width", $subPagina.width() + "px");
	
	$menuVertical.bind('click', function(){
		clearInterval(timer);
		$paginaAtiva.stop().animate({ top: -400, easing: "easeInBack" });
		
		$paginaAtiva = $($(this).attr('href'));
							
		$paginaAtiva.stop().animate({ top: 0, easing: "easeInBounce" });	
		
		$("ul.select-elenco li a").removeClass("seleciona-setor");
		$($(this)).addClass("seleciona-setor");
		
		indice = ($(this).attr('href').substring(7) -1);
		timer = setInterval(function(){ slideShow(); }, speed);
		
		return false;
	});
	
	var timer 	= null,
		speed 	= 11000,
		limit	= ($("div.box-select ul.select-catalogo li").length) -1;
		
	timer = setInterval(function(){ slideShow(); }, speed);
	
	slideShow = function(){
		//
		if(limit > indice) indice++;
		else indice = 0;
		
		$paginaAtiva.stop().animate({ top: -400, easing: "easeInBack" });
		$paginaAtiva = $($("div.box-select ul.select-catalogo li").eq(indice).children(".min-catalogo").find('a').attr("href"));
		$paginaAtiva.stop().animate({ top: 0, easing: "easeInBounce" });
	}; 
	
	jQuery(function($){
		// HOVER ANIMATE PORTFÃ"LIO(BOX)
		function HoverElement(elemento, velocidade_in, velocidade_out){
			$(elemento).hover(function(){
				$(this).find('span').stop().animate({
					width: 149,
					height: 84,
					top: 8,
					left: 8
				}, velocidade_in);
			},
			function () {
				$(this).find('span').stop().animate({
					width: 165,
					height: 100,
					top: 0,
					left: 0
				}, velocidade_out);
			});
		}
		HoverElement(".min-catalogo a", "fast", "fast");
	});
	
	
	$(window).resize(function(){
		$("body").width("100%");
		widthFull = $("body").width();
		$("div.box-catalogo div.banner-catalogo").width(widthFull + "px");
	});
	
	
});
