


$(document).ready(function(){		
	//bouton pour se connecter
	if($('#seConnecter')){
		$('#seConnecter').click(function(){
			if($('#loginForm').css('display') == 'none') $('#loginForm').slideDown('fast');
			else if($('#loginForm').css('display') == 'block') $('#loginForm').slideUp('fast');		
		});
	}
	
	//gestion bouton depliant
	$(".article_depliant H3").click(function(){		
		
		categorie = $(this).attr('class').split('_');
		categorie = categorie[1];
		
		if($(this).next().css('display') == 'block'){			
			//on met le bg dégradé
			image = 'url(pics/charte/bg-depliant-'+categorie+'.jpg)';
			$(this).css('background', image ) ;				
			//on met le +
			image = 'url(pics/charte/plus-'+categorie+'.gif) no-repeat';
			$(this).children('a').css('background', image) ;
			//on remonte les éléments
			$(this).next().slideUp();
			$(this).next().next().slideUp();
		}
		else if($(this).next().css('display') == 'none'){	
			//on retire le bg dégradé
			$(this).css('background', 'none') ;
			//on met le -
			image = 'url(pics/charte/moins-'+categorie+'.gif)';		
			lien = $(this).children('a');
			lien = lien[0];			
			$(lien).css('background-image', image);		
			//on descend les éléments
			$(this).next().slideDown();
			$(this).next().next().slideDown();
		}
		return false ;
	});
	
	//gestion bouton + de commentaires	
	$('#commentairesSuite').click(function(){
		$('#listeCommentaires').slideDown('fast');
		return false; 
	});
	
	//gestion bouton + de liens	
	$('.liensArticleSuite').click(function(){
		$('.lienPlus').slideDown('fast');
		return false; 
	});
	
	//gestion bouton envoyer à un ami	
	$('.sendArticle').click(function(){
		$('#sendArticleForm').slideDown('fast');
		return false; 
	});
	//à déplier si #friend dans url
	var url = new String(window.location) ;
	var reg = new RegExp("#friend", "g");	
	if (url.match(reg)) {
	 	$('#sendArticleForm').show();
	}
	
});

function aff(zone) {
	if($('#'+zone+'').css('display') == "none")
		$('#'+zone+'').slideDown('fast');
	else $('#'+zone+'').slideUp('fast');
}