function lebraun_com_carousel() {
	var interval = 3000;
	var speed = 1000;
	var arrow_speed = 100;
	var run = null;
	var hover = false;
	
	//grab the width and calculate left value
	var item_width = $('#slides li').outerWidth(); 
	var left_value = item_width * (-1); 
	
	function setRunInterval() {
		if (!hover) {
			run = setInterval(function() { rotate(); }, interval); 
		}
	}
		
	//move the last item before first item, just in case user click prev button
	$('#slides li:first').before($('#slides li:last'));
	//set the default item to the correct position 
	$('#slides ul').css({'left' : left_value});
	//if mouse hover, pause the auto rotation, otherwise rotate it
	$('#slides').hover(
		function() { hover=true; clearInterval(run); },
		function() { hover=false; setRunInterval(); }
	);
	
	$('#prev').click(function() {
		clearInterval(run);           
		var left_indent = parseInt($('#slides ul').css('left')) + item_width;     
		$('#slides ul:not(:animated)').animate({'left' : left_indent}, speed, function(){    
			//move the last item and put it as first item
			$('#slides li:first').before($('#slides li:last'));
			//set the default item to correct position
			$('#slides ul').css({'left' : left_value});
			setRunInterval();
		}); return false; 
	});
	
	$('#next').click(function() {
		clearInterval(run);
		var left_indent = parseInt($('#slides ul').css('left')) - item_width;
		$('#slides ul:not(:animated)').animate({'left' : left_indent}, speed, function () {
			//move the first item and put it as last item
			$('#slides li:last').after($('#slides li:first'));
			//set the default item to correct position
			$('#slides ul').css({'left' : left_value});
			setRunInterval();
		}); return false;
	});  
	
	function rotate() {
		clearInterval(run);
		var left_indent = parseInt($('#slides ul').css('left')) - item_width;
		$('#slides ul:not(:animated)').animate({'left' : left_indent}, speed, function () {
			//move the first item and put it as last item
			$('#slides li:last').after($('#slides li:first'));                 	
			//set the default item to correct position
			$('#slides ul').css({'left' : left_value});
			setRunInterval();
		});
	}
	
	$('.left-arrow a').hover(function() {
		$(this).stop(true, false).animate({'padding-right' : 36}, arrow_speed);
		$('.right-arrow a').stop(true, false).animate({'padding-left' : 0}, arrow_speed);
	}, function() {
		$(this).stop(true, false).animate({'padding-right' : 16}, arrow_speed);
		$('.right-arrow a').stop(true, false).animate({'padding-left' : 15}, arrow_speed);
	});
	
	$('.right-arrow a').hover(function() {
		$(this).stop(true, false).animate({'padding-left' : 34}, arrow_speed);
		$('.left-arrow a').stop(true,false).animate({'padding-right' : 0}, arrow_speed);
	}, function() {
		$(this).stop(true, false).animate({'padding-left' : 15}, arrow_speed);
		$('.left-arrow a').stop(true, false).animate({'padding-right' : 16}, arrow_speed);
	});
	
	$('.left-arrow a').mousedown(function() {
		$(this).css('paddingRight','38px');
	}).mouseup(function() {
		$(this).css('paddingRight','36px');
	});
	
	$('.right-arrow a').mousedown(function() {
		$(this).css('paddingLeft','37px');
	}).mouseup(function() {
		$(this).css('paddingLeft','35px');
	});
	
	// Handle Left & Right Arrow Keys
	$(document).keydown(function(e){
		if (!$('input').is(':focus')) {
			if (e.keyCode == 37) { $('#prev').click(); return false; } // Left Arrow
	   else if (e.keyCode == 39) { $('#next').click(); return false; } // Right Arrow
   		}
	});
	
	setRunInterval();
}
