var toggle_timeout = 5000;
var toggle_duration = 3000;

$(document).ready(function() {
	$('#menu li').mouseover(function () {
		$(this).find('.submenu').show();
	});
	$('#menu li').mouseout(function () {
		$(this).find('.submenu').hide();
	});	
	$('#racks li a.cell1').click(function () {
		$(this).parent().find('.small').slideToggle('slow');
		//return false;/*обработчик нажатия на ссылку в левом меню*/
	});	
	
	$('.gallery a').lightBox({imageBtnPrev: '/e2/templates/kifato/images/lightbox-btn-prev.gif', 
		imageBtnNext: '/e2/templates/kifato/images/lightbox-btn-next.gif', imageBtnClose: '/e2/templates/kifato/images/lightbox-btn-close.gif',
		imageLoading: '/e2/templates/kifato/images/lightbox-ico-loading.gif'});

	setInterval(toggle_splash, toggle_timeout);
	
});

function toggle_splash () {
	
	var splash_active = 0;
	var splash_count = 0;
	while ($('#splash_' + splash_count).length > 0) {		
		if ($('#splash_' + splash_count).css('display') != 'none')
			splash_active = splash_count;
		splash_count++;
	}
	
	if (splash_count < 2) return;
	
	var splash_next = (splash_active >= splash_count - 1)? 0: splash_active + 1;
	$('#splash_' + splash_active).fadeOut(toggle_duration);
	$('#splash_' + splash_next).fadeIn(toggle_duration);

}
