﻿
// evaluation de mot de passe
function evalPwd(s)
{
	var cmpx = 0;
	
	if (s.length >= 5)
	{
		cmpx++;
		
		if (s.search("[A-Z]") != -1)
		{
			cmpx++;
		}
		
		if (s.search("[0-9]") != -1)
		{
			cmpx++;
		}
		
		if (s.length >= 8 || s.search("[\x20-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]") != -1)
		{
			cmpx++;
		}
	}
	
	 if (cmpx == 0)
	{   
		document.getElementById("strong").style.background = "#F0F0F0 url()";
		document.getElementById("strong").style.border = "1px solid #808080";
		document.getElementById("strong").style.color = "#808080";
		document.getElementById("strong").innerHTML = "Indicateur de sûreté";
		document.getElementById("strong").style.width = "155px";	 
		
	} else if (cmpx == 1)
	{
		document.getElementById("strong").style.backgroundColor = "#FFD8D8";
		document.getElementById("strong").style.border = "0px solid #AA0000";
		document.getElementById("strong").style.color = "#FFF";
		document.getElementById("strong").innerHTML = "Faible";
		document.getElementById("strong").style.background = 'url("images/surete.gif")';
		document.getElementById("strong").style.width = "50px";
	}
	else if (cmpx == 2)
	{
		document.getElementById("strong").style.backgroundColor = "#FFD8D8";
		document.getElementById("strong").style.border = "0px solid #AA0000";
		document.getElementById("strong").style.color = "#FFF";
		document.getElementById("strong").innerHTML = "Moyen";
		document.getElementById("strong").style.background = 'url("images/surete.gif")';
		document.getElementById("strong").style.width = "100px";
	}
	else
	{
		document.getElementById("strong").style.backgroundColor = "#FFD8D8";
		document.getElementById("strong").style.border = "0px solid #AA0000";
		document.getElementById("strong").style.color = "#FFF";
		document.getElementById("strong").innerHTML = "Fort";
		document.getElementById("strong").style.background = 'url("images/surete.gif")';
		document.getElementById("strong").style.width = "155px";
		
	}
}
