// JavaScript Document


$(document).ready(function(){
	var i=0;
	var actif=0;
	$('li.subMenu').each(function(){
		i++;
		$(this).data('etat','close');
		$(this).data('i',i);
		if(!$(this).children('ul').hasClass('selected'))
			$(this).children('ul').hide();
		$(this).children('span').bind('click',function(){
			//alert($(this).children('ul').data('etat'));
			if(!$(this).parent().children('ul').hasClass('selected')){
				if( $(this).parent().data('etat')=='close'){
					$(this).parent().children('ul').stop();
					$(this).parent().children('ul').slideDown('fast');
					$(this).parent().data('etat','open');
					actif = $(this).parent().data('i');
					$('li.subMenu').each(function(){
						if($(this).data('etat')=='open' && $(this).data('i') != actif){
							$(this).children('ul').slideUp('fast');
							$(this).data('etat','close');
						}
					});
				}else{
					$(this).parent().children('ul').stop();
					$(this).parent().children('ul').slideUp('fast');
					$(this).parent().data('etat','close');
				}
			}
			
		});
	});
	$('li.footerSubMenu').each(function(){
		$(this).children('ul')
			.css('display','block')
			.hide();
		$(this).hover(function(){
					$(this).children('ul').stop(true, true);
					$(this).children('ul').slideDown('fast');
		},function(){
					$(this).children('ul').stop(true, true);
					$(this).children('ul').slideUp('fast');
		});
	});
});
