$(document).ready(function(){ init(); });
function init(){
	$('ul.bloc_onglets').each(function(){
		var new_id = $(this).attr("id");
		var new_rel = $(this).attr("rel");								 
		
		$('ul.bloc_onglets li[rel="'+new_rel+'"]').addClass("active");
		$('.bloc_onglets_contenu').hide();
		$('#'+new_id+'_'+new_rel).show();
	});
	
	$('ul.bloc_onglets li').live('click', function(){ 
		var parent = $(this).parent();
		var parent_id = parent.attr("id");
		var parent_rel = parent.attr("rel");
		
		var new_rel = $(this).attr("rel");
		
		if($(this).attr("class") != "active"){
			parent.attr("rel", new_rel);
			$('li[class="active"]', parent).removeClass("active");
			$(this).addClass("active");
			
			$('#'+parent_id+'_'+parent_rel).hide();
			$('#'+parent_id+'_'+new_rel).show();
		}
	});
}