 $(document).ready(function(){
   
   $("#hrefTogglePwd").toggle(function(){
      $("#divPwdRetrival_new").show('fast'); 
      $("#hrefTogglePwd").html("Cancel"); 
   },function(){ 
      $("#divPwdRetrival_new").hide('fast'); 
      $("#hrefTogglePwd").html("Forget your password?");  
   });
   
   
   $("#btnGetPwd").click(function(){
      getPwd();
   });
    
    $("#btnGetPwd_new_1").click(function(){
      getPwd_new_1();
   }); 
 
   $("#divPwdRetrival_new").keyup(function(event){
           if(event.keyCode==13)
            {    
            getPwd();
            }
   });
 
 });
 
  function getPwd_new_1(){
      var email = trim( $("#passwordreminder_pwd_new_1").val() );
      if(email.length<6 || !checkMail(email)){
        alert ("Please enter valid email and then submit");
        return false;
      }else{
          $("#indicatorpwdreminder_new_1").show('fast');
          $.post(
           "/retrievePassword",
           {userEmail: email},
           function(){
              alert ("Your password has been succesfully sent to your registered email, please use the information to login to your account.");
              $("#divPwdRetrival_new_1").hide('fast'); 
              $("#indicatorpwdreminder_new_1").hide('fast');
              $("#hrefTogglePwdNew").html("Forget your password?");  
           }
         );
      }
 }
 
 function getPwd(){
      var email = trim($("#passwordreminder_pwd").val());
      if(email.length<6 || !checkMail(email)){
        alert ("Please enter valid email and then submit");
        return false;
      }else{
          $("#indicatorpwdreminder").show('fast');
          $.post(
           "/retrievePassword",
           {userEmail: email},
           function(){
              alert ("Your password has been succesfully sent to your registered email, please use the information to login to your account.");
              $("#divPwdRetrival_new").hide('fast'); 
              $("#indicatorpwdreminder").hide('fast');
              $("#hrefTogglePwd").html("Forget your password?");  
           }
         );
      }
 }
