I have a jQuery script that checks for the strength of a password. The code looks like this (with more more of those "blocks"):
if(passwordLC && lessThan12Password)
{
$('.passwordStrenght').animate({width:'75px',height:'5px'},200).show();
$('.passwordStrenght').css('background-color',red);
$('#password').css('border-color',green);
$('.passwordStrenghtInfo').text(weak).show();
passwordErrors = true;
}else
if(passwordUC && lessThan12Password)
{
$('.passwordStrenght').animate({width:'75px',height:'5px'},200).show();
$('.passwordStrenght').css('background-color',red);
$('#password').css('border-color',green);
$('.passwordStrenghtInfo').text(weak).show();
passwordErrors = true;
}else
if(passwordN && lessThan12Password)
{
$('.passwordStrenght').animate({width:'75px',height:'5px'},200).show();
$('.passwordStrenght').css('background-color',red);
$('#password').css('border-color',green);
$('.passwordStrenghtInfo').text(weak).show();
passwordErrors = true;
}else
And it goes on and on...
Is there a way to reduce all that code to something simpler and efficient, or am I stuck with those horrible "blocks" of repeated code?