function str_change($id,$text){
	$('#level2').removeClass().addClass('str_sect'+$id).load('spip.php?page=structure&id_rubrique='+$id,function(){
		if ($id != 46){ $('.left_top').fadeOut(600); } else {
			$('.left_top').hide();
			$('#structure_logo').addClass('str_logo'+$id);
			$('#structure_logo').show();
		}
		display();
		$(this).stop().animate({'left':'0px'},1200);
		$('#top').stop().animate({'left':'-383px'},1200,function(){
			if ($id != 46){
				$('#structure_logo').addClass('str_logo'+$id);
				$('#structure_logo').fadeIn(600);
			}
		});
		$('#str_title').html('Structure / '+$text);
		$('#str_back').show();
	});
}

function str_back(){
	var dragon = false;
	if ($('#level2').hasClass('str_sect46')){
		$('#structure_logo').hide();
		$('#structure_logo').removeClass();
		$('.left_top').show();
		dragon = true;
	} else {
		$('#structure_logo').fadeOut(600,function(){
			$(this).removeClass();
		});
	}
	$('#level2').stop().animate({'left':'383px'},1200,function(){
		$(this).removeClass();
		if (dragon == false){
			$('.left_top').fadeIn(600);
		}
	});
	$('#top').stop().animate({'left':'0px'},1200);
	$('#str_title').html('Structure');
	$('#str_back').hide();
}

function display(){
	var staff_open = 0;
	
	$('.structure_sub').each(function(){
		var $id = $(this).attr('id').replace('str','');
		$(this).click(function(e){
			if (staff_open == 0){
				staff_open = 1;
				var posx = e.pageX - 325;
				var posy = e.pageY - 15;
				$('body').prepend('<div id="staff" style="display:none;">&nbsp</div>');
				$('#staff').load('spip.php?page=staff&id_rubrique='+$id,function(){
					$(this).css({left:posx,top:posy}).stop().fadeIn(400);
					
					$('#staff_close').click(function(){
						staff_open = 0;
						$('#staff').stop().fadeOut(400, function(){
							$(this).remove();
						});
						return false;
					});
				});
			}
		});
	});
}