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 _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 + 5) + "px"});

	function gallScroll(){
		_links.removeClass('active').eq(_active).addClass('active');
		_block.animate({
			marginTop: -(_h * _active + 5) + "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;
	});
}

function ieHover(h_list){
	if ($.browser.msie && $.browser.version < 7){
		$(h_list).hover(function(){
			$(this).addClass('hover');
		}, function(){
			$(this).removeClass('hover');
		});
	}
}

$(document).ready(function(){
	ieHover('#nav > li');
	initGall();
});
