
    $(function() {
	
        $("#middleBlock div a").hover(function(){
            $(this).stop().animate(
            {backgroundPosition:"(0 0 )", "color":"#fff"}, 
            {duration:400})
        },
        function(){
            $(this).stop().animate(
            {backgroundPosition:"(0 43px )"}, 
            {duration:400})
        })
function onBefore(curr, prev, opts) {
	var currentSlide = $(this).getIndex();
	var blockWidth = $("#middleBlock div:eq("+ currentSlide +")").width();
	var blockMedWidth = blockWidth / 2;
	var blockOffset = $("#middleBlock div:eq("+ currentSlide +")").position();
	var blockOffsetLeft = blockOffset.left;
	var arrowNewPosition = blockOffsetLeft + blockMedWidth;
	$("#arrowSlide").animate({left:arrowNewPosition}, 500)
}
            $('.slide:visible .buttonSlide').each(function(){
                var thisWidth = $(this).width() - 32;
                $(this).css({"float":"none", "width":thisWidth, "margin":"0 auto"})
            });
            $('#slides').cycle({
                fx: 'fade',
                timeout: 8000, 
                pager:'#middleBlock',
                pause: 1,
                before: onBefore,
                pagerAnchorBuilder:function(idx,slide){
                    return'#middleBlock div:eq(' + (idx) + ') a';
                }
            });
    })
	

  





