// Скрол на главной
cache_html = new Array();

    var moveLength;
    var currentStep = 0;
    var steps = 0;
    var resizeTimer;
	
    $(document).ready(function(){
        initScroller();
        //$(window).resize(function(){ clearTimeout(resizeTimer); resizeTimer=setTimeout((function(){ initScroller() }),50) });
    });
	
    function initScroller(){
	$('a.toLeft2').hide().click(moveLeft);
    $('a.toRight2').show().click(moveRight);
		
	currentStep = 0;
        var itemsCount = $('ul#items li').length;
        scrollerWidth = $('.scroller').width()-120;
        itemWidth = $('ul#items li').width();
        var itemsShow = parseInt( scrollerWidth / (itemWidth-22) );
        itemSpacing = 10; // отступы 
        $('ul#items').width( (itemWidth+itemSpacing+10)*itemsCount );
	if ($('ul#items').width() < scrollerWidth ) { $('a.toRight2').hide(); }
        $('ul#items li').css({marginRight:itemSpacing});
        moveLength = (itemsShow*itemWidth) + ((itemsShow-1)*itemSpacing); 
        i = itemsShow;
        while (i <= itemsCount) {
            $('ul#items li').eq(i-1).css({marginRight:10}) // отступ первого элемента второй страницы
            i+=itemsShow;
        };
		steps = (parseInt(itemsCount/itemsShow) == itemsCount/itemsShow) ? (itemsCount/itemsShow)-1 : parseInt(itemsCount/itemsShow);
        $('ul#items').css({left:(0-(currentStep*moveLength)+55)});
	$('.scroller').animate({height:$('ul#items li img').height()+30},200); // высота
    };
    function moveRight() {
        if ( currentStep < steps) {
            $('ul#items').animate({
                left:'-='+moveLength+'px'
            },900);
            currentStep++;
			if (currentStep == steps) {
				$('a.toRight2').hide();
			}
			if (currentStep > 0) {
				$('a.toLeft2').show();
			}
        };
    };
    function moveLeft() {
        if ( currentStep > 0) {
            $('ul#items').animate({
                left:'+='+moveLength+'px'
            },900);
            currentStep--;
			if (currentStep < steps) {
				$('a.toRight2').show();
			}
			if (currentStep == 0) {
				$('a.toLeft2').hide();
			}
        };
    };
	
// В разработке
var cuurentLink = 'a1'; var cuurentBlock = 't1';
function changeIndex(linkTag,block){
	if (linkTag !== cuurentLink) {
		$('#'+cuurentLink).removeClass('a_in_work_act');
		$('#'+cuurentLink).addClass('a_in_work');
		$('#'+cuurentBlock).slideUp(200);
		
		$('#'+linkTag).removeClass('a_in_work');
		$('#'+linkTag).addClass('a_in_work_act');
		
		$('#'+block).slideDown(200);
		cuurentLink = linkTag;
		cuurentBlock = block;
	}
}