$(function() {
    
	//vars
	var conveyor = $(".content-conveyor", $("#sliderContent")),
	item = $(".item-slider", $("#sliderContent"));
	
	//set length of conveyor
	conveyor.css("width", item.length * parseInt(item.css("width")));
	
	var backward = $(".backward");
	var forward = $(".forward");
	
	backward.hide()
	
	backward.click(function(){
    	if ( conveyor.position().left < 0 ) {
			conveyor.animate({
				'left': conveyor.position().left + item.width()
			})
			forward.show()
    	} 
    	if ( ! ( conveyor.position().left < ( - item.width() ) ) ) {
			backward.hide()
    	} 
    	return false
	})
	
	forward.click(function(){
		if ( conveyor.position().left > ( -( item.length - 3 ) ) * item.width() + 20 )  {
			conveyor.animate({
				'left': conveyor.position().left - item.width()
			})
			backward.show()
		}
		if ( ! ( conveyor.position().left > ( -( item.length - 4 ) ) * item.width() + 20 ) )  {
			forward.hide()
		} 
		return false
	})
	
	$('.people').hover(function(){
		$( '.bottle', $(this) ).animate({
			'top' : 130
		},
		'fast')
		
		$( '.label', $(this) ).css( 'backgroundPosition', '0px -2116px' )
		
	},function(){
		$( '.bottle', $(this) ).animate({
			'top' : 140
		},'fast')
		
		 $( '.label', $(this) ).css( 'backgroundPosition', '0px -2036px' )
		
	})
	
	$('#people1').click(function(){
		top.location.replace("http://maxxium.ru/index.php/shop/index?category=4");
	})
	$('#people2').click(function(){
		top.location.replace("http://maxxium.ru/index.php/shop/index?category=15");
	})
	$('#people3').click(function(){
		top.location.replace("http://maxxium.ru/index.php/shop/index?category=3");
	})
	$('#people4').click(function(){
		top.location.replace("http://maxxium.ru/index.php/shop/index?category=16");
	})
	$('#people5').click(function(){
		top.location.replace("http://maxxium.ru/index.php/shop/index?category=4");
	})
	$('#people6').click(function(){
		top.location.replace("http://maxxium.ru/index.php/shop/index?category=15");
	})
   
}) 
