$(function(){					
	//cache nav
	var nav = $("#topNav");
	
	$( "#accordion" ).accordion({ autoHeight: false ,collapsible: true});

	
	//add indicator and hovers to submenu parents
	nav.find("li").each(function() {
		if ($(this).find("ul").length > 0) {
			//show subnav on hover
			$(this).mouseenter(function() {
				$(this).find("ul").stop(true, true).slideDown();
			});
			
			//hide submenus on exit
			$(this).mouseleave(function() {
				$(this).find("ul").stop(true, true).slideUp();
			});
		}
	});
				
	$('#news ul').moodular({

        controls: 'index',
		speed: 1000,
		dispTimeout     : 8000
	});
	
	$('#flux_twitter ul').moodular({

        effects: 'fade',
		speed: 1000,
		dispTimeout     : 3000
	});


	$(".gallery a").fancybox({
		'titleShow'     : false
	});
	
	
	//bloc carousel
	function hasMoved(moodular) {
	}
	var mood = $('#footer_blocs ul.carouselBlocs').moodular({
			auto: false,
			callbacks: [hasMoved],
			api: true,
			speed: 1000,
		dispTimeout     : 8000
	});
	$('#footer_blocs a.next').bind('click', function () { mood.next(); return false; });

	
});
