function setDescription(html) {
	$('.rightColumnWindow.vendidos .body .rowDescription').html(html);
}

function scrollProduct(direction) {
	var $active = $('.rightColumnWindow.vendidos .body .rowImage div div.active');

	if (direction < 0) {
		if ( $active.length == 0 ) $active = $('.rightColumnWindow.vendidos .body .rowImage div div:last');

	    var $next =  $active.next().length ? $active.next()
	        : $('.rowImage div div:first');

			//move away active image
			$active.children(".maisVendidosScrollImage").animate({"left": "200px"}, "swing", function() {
					//bring next image
		            $next.children(".maisVendidosScrollImage").css({"left": "-150px"})
				        .animate({"left": "45px"}, "swing", function() {
				            $active.removeClass('active');
				        });
					
					//set next active identifier
					$next.addClass('active');
					
					// update description
					setDescription($next.children(".maisVendidosScrollDescription").html());
		        });
		
		
		
	} else {
		if ( $active.length == 0 ) $active = $('.rightColumnWindow.vendidos .body .rowImage div div:first');

	    var $next =  $active.prev().length ? $active.prev()
	        : $('.rowImage div div:last-child');

			//move away active image
			$active.children(".maisVendidosScrollImage").animate({"left": "-150px"}, "swing", function() {
					//bring next image
		            $next.children(".maisVendidosScrollImage").css({"left": "200px"})
				        .animate({"left": "45px"}, "swing", function() {
				            $active.removeClass('active');
				        });
					
					//set next active identifier
					$next.addClass('active');
					
					// update description
					setDescription($next.children(".maisVendidosScrollDescription").html());
		        });
		
	}


	clearInterval (autoScroller);
	autoScroller = setInterval( "scrollProduct(1)", 10000 );
}

$(function() {
    autoScroller = setInterval( "scrollProduct(1)", 10000 );
});
