function passwordStrength(password)
{
	var desc = new Array();
	desc[0] = "<b>Siła hasła:</b> Bardzo słabe";
	desc[1] = "<b>Siła hasła:</b> Słabe";
	desc[2] = "<b>Siła hasła:</b> Lepsze";
	desc[3] = "<b>Siła hasła:</b> Średnie";
	desc[4] = "<b>Siła hasła:</b> Silne";
	desc[5] = "<b>Siła hasła:</b> Bardzo Silne";

	var score   = 0;

	if (password.length > 0)
	{
		document.getElementById("passwordStrength").className = "strength" + score;
	
		//if password bigger than 6 give 1 point
		if (password.length > 6) 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++;
		
		//if password has at least one special caracther give 1 point
		if ( password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/) )	score++;
		
		//if password bigger than 12 give another 1 point
		if (password.length > 12) score++;
		
		document.getElementById("passwordStrength").className = "strength" + score;
		document.getElementById("passwordDescription").innerHTML = desc[score];
	 }
	 else
	 {
	 	document.getElementById("passwordStrength").className = "strengthNull";
	 }
}
