$(function(){
	var slideLength = $('.campus').length;
	var lastIndex = 0;
	var lastHeight = 0;
	
	setTimeout( function () {
		$('.campus-wrapper').height( $('.campus').eq(0).height () );
		$('.campus').eq(0).fadeIn('fast')
	}, 2000);
	
	$('#slides').slides({
		preload: true,
		preloadImage: 'images/design/loading.gif',
		play: 8000,
		pause: 2500,
		fadeSpeed:850,
		slideSpeed:850,
		autoHeightSpeed:1000,
		hoverPause: true,
		animationStart: function(){				
			lastIndex = $('#slides')[0].getClicked ();
			$('.campus-wrapper').height( $('.campus').eq(lastIndex).height () );
		},// Function called at the start of animation
		animationComplete: function(){ 
			currentIndex = $('#slides')[0].getClicked ();
			$('.campus').eq(lastIndex).fadeOut();
			$('.campus').eq(currentIndex).fadeIn('fast', function () {
				$('.campus-wrapper').css('height', $('.campus').eq(currentIndex).height());
			}); 	
		}
	});
	$(".video-plus").hide();
	$('.list-video a').click(function() {
		$(this).toggleClass('active');		
		$('.video-plus').toggle('400');
	});
	
	$('.video-plus a').click(function() {
		$('.video-plus').hide('slow');		
		$('.list-video a').removeClass('active');
	});

	//choix vidéo
	//$('[id^=videeo_]').click(function(){
	$('.video-plus a').click(function(){
		$.ajax({
		type:"POST",
		url:j_basepath + "index.php",
		data:"module=commun&action=FoCommun:chargeVideo&video_id="+$(this).attr('id'),
		async: false,
		success:function(data){
			$('#zoneVideo').html('');
			$('#zoneVideo').html(data);
		}
	});
	});
});
