var slider = {
    posun: 146,
    speed: 600,
    area: 580,
    visibleItems: 4,
    items: 0,
    wait: false
};
    
$(function () {
    //SLIDER
    slider.area = $('#products-center div.items:eq(0)').width();
    slider.items = $('#products-center div.items div.item').length;
    
    $('#toPrev').addClass('disabled').fadeTo(0,0.4).css('cursor','default');
    if(slider.items <= slider.visibleItems){
        $('#toNext').addClass('disabled').fadeTo(0,0.4).css('cursor','default');
    }
    
    $('#toNext').click(function () {
        if (!slider.wait && !$(this).hasClass('disabled')) {
            var sliderContent = $('#products-center div.items');
            var curLeft = parseInt(sliderContent.css('left'));
            var newLeft = curLeft - slider.posun;
            
            slider.wait = true;
            sliderContent.animate({
                left: newLeft + 'px'
            },{
                duration: slider.speed,
                complete: function(){
                    if(newLeft <= -((slider.items-4) * slider.posun)){
                        $('#toNext').addClass('disabled').fadeTo(0,0.4).css('cursor','default');
                    }
                    if($('#toPrev').hasClass('disabled')){
                        $('#toPrev').removeClass('disabled').fadeTo(0,1).css('cursor','pointer');
                    }
                    slider.wait = false;
                }}
            );
        }
    });
    
    $('#toPrev').click(function () {
        if (!slider.wait && !$(this).hasClass('disabled')) {
            var sliderContent = $('#products-center div.items');
            var curLeft = parseInt(sliderContent.css('left'));
            var newLeft = curLeft + slider.posun;
            
            slider.wait = true;
            sliderContent.animate({
                left: newLeft + 'px'
            },{
                duration: slider.speed,
                complete: function(){
                    if(newLeft >= 0){
                        $('#toPrev').addClass('disabled').fadeTo(0,0.4).css('cursor','default');
                    }
                    if($('#toNext').hasClass('disabled')){
                        $('#toNext').removeClass('disabled').fadeTo(0,1).css('cursor','pointer');
                    }
                    slider.wait = false;
                }}
            );
        }
    });
  /* 
    $("#products-center div.items div.item").hover(
        function(){ $(this).find('img').animate({ 'width' : '101px' , 'height' : '270px' , 'margin-top' : '-15px' , 'margin-left' : '-5px' } , 200 );
; }
       ,function(){ $(this).find('img').animate({ 'width' : '84px' , 'height' : '225px' , 'margin-top' : '0px' , 'margin-left' : '0px' } , 200 );
; }
    );
});
*/



$("#products-center div.items div.item").hover(
        function(){ $(this).find('img').animate({ 'width' : '101px' , 'height' : '270px' , 'top' : '-20px' , 'left' : '-5px' } , 200 );
; }
       ,function(){ $(this).find('img').animate({ 'width' : '84px' , 'height' : '225px' , 'top' : '0px' , 'left' : '0px' } , 200 );
; }
    );
});



