$(function(){
	
	//Variables
	count = 0	
	
	//Number of slides
	items = $('.item').length
	
	// set slider width
	$('#slider_content').css({
		width: ($('.item').width() + parseInt($('.item').css("marginRight"))) * items
	})
	
	//Setup triggers
	$('#right_arrow').click(function(){
		if(!$(this).hasClass("disabled")){
			count ++
			move_slider()
		}
		return false
	})
	$('#left_arrow').click(function(){
		if(!$(this).hasClass("disabled")){
			count = count -1
			move_slider()
		}
		return false
	})
	
	check_arrows()
})

function move_slider(){
	$('#slider_content').animate({
		marginLeft: (($('.item').width() + parseInt($('.item').css("marginRight"))) * count) * -1
	})
	check_arrows()
}

function check_arrows(){
	if(count > 0){
		$('#left_arrow').removeClass("disabled")
	}
	else{
		$('#left_arrow').addClass("disabled")
	}
	
	if(items >= (count + 3)){
		$('#right_arrow').removeClass("disabled")
	}
	else{
		$('#right_arrow').addClass("disabled")
	}
	
}