$(document).ready(function(){
	var total = $('div.featured div.holder ul li').size();
	var slide_width = 308;
	var offset = 0;
	var move = true;
	
	if (total <= 3){
		$('div.featured a.prevBtn, div.featured a.nextBtn').hide();	
	}
	
	$('div.featured div.holder ul').css({
		'width' : (total * slide_width) + 'px'
	});
	
	$('div.featured a.prevBtn').click(function(event){
		event.preventDefault();
		if (move == true){
			move = false;
			offset -= 3;
			
			if (offset < 0){
				offset = 0;
			}
			
			$('div.featured div.holder ul').animate({
				left : '-' + (slide_width * offset) + 'px'
			}, 500, function(){
				move = true;
			});
		}
	});
	
	$('div.featured a.nextBtn').click(function(event){
		event.preventDefault();
		if (move == true){
			move = false;
			offset += 3;
			
			if ((offset + 3) >= total){
				var diff = (offset + 3) - total;
				offset = offset - diff;
			}
			
			$('div.featured div.holder ul').animate({
				left : -(slide_width * offset) + 'px'
			}, 500, function(){
				move = true;
			});
		}
	});
	
	$('div.featured div.holder ul li').mouseenter(function(){
		$(this).find('div.information div').each(function(){
			$(this).animate({
				marginLeft: '0px'
			}, 200);
		});
			
		$(this).find('div.information').stop().animate({
			bottom : '0px'
		}, 100);
	}).stop().mouseleave(function(){
		$(this).find('div.information div').each(function(){
			$(this).animate({
				marginLeft: '-258px'
			}, 200);
		});
	
		$(this).find('div.information').animate({
			bottom : '-110px'
		}, 100);
	});
});
