
function numero_valide(numCarte){
		if (numCarte != ''){
			var position = 0;
			var numeroComplet = numCarte;
			var multiplicateur = 1;
			var totalPartiel = 0;
			
			var message = '';
			   
			var n = numeroComplet.length;
			if ( n == 17) {
				total = parseInt(numeroComplet.substr(n-1, 1)); //attention IE ne comprend pas subtr(-1,1)
			
				for (var i = n-1; i>0; i--) {

					chiffreCourant = parseInt(numeroComplet.charAt(i-1));
					
					multiplicateur = 3 - multiplicateur;
					
					totalpartiel =  parseInt(multiplicateur * chiffreCourant);
					
					if (totalpartiel > 9) {
						totalpartiel = totalpartiel+1;	
					}
					
					total = total + totalpartiel;
						 
				}

				total_div = total/10;
				
				if( total_div == parseInt(total_div) ){
					return true;
				} else {
					message = "Le numéro de compte que vous avez saisi est incorrect";
				}
			} else {
				message = "Merci de saisir votre numéro de compte sur 17 chiffres";
			}
			
			
		} else {
			message = "Merci de saisir votre numéro de compte";
		}
		return message;
}



function numerossprefix_valide(prefix,numCarte){
		if (numCarte != ''){
			var position = 0;
			var numeroComplet = prefix+numCarte;
			var multiplicateur = 1;
			var totalPartiel = 0;
			
			var message = '';
			   
			var n = numeroComplet.length;
			if( n == 15){
				// si 9 chiffres tapés + 6 chiffres de prefix
				return true;
			}
			
			if ( n == 17 ) {
				total = parseInt(numeroComplet.substr(n-1, 1)); //attention IE ne comprend pas subtr(-1,1)
			
				for (var i = n-1; i>0; i--) {

					chiffreCourant = parseInt(numeroComplet.charAt(i-1));
					
					multiplicateur = 3 - multiplicateur;
					
					totalpartiel =  parseInt(multiplicateur * chiffreCourant);
					
					if (totalpartiel > 9) {
						totalpartiel = totalpartiel+1;	
					}
					
					total = total + totalpartiel;
						 
				}

				total_div = total/10;
				
				if( total_div == parseInt(total_div) ){
					return true;
				} else {
					message = "Le numéro de compte que vous avez saisi est incorrect";
				}
			} else {
				message = "Merci de saisir votre numéro de compte sur 9 ou  11 chiffres";
			}
			
			
		} else {
			message = "Merci de saisir votre numéro de compte";
		}
		return message;
}
