var openAccordion = null;

$(document).ready(function() {
	
	//category navigator
	
	var menuAccordionOption = {
		autoHeight: false,
		header: 'h2.toggle',
		selectedClass: 'active',
		active:  false		
	};
	
	if(openAccordion != null)
	{
		menuAccordionOption.active = $(openAccordion).prev('h2');
		$('#une').attr('class', 'unes');
	}
	
	$('#menu').accordion(menuAccordionOption);	
	
	$('#acc').accordion({
		autoHeight: false,
		header: 'h2.toggle',
		selectedClass: 'active'													
	});	
	
	
	$('#menu').bind('accordionchange', function(event, ui) { 
		$('#une').attr('class', 'unes');
	});	
	
	$('#une').click(function() {	
		$('#une').attr('class', 'une') ;
		$('#themes').attr('class', 'toggle') ;
		$('#channels').attr('class', 'toggle') ;
		$('#partners').attr('class', 'toggle') ;
		$('#menu').accordion({
			autoHeight: false,
			header: 'h2.toggle',
			selectedClass: 'active',
			active:  false												
		});	
	});
	
	
	//inputs interactions
	
	$('#inputInvit').one('focus', function() {
		$(this).val('');
	});

	$('#inputGoInvit').bind('click', function() {
		var email = $('#inputInvit').val();
		var href  = $(this).attr('href');
		$(this).attr('href', href.replace('##mail##', email));
	});

	jQuery('.share textarea, .share input').focus(function() { 
		this.select();
	});
	
	jQuery('.share textarea, .share input').click(function() {
		this.select();
	});
	 
	
	//comment
	
	$('#formComment').css('display', 'none');				
	$('#addCommentLink').click(function(){
		$('#formComment').slideToggle('slow');
	 });
});

