/* _____________________________________________ fonctions générales à tout le site ___________________________________________________*/

function set_langue( langue, redirection, local)
{
	var expcookies =new Date();
	expcookies.setDate(expcookies.getDate()+730);

	if(local) EcrireCookie( local, langue, expcookies, '/');
	else EcrireCookie( 'c_id_trad', langue, expcookies, '/');
	self.top.location.href = redirection;

}

$(document).ready(function () {
	//___ on cache les déroulants JQUERY
	$('.selectbox ul').hide();
	
	$('.bloc_select ul li').hover(
		function()
		{	
			$(this).find('.selectbox').show();
			$(this).find('.selectbox ul').show();
		},
		function()
		{
			$(this).find('.selectbox').hide();
			$(this).find('.selectbox ul').show();
		}
	);
	
	
	$('.selectbox_bt').hover(
		function()
		{	
			$(this).find('.selectbox ul').show();		
		},
		function()
		{
			$(this).find('.selectbox ul').hide();
		}
	);
	//___ on cache les déroulants VIDE
	$(".selectbox_bt .selectbox:empty").each(function(i){
		$(this).hide();
		$(this).parent().parent().hide();
	});
	
	$(".gr_sst").hover(
		function(){
			$(this).css('cursor', 'pointer');
			var layer = $(this).parent().find(".sst_layer");
			if(!layer.attr('class')) layer = $("#sst_layer"+$(this).attr('id').substr($(this).attr('id').lastIndexOf('_')));
			layer.css('left', $(this).position().left + 7);
			layer.css('top', $(this).position().top - layer.outerHeight());
			layer.show();
		},
		function(){
			var layer = $(this).parent().find(".sst_layer");
			if(!layer.attr('class')) layer = $("#sst_layer"+$(this).attr('id').substr($(this).attr('id').lastIndexOf('_')));
				layer.hide();
		}
	);
	
	$(".organigramme .portrait:not(:empty)").each(function(i){
		$(this).hide();
		//$(this).parent().find('.detail_perso').append('<a class="icoportrait"><span>afficher la photo</span><span class="layer_portrait"></span></a>')
	});
	$(".organigramme .portrait:empty").each(function(i){
		$(this).parent().find('.icoportrait').hide();
	});
	
	$(".organigramme .detail_perso .icoportrait").hover(
		function()
		{	
			$(this).find(".layer_portrait").html($(this).parent().parent().find('.portrait').html());
			$(this).find(".layer_portrait").show();
			//$(this).parent().parent().find('.portrait').show();		
		},
		function()
		{
			$(this).find(".layer_portrait").html('');
			//$(this).parent().parent().find('.portrait').hide();		
		}
	);	
	
	
});
