function list(inid)
	{
	var temp = inid.split('_');
	var place = temp[0];

	if($('#'+inid).attr('class')=='active')
		{
		$('#'+inid).removeAttr('class');
		$('#'+inid+'_cont').attr('class', 'hide');
		}
	else
		{
		$(document).ready(function()
			{
			for(i = 1; i<50; i++) 
				{
				$('#'+place+'_'+i).removeAttr('class');
				$('#'+place+'_'+i+'_cont').attr('class', 'hide');
				}
			$('#'+inid).attr('class', 'active');
			$('#'+inid+'_cont').removeAttr('class');
			});
		}
	}
$(document).ready(function()
	{
	$('#fixed-pane .personal').load('/basket.php?count');//carousel setup - page setting
	$('.carousel').carousel({dispItems: 1,loop: true,autoSlide: true,autoSlideInterval: 5000,delayAutoSlide: 5000,animSpeed: "slow"});
	//carousel buttons null - page setting 	
	$('input.previous').attr('value', '');
	$('input.next').attr('value', '');
	$('.more li').bind('click', function()
		{
		list($(this).attr('id'));
		});
	$('.list li').bind('click', function() 
		{
		list($(this).attr('id'));
		});
	$('.drop li').bind('click', function()
		{
		list($(this).attr('id'));
		});
	$('.basket').bind('click', function()
		{
		$('#popup-pane .inner').load('/basket.php?order&add='+$(this).attr('id'));
		$('#fixed-pane .personal').load('/basket.php?count');
		return false;
		});
	$('.personal').bind('click', function()
		{
		$('#popup-pane .inner').load('/basket.php?order');
		$('#popup-pane').removeAttr('class');
		return false;
		});
	$('.close').bind('click', function()
		{
		$('#popup-pane .inner').load('/basket.php?order');
		$('#popup-pane').attr('class', 'hide');
		$('#popup-pane .inner').html('<div class="loader"></div>');
		return false;
		});
	});
var rotator_timer = false;
function theRotator() {
	
	// Устанавливаем прозрачность всех картинок в 0
	$('div#rotator ul li').css({opacity: 0.0});
 
	// Берем первую картинку и показываем ее (по пути включаем полную видимость)
	$('div#rotator ul li:first').css({opacity: 1.0});
 
	// Вызываем функцию rotate для запуска слайдшоу, 5000 = смена картинок происходит раз в 5 секунд
	start_rotate();
}

function pause_rotate()
	{
	clearInterval(rotator_timer);
	rotator_timer = false;
	}
	
function start_rotate()
	{
	rotator_timer = rotator_timer?rotator_timer:setInterval('rotate()',10000);
	}	
function rotate() {	
	// Берем первую картинку
	var current = ($('div#rotator ul li.show')?  $('div#rotator ul li.show') : $('div#rotator ul li:first'));
 
	// Берем следующую картинку, когда дойдем до последней начинаем с начала
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator ul li:first') :current.next()) : $('div#rotator ul li:first'));	
 
	// Расскомментируйте, чтобы показвать картинки в случайном порядке
	// var sibs = current.siblings();
	// var rndNum = Math.floor(Math.random() * sibs.length );
	// var next = $( sibs[ rndNum ] );
 
	// Подключаем эффект растворения/затухания для показа картинок, css-класс show имеет больший z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);
 
	// Прячем текущую картинку
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
};
$(document).ready(function() {		
	// Запускаем слайдшоу
	//theRotator();
	//$('div#rotator').mouseover(pause_rotate).mouseout(start_rotate);
});
