function hide_auth(){
	$$('#connection input').each(function(e){
		if(e.value!=''){
			e.style.backgroundImage="none";
		}
	});
}
function hide1() {
   	$('sous_rub_presentation').hide();
   	$$('#presentation .lienniv1')[0].removeClassName('current2');
}
function hide2() {
    $('sous_rub_actualites').hide();
    $$('#actualites .lienniv1')[0].removeClassName('current2');
}
function hide3() {
    $('sous_rub_conseil').hide();
    $$('#conseil .lienniv1')[0].removeClassName('current2');
}
function hide4() {
    $('sous_rub_formations').hide();
    $$('#formations .lienniv1')[0].removeClassName('current2');
}
function hide5() {
    $('sous_rub_articles').hide();
    $$('#articles .lienniv1')[0].removeClassName('current2');
}
function hide_menu(idmenu){
    $('sous_rub_'+idmenu).hide();
    $$('#'+idmenu+' .lienniv1')[0].removeClassName('current2');
}

var timer=null;
var timer2=null;
var timer3=null;
var timer4=null;
var timer5=null;
function attacherAction(){
	if($('presentation')){
		$('presentation').onmouseover = function() {
			window.clearTimeout(timer);
	       $('sous_rub_presentation').show();
	       $$('#presentation .lienniv1')[0].addClassName('current2');
	    }
		$('presentation').onmouseout = function() {
			timer=window.setTimeout("hide1()",1);
	    }
	}
	if($('actualites')){
		$('actualites').onmouseover = function() {
			window.clearTimeout(timer2);
	       $('sous_rub_actualites').show();
	       $$('#actualites .lienniv1')[0].addClassName('current2');
	    }
		$('actualites').onmouseout = function() {
			timer2=window.setTimeout("hide2()",1);
	    }
	}
	if($('conseil')){
		$('conseil').onmouseover = function() {
			window.clearTimeout(timer3);
	       $('sous_rub_conseil').show();
	       $$('#conseil .lienniv1')[0].addClassName('current2');
	    }
		$('conseil').onmouseout = function() {
			timer3=window.setTimeout("hide3()",1);
	    }
	}
	if($('formations')){
		$('formations').onmouseover = function() {
			window.clearTimeout(timer4);
	       $('sous_rub_formations').show();
	       $$('#formations .lienniv1')[0].addClassName('current2');
	    }
		$('formations').onmouseout = function() {
			timer4=window.setTimeout("hide4()",1);
	    }
	}
	if($('articles')){
		$('articles').onmouseover = function() {
			window.clearTimeout(timer5);
	       $('sous_rub_articles').show();
	       $$('#articles .lienniv1')[0].addClassName('current2');
	    }
		$('articles').onmouseout = function() {
			timer5=window.setTimeout("hide5()",1);
	    }
	    if($('sous_rub_articles').getDimensions().height>350){
			$('sous_rub_articles').style.top="-300px";
	    }else if($('sous_rub_articles').getDimensions().height>250){
			$('sous_rub_articles').style.top="-200px";
	    }else if($('sous_rub_articles').getDimensions().height>150){
			$('sous_rub_articles').style.top="-100px";
	    }else if($('sous_rub_articles').getDimensions().height>80){
			$('sous_rub_articles').style.top="-30px";
	    }
	}
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

//addLoadEvent(attacherAction); 

function agrandir(){
	if(parseFloat($('article').style.fontSize)<3){
		$('article').style.fontSize=parseFloat($('article').style.fontSize)+0.25+'em';
	}
}
function minimiser(){
	if(parseFloat($('article').style.fontSize)>1){
		$('article').style.fontSize=parseFloat($('article').style.fontSize)-0.25+'em';
	//$('titre_article').style.fontSize=parseInt($('titre_article').style.fontSize)-2+'em';
	}
}

function checkVisibility(){
	var ret=false;
	$$('#liste_rubrique li').each(function(e){ 
		if(e.hasClassName('un_li')){
	      	id=e.id;
			if($('check_'+id).checked){
	 			ret=true;
			}
	    }
	 }); 
	 return ret;
}

function verifVisibility(){
	if(checkVisibility()){
		$('tout_checkbox').checked=false;
	}else{
		$('tout_checkbox').checked=true;
	}
}
function checkRecherche(id){
	if($('fils_'+id).visible()){
		decheckOK(id);
	}else{
		checkOK(id);
	}
	verifVisibility();
}
function checkOK(id){
	$('fils_'+id).show();
	$$('#fils_'+id+' input[type=checkbox]').each(function(f){
        f.checked=true;
    }); 
    $('puce_deroule_'+id).show();
    $('puce_'+id).hide();
}
function decheckOK(id){
	$('fils_'+id).hide();
	$$('#fils_'+id+' input[type=checkbox]').each(function(f){
        f.checked=false;
    }); 
    $('puce_deroule_'+id).hide();
    $('puce_'+id).show();
}

function decheckAll(){
	$$('#liste_rubrique li').each(function(e){ 
		if(e.hasClassName('un_li')){
	      	id=e.id;
			$('check_'+id).checked=false;
			decheckOK(id);
	    }
	 }); 
	/*
	decheckOK('presentation');
	$('check_presentation').checked=false;
	decheckOK('actualites');
	$('check_actualites').checked=false;
	decheckOK('conseil');
	$('check_conseil').checked=false;
	decheckOK('formations');
	$('check_formations').checked=false;
	$('tout_checkbox').checked=true;*/
}

// ajoute automatiquement la classe focus et mouseover aux �l�ments de formulaires submit
function autofocus()
{
	$$('input[type=submit]').each(function(f){
		Event.observe(f, 'mouseover', function() {
			f.removeClassName('focus');
			f.addClassName('mouseover');
			//f.hasClassName('fruit');
		});
		Event.observe(f, 'mouseout', function() {
			f.removeClassName('mouseover');
			f.removeClassName('focus');
		});
		/*Event.observe(f, 'focus', function() {
			f.removeClassName('mouseover');
			f.addClassName('focus');
		});*/
		Event.observe(f, 'blur', function() {
			f.removeClassName('mouseover');
			f.addClassName('focus');
		});
     });
}
addLoadEvent(autofocus);


function clic_detect(id){
	var url = '/ajax/clic_detect/index.html';
	var pars = 'id='+id;
	var myAjax = new Ajax.Request(
		url, 
		{
			method: 'post', 
			parameters: pars
		});
}

function calculs_ombres_interieurs(){
	if($('contenu').getHeight()+20>=$$('.menu')[0].getHeight()){
		ajout=$('contenu').getHeight()+20-$$('.menu')[0].getHeight();
		$('agrandir_fond').style.height=parseInt($('agrandir_fond').getHeight()-15)+ajout+'px';
	}else{
		ajout=$$('.menu')[0].getHeight()-$('contenu').getHeight()-20;
		$('contenu').style.height=parseInt($('contenu').getHeight())+ajout+'px';
	}
}


function calculs_ombres_accueil(){
	ajout=$('contenu').getHeight()+3-$$('.menu')[0].getHeight();
	$('agrandir_fond').style.height=parseInt($('agrandir_fond').getHeight()-15)+ajout+'px';
}


function hide_me(){
	$('pulsate_me').hide()
	setTimeout("show_me();", 500);
}
function show_me(){
	$('pulsate_me').show()
	setTimeout("hide_me();", 500);
}

function deplit(id){
	$('underlevel_'+id).show();
	$('replit_'+id).show();
	$('deplit_'+id).hide();
}
function replit(id){
	$('underlevel_'+id).hide();
	$('replit_'+id).hide();
	$('deplit_'+id).show();
}



