function testPassword(passwd){
var description = new Array();
description[0] = '<label for="largbt">Niveau de sécurité du mot de passe :</label><img src="skin/guppytop/images/tools/rank1.gif"><br /><span style="color:#FF0000;font-weight: bold;font-size:12px">Très faible</span>';
description[1] = '<label for="largbt">Niveau de sécurité du mot de passe :</label><img src="skin/guppytop/images/tools/rank2.gif"><br /><span style="color:#FFA201;font-weight: bold;font-size:12px">Faible</span>';
description[2] = '<label for="largbt">Niveau de sécurité du mot de passe :</label><img src="skin/guppytop/images/tools/rank3.gif"><br /><span style="color:#C0C000;font-weight: bold;font-size:12px">Moyen</span>';
description[3] = '<label for="largbt">Niveau de sécurité du mot de passe :</label><img src="skin/guppytop/images/tools/rank4.gif"><br /><span style="color:#00C0C0;font-weight: bold;font-size:12px">Elevé</span>';
description[4] = '<label for="largbt">Niveau de sécurité du mot de passe :</label><img src="skin/guppytop/images/tools/rank5.gif"><br /><span style="color:#00C000;font-weight: bold;font-size:12px">OPTIMALE</span>';
description[5] = '<label for="largbt">Niveau de sécurité du mot de passe :</label><img src="skin/guppytop/images/tools/rank0.gif"><br />';


		var intScore   = 0
		var strVerdict = 0
		
		// PASSWORD LENGTH
		if (passwd.length==0 || !passwd.length)	{
			intScore = -1
		}
		else if (passwd.length>0 && passwd.length<5){
			intScore = (intScore+3)
		}
		else if (passwd.length>4 && passwd.length<7){
			intScore = (intScore+6)
		}
		else if (passwd.length>6 && passwd.length<11){
			intScore = (intScore+12)
		}
		else if (passwd.length>10){
			intScore = (intScore+18)
		}
		
		if (passwd.match(/[a-z]/)){
			intScore = (intScore+1)
		}
		
		if (passwd.match(/[A-Z]/)){
			intScore = (intScore+5)
		}
		if (passwd.match(/\d+/)){
			intScore = (intScore+5)
		}
		
		if (passwd.match(/(.*[0-9].*[0-9].*[0-9])/)){
			intScore = (intScore+5)
		}

		if (passwd.match(/.[!,@,#,$,%,^,&,*,?,_,~]/)){
			intScore = (intScore+5)
		}
			if (passwd.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/))	{
			intScore = (intScore+5)
		}
	
		if (passwd.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/))	{
			intScore = (intScore+2)
		}

		if (passwd.match(/(\d.*\D)|(\D.*\d)/))	{
			intScore = (intScore+2)
		}
 		if (passwd.match(/([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/)){
			intScore = (intScore+2)
		}
	
	
		if(intScore == -1)		{
		   strVerdict = description[5];
		}
		else if(intScore > -1 && intScore < 11)		{
		   strVerdict = description[0];
		}
		else if (intScore > 10 && intScore < 21)		{
		   strVerdict = description[1];
		}
		else if (intScore > 20 && intScore < 31)		{
		   strVerdict = description[2];
		}
		else if (intScore > 30 && intScore < 35)		{
		   strVerdict = description[3];
		}
		else		{
		   strVerdict = description[4];
		}
	
	document.getElementById("Words").innerHTML= (strVerdict);
}

function GeneratePassword() {

    var length=8;
    var sPassword = "";
    length = document.myform.charLen.options[document.myform.charLen.selectedIndex].value;

    var noPunction = (document.myform.punc.checked);
    var randomLength = (document.myform.rLen.checked);

    if (randomLength) {
        length = Math.random();
        length = parseInt(length * 100);
        length = (length % 7) + 6
    }


    for (i=0; i < length; i++) {
        numI = getRandomNum();
        if (noPunction) { while (checkPunc(numI)) { numI = getRandomNum(); } }
        sPassword = sPassword + String.fromCharCode(numI);
    }

    document.myform.passField.value = sPassword
    return true;
}

function getRandomNum() {
    var rndNum = Math.random()
    rndNum = parseInt(rndNum * 1000);
    rndNum = (rndNum % 94) + 33;
    return rndNum;
}

function checkPunc(num) {
    if ((num >=33) && (num <=47)) { return true; }
    if ((num >=58) && (num <=64)) { return true; }
    if ((num >=91) && (num <=96)) { return true; }
    if ((num >=123) && (num <=126)) { return true; }
    return false;
}