$(document).ready(function() {
$(".paginacao").show();
$(".paginacao a:first").addClass("active");

var imageWidth = $(".slide").width();
var imageSum = $(".banner img").size();
var imageReelWidth = imageWidth * imageSum;

$(".banner").css({'width' : imageReelWidth});

rotate = function(){	
	var triggerID = $active.attr("rel") - 1; 
	var bannerPosition = triggerID * imageWidth; 

	$(".paginacao a").removeClass('active'); 
	$active.addClass('active');

	$(".banner").animate({ 
		left: -bannerPosition
	}, 500 );
	
}; 

rotateSwitch = function(){		
play = setInterval(function(){ 
	$active = $('.paginacao a.active').next();
	if ( $active.length === 0) { 
		$active = $('.paginacao a:first'); 
	}
	rotate(); 
	}, 7000); 
};

rotateSwitch(); 

$(".banner a").hover(function() {
	clearInterval(play);
	}, function() {
	rotateSwitch();
});	

$(".paginacao a").click(function() {	
	$active = $(this); 

		clearInterval(play); 
		rotate(); 
		rotateSwitch(); 
		return false; 
	});	
});
