function passwordChanged() {
var strength = document.getElementById('strength');
var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g");
var mediumRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g");
var enoughRegex = new RegExp("(?=.{6,}).*", "g");
var pwd = document.getElementById("password2");
if (pwd.value.length==0) {
strength.innerHTML = 'Type Password';
} else if (false == enoughRegex.test(pwd.value)) {
strength.innerHTML = 'More Characters';
} else if (strongRegex.test(pwd.value)) {
strength.innerHTML = '<span style="color:green">Strong!</span>';
} else if (mediumRegex.test(pwd.value)) {
strength.innerHTML = '<span style="color:orange">Medium!</span>';
} else {
strength.innerHTML = '<span style="color:red">Weak!</span>';
}
}


    function checkPass(){
      //Store the password field objects into variables ...
      var password2 = document.getElementById('password2');

      var password1 = document.getElementById('password1');
      //Store the Confimation Message Object ...

      var message = document.getElementById('confirmMessage');
      //Set the colors we will be using ...

      var goodColor = "#66cc66";
      var badColor = "#ff6666";
      //Compare the values in the password field 

      //and the confirmation field
      if(password2.value == password1.value){

        //The passwords match. 
        //Set the color to the good color and inform
        //the user that they have entered the correct password 

        password.style.backgroundColor = goodColor;
        message.style.color = goodColor;
        message.innerHTML = "Passwords Match!"

      }else{
        //The passwords do not match.
        //Set the color to the bad color and

        //notify the user.
        password.style.backgroundColor = badColor;
        message.style.color = badColor;

        message.innerHTML = "Passwords Do Not Match!"
      }
    }  

