function passwordStrength(password)
{
        var desc = new Array();
        desc[0] = "Very Weak";
        desc[1] = "Weak";
        desc[2] = "Better";
        desc[3] = "Medium";
        desc[4] = "Strong";
        desc[5] = "Strongest";
		desc[6] = "Strongest";
		desc[7] = "Strongest";
        var score   = 0;
		var number_count = 0;
		var spec_char_count = 0;

        //if password bigger than 6 give 1 point
        if (password.length >= 5) score++;

        //if password has both lower and uppercase characters give 1 point      
        if ( ( password.match(/[a-z]/) ) && ( password.match(/[A-Z]/) ) ) score++;

        //if password has at least one number give 1 point
        if (password.match(/\d+/)) score++;
		
		number_count = password.length - password.replace(/\d+/g,'').length;

		if (number_count > 2) {
			score++;
		}
		
        //if password has at least one special caracther give 1 point
        if ( password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/) ) score++;
		
		spec_char_count = password.length - password.replace(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/g,'').length;
		
		if (spec_char_count > 2) {
			score++;
		}

        //if password bigger than 12 give another 1 point
        if (password.length > 12) score++;

        document.getElementById("passwordDescription").innerHTML = desc[score];
        document.getElementById("passwordStrength").className = "strength" + score;
}