$(document).ready(function() { var strPassword; var charPassword; var complexity = $("#security"); var minPasswordLength = 8; var baseScore = 0, score = 0; var num = {}; num.Excess = 0; num.Upper = 0; num.Numbers = 0; num.Symbols = 0; var bonus = {}; bonus.Excess = 3; bonus.Upper = 4; bonus.Numbers = 5; bonus.Symbols = 8; bonus.Combo = 0; bonus.FlatLower = 0; bonus.FlatNumber = 0; outputResult(); $("#password").bind("keyup", checkVal); function checkVal() { init(); if (charPassword.length >= minPasswordLength) { baseScore = 50; analyzeString(); calcComplexity(); } else { baseScore = 0; } outputResult(); } function init() { strPassword= $("#password").val(); charPassword = strPassword.split(""); num.Excess = 0; num.Upper = 0; num.Numbers = 0; num.Symbols = 0; bonus.Combo = 0; bonus.FlatLower = 0; bonus.FlatNumber = 0; baseScore = 0; score =0; } function analyzeString () { for (i=0; i=75 && score<95) { complexity.html(" ").removeClass("stronger strongest").addClass("strong"); } else if (score>=100 && score<145) { complexity.html(" ").removeClass("strongest").addClass("stronger"); } else if (score>=180) { complexity.html(" ").addClass("strongest"); } } } );