
$(document).ready(function() {


	
	/**************************************/
	/****** MENU ACCORDEON PRINCIPAL ******/
	$('ul.sous-sous-menu').hide();//on repli tous les sous menus
	$('ul.sous-menu li a.menuOn:eq(0)').next('ul').show();// on déplie le sous menu courant
	/*
	$('ul.sous-menu li a').click(function() {
		  
		var checkElement = $(this).next();
		
		if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
			checkElement.slideUp('fast');
			return false;
		}
		if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
			$('ul.sous-sous-menu:visible').slideUp('fast');
			checkElement.slideDown('fast');
			return false;
		}
	});
	*/
	
	/**************************************/
	/***** MENU ACCORDEON FORMATIONS ******/
	$('div.formationRightCol ul').hide();//on repli tous les sous menus
	
	//initialisation du menu
	if($('div.formationRightCol ul li a.menuOn:eq(0)').length!=0)
		$('div.formationRightCol ul li a.menuOn:eq(0)').parent().parent().show();
	else
		{$('div.formationRightCol ul:eq(0)').show();}
		
	$('div.formationRightCol h3').click(function() {
		  
		var checkElement = $(this).next();
		
		if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
			checkElement.slideUp('fast');
			return false;
		}
		if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
			$('div.formationRightCol ul:visible').slideUp('fast');
			checkElement.slideDown('fast');
			return false;
		}
	});
	
	
	/**********************************************************/
	/***** REDIRECTIONS SUR LA LISTE DES OFFRES D'EMPLOI ******/
	$('tr.offreEmploi').click(function(event){
		document.location.href = $(this).attr('url');
	}); 
	
	/**********************************************************/
	/*********** LIGHTBOX FORMULAIRE CANDIDATURES *************/
	$("#candidature-form").fancybox({
		'width'				: '75%',
		'height'			: '75%',
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'height' 	:540,
		'width':	550
	});
	
	/*********************************************************************************/
	/*********** DISPARITION DES MESSAGES D'ERREURS POUR LES FORMULAIRES *************/
	$(".spip_form_champ span.erreur").click(function(ev){
		$(this).prev('input').focus();
	});
	$(".spip_form_champ input").focus(function(ev){
		$error = $(this).next('span.erreur:visible');
		$error.fadeOut('fast');
	});
	
});
