$(document).ready(function(){

wind = $('.brend > .carousell').innerWidth();

full_line = 0;

/*$('div[class=brend] > div[class=carousell] > ul > li').each(function(){
    full_line += $(this).width() + 40;
});*/

full_line = $('.carousell ul li').length*60;

$('div[class=brend] > div[class=carousell] > ul').width(full_line);

var max_shift = full_line-wind;

if(max_shift<0) $('.brend > .next > a').hide();

$('.brend > .prev a').hide();

var shift=0;

$('.brend > .carousell ul').attr('style','left:818px');
$('.brend > .carousell ul').animate({"left": "0"}, 8000);

function go(direct){
    if(direct=='left'){
        if(max_shift+shift>0){
            shift--;
            $('.brend > .prev a').show(600);
        }else{
            $('.brend > .next a').hide(400);
        }
    }else{
        if(shift<0){
            shift++;
            $('.brend > .next a').show(600);
        }else{
            $('.brend > .prev a').hide(400);
        }
    }
    $('.brend > .carousell ul').css('left',shift+'px');
}


var interval;

$('.brend > .prev a').mouseover(function(){
	interval=setInterval(function(){
       go('right');
    }, 5);
});
			
			
$('.brend > .prev a').mouseout(function(){
				clearInterval(interval);
			});

$('.brend > .next a').mouseover(function(){
    interval=setInterval(function(){
       go('left');
    }, 5);
});

$('.brend > .next a').mouseout(function(){
	clearInterval(interval);
});
});
