function isInt(sVal){
	for ( var i = 0 ; i < sVal.length ; i ++ ){
		if (sVal.length != 7){
			alert("Le numéro de licence doit comporter 7 chiffres");
			return false
		}
		if (isNaN(parseInt(sVal.charAt(i)))){
			alert("Le numéro de licence doit comporter 7 chiffres");
			return false;
		}
	}
	return true;
}
function isNomPrenom(sStr){
	var okList=' _-\'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzŠšœŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöùúûüýÿ';
	for (var i = 0 ; i < sStr.length ; i++){
		if (okList.indexOf(sStr.charAt(i))==-1){
			alert("Caractère incorrect pour le nom et prénom");
			return false;
		}
	}
	return true;
}
function isNoDeClub(sStr){
	var okList=' 0123456789_-\'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzŠšœŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöùúûüýÿ';
	if (sStr.length != 8){
		alert("Le numéro de club doit comporter 8 caractères");
		return false
	}
	for (var i = 0 ; i < sStr.length ; i++){
		if (okList.indexOf(sStr.charAt(i))==-1){
			alert("Caractère incorrect pour le numéro de club");
			return false;
		}
	}
	return true;
}

function valide(licence, nomprenom, club){
	if (licence == "" && nomprenom == ""  && club == ""){
		alert("Vous devez remplir au moins un des 3 champs");
		return false;
	}
	if (licence != ""){
		if (!isInt(licence)){
			return false;
		}
	}
	if (club != ""){
		if (!isNoDeClub(club)){
			return false;
		}
		else if (licence == "" && nomprenom == ""){
			window.location="../club/liste_club.asp?NUMERO_CLUB=" + club + "&S=F";
			return false
		}
	}
	if (nomprenom != ""){
		if (!isNomPrenom(nomprenom)){
			return false;
		}
	}
	return true;
}

function validenom(nomprenom){
	if (nomprenom == ""){
		alert("Veuillez saisir un nom");
		return false;
	}
	
	return true;
}