// --- Scripts JS communs à toutes les pages ---

function process_keypress(e)
{
	var eKeyCode = (window.event) ? event.keyCode : e.keyCode;
	if (eKeyCode == 13)
	{			
		// détection touche ENTER
		return false;
	}
}
document.onkeypress = process_keypress;

function activerPageAttente()
{
	document.getElementById('divPageOn').style.display='none';
	document.getElementById('divPageOff').style.display='block';
}

function naviguerPageAttente(url)
{
	activerPageAttente();
	window.location = url;
}

function naviguerPageAttentePourFiche(url)
{
	activerPageAttente();
	window.location = url + "&type=" + typePourFiche + "&fam=" + famPourFiche;
}

//Permet de valider un formulaire avec la touche entrée
function validerAvecEntree(evt)
{
    evt = (evt)? evt : event
    var charCode = (evt.which) ? evt.which : evt.keyCode
    var obj = document.Form1.recharger;
    if(charCode == 13) //touche entrée
    {
		obj.value = "true";
        document.Form1.submit();
    }
    else
		obj.value = "";
}

//permet de filtrer la liste des criteres en fonction de la sélection sur le checkbox 'Sport de Nature'
function ClicSportNature()
{
	var choix = document.Form1.rblEquSportNature;
	var tbl1 = document.getElementById('tblCriteresNature');
	var tbl2 = document.getElementById('tblCriteresNonNature');
	if(tbl1 != null && tbl2 != null)
	{
		if(choix[0].checked == true)
		{
			tbl1.style.display = 'block';
			tbl2.style.display = 'none';
		}	
		if(choix[1].checked == true)
		{
			tbl1.style.display = 'none';
			tbl2.style.display = 'block';
		}
		if(choix[2].checked == true)
		{
			tbl1.style.display = 'block';	
			tbl2.style.display = 'block';
		}
	}
}