function initGall(){
	var _hold = $('.slice');
	var _links = _hold.find('.svicher > li');
	var _block = _hold.find('.items');
	var _active = _links.index(_links.filter('.active:eq(0)'));
	var _h = _hold.height();
	var _w = _hold.width();
	var _count = _links.index(_links.filter(':last'));
	var _speed = 6000;
	var _time = 700;
	var _t;
	
	if (_active == -1) {
		_active = 0;
		_links.eq(_active).addClass('active');
	}
	_block.css({marginTop: -(_h * _active) + "px"}); 
/*	_block.css({marginLeft: -(_w * _active) + "px"}); */



	
	function gallScroll(){
		_links.removeClass('active').eq(_active).addClass('active');
		_block.animate({
			marginTop: -(_h * _active) + "px" 
/*			marginLeft: -(_w * _active) + "px" */
		}, {queue:false, duration: _time});
	}
	
	function timeGo(){
		_t = setInterval(function(){
			_active++;
			if (_active > (_count)) _active = 0;
			gallScroll();
		}, _speed);
	}
	timeGo();
	_links.click(function(){
		if(_t) clearTimeout(_t);
		_active = _links.index($(this));
		gallScroll();
		timeGo();
		return false;
	});
}
$(document).ready(function(){
	initGall();
});
