$(document).ready(function() {
 
	$(".pagingNumber").show();
	$(".pagingNumber a:first").addClass("active");
	$(".fade").hide();
	$(".image_reel div").hide();
	$(".fade[rel=1]").show().css({'left' : -740});
	$(".image_reel div[rel=1]").show().css({'left' : 0});
	
	rotate = function(){	
		var triggerID = $active.attr("rel") - 1;
		$(".pagingNumber a").removeClass('active');
		$active.addClass('active');
		$numero = $active.attr("rel");
		var id = $numero;
		$(".image_reel div").hide().css({'left' : 800});
		$('.image_reel div[rel=' + id + ']').show().animate({ 
			"left": 0	
		},800);
		$(".fade").hide().css({'left' : 800});
		$('.fade[rel=' + id + ']').show().animate({ 
			"left": -740		
		},800);	
	}; 
	
	rotateSwitch = function(){		
		play = setInterval(function(){
			$active = $('.pagingNumber a.active').next();
			
			if ( $active.length === 0) {
				$active = $('.pagingNumber a:first');
			}
			rotate();
		},6000);
	};

	rotateSwitch();
	
	$(".image_reel div a").hover(function() {
		clearInterval(play);
	}, function() {
		rotateSwitch();
	});	
	
	$(".paging a").click(function() {	
		$active = $(this);
		clearInterval(play);
		rotate();
		rotateSwitch();
		return false;
	});
	
	$(".pagingNumber a").click(function() {	
		$active = $(this);
		clearInterval(play);
		rotate();
		rotateSwitch();
		return false;
	});
	
	
	$(".paging li a").hover(
		function () { $(this).find('.label').animate({left: -5}, 200);},
		function () { $(this).find('.label').animate({left: -180}, 200);}
	);
	
	$(".tooltip").hide();
	$(".marcasHome ul li a").hover(
		function () {
			$(this).find(".tooltip").fadeIn('fast');
		},
		function () {
			$(this).find(".tooltip").fadeOut('fast');
		}
	);
	
});
