var index = 0;
var sens = 0;
function to_the_left()
{
	$('.carousel').animate({		
    	marginLeft: '-=183',
    	opacity: 0.3    			
	},	
	{
		duration:100,
		complete:function() {
			$(".carousel").css({ opacity: 1 });	 
		}
	}
	);	
}

function to_the_right()
{
	$('.carousel').animate({		
    	marginLeft: '+=183',
    	opacity: 0.3    			
	},	
	{
		duration:100,
		complete:function() {
			$(".carousel").css({ opacity: 1 });	 
		}
	}
	);
}
function move_carousel( nr_elemente )
{
	//alert(index);
	if(sens == 0)
	{
		to_the_left();
		index++;
	}
	if( sens == 1)
	{
		to_the_right();
		index--;
	}
	
	if(index == nr_elemente - 3 && sens == 0)
	{ 
		sens = 1;
		index = nr_elemente-1;
	}
	if( index == 2 && sens == 1)
	{
		sens = 0;
		index = 0;
	}
	
	setTimeout("move_carousel('"+nr_elemente+"')",2000);
	
}
cadru_curent = 1;
function init_cycle()
{
	for(i=1; i <= 3; i++)
	{
		$('#cycle'+ i).cycle();
		$('#cycle2_'+ i).cycle();
	} 
}
function pause_cycle()
{
	for(i=1; i <= 3; i++)
	{
		$('#cycle'+ i).cycle('pause');
		$('#cycle2_'+ i).cycle('pause');
	} 
}
function pause_item()
{
	$('#cycle'+cadru_curent).cycle('pause');
	$('#cycle2_'+cadru_curent).cycle('pause');
	cadru_curent++;
	if(cadru_curent > 3)
		cadru_curent = 1;
	setTimeout('slide_all()',3000);			
}
function slide_all()
{
	
	
	$('#cycle' +  cadru_curent).cycle('resume');
	$('#cycle2_' +  cadru_curent).cycle('resume');
	setTimeout('pause_item()', 1000);
	
}
function show_categorie(id_categorie)
{	
	for(i = 1; i < 100; i++)
	{
		if (i == id_categorie)
			continue;
		arg = "categorie_"+i;
		$('#'+arg).fadeOut('fast');
	}
	$('#categorie_'+id_categorie).fadeIn('slow');
}



