<? global $vis_language;
   $security_password = ($security_password_details==-1)?50:$security_password_details[0]['content']; ?>
<script>
   $(document).ready(function(){
   	function change_password_strength(strengthPercentage, is_valid){
   		$("#password_strength_per").val(strengthPercentage);
   		$("#password_strength_show").show();
   		var show_password_result;
   			if(strengthPercentage>=0 && strengthPercentage<50){show_password_result='<span class="label vh-yellow-bg"> <?=$vis_language['TXTWEAK'];?> </span>';}
   			else if(strengthPercentage>=50 && strengthPercentage<70){show_password_result='<span class="label vh-green-bg"> <?=$vis_language['TXTMEDIUM'];?> </span>';}
   			else if(strengthPercentage>=70 && strengthPercentage<90){show_password_result='<span class="label vh-orange-bg"> <?=$vis_language['TXTSTRONG'];?> </span>';}
   			else if(strengthPercentage>=90 && strengthPercentage<=100){show_password_result='<span class="label vh-red-bg"> <?=$vis_language['TXTVERYSTRONG'];?> </span>';}
   			if(is_valid=='not_allowed') $('#password_strenght_id').html('<? echo $vis_language['TXTPASSWORDSRENGTH']."&nbsp;&nbsp;"; ?> '+show_password_result+ '&nbsp;&nbsp; <?=$vis_language['TXTNOTALLOWED']?>');
   			else if(is_valid=='allowed') $('#password_strenght_id').html('<? echo $vis_language['TXTPASSWORDSRENGTH']."&nbsp;&nbsp;"; ?> '+show_password_result+ '&nbsp;&nbsp; <?=$vis_language['TXTALLOWED']?>');
   			return true;	
   	}
   	
   	$('#vis_newpassword').pStrength({
   		'changeBackground'          : false,
   		'onPasswordStrengthChanged' : function(passwordStrength, strengthPercentage) {
   			if(passwordStrength!=0){change_password_strength(strengthPercentage,'not_allowed');}
   		},
   		'passwordValidFrom': <?=$security_password ?>,
   		'onValidatePassword': function(strengthPercentage) {
   			change_password_strength(strengthPercentage,'allowed');
   		}
   	});
   });
</script>
<section class="container m-t-md">
   <div class="row">
      <div class="col-md-12">
         <section class="panel shadow-none">
            <header class="vis_login_head">
               <? if(isset($operation['message']) && $operation['message']!='') {?>
               <script> $("#vis_submit_err_div").show(); $("#vis_submit_err_div").html('<? echo $operation['message']; ?>'); </script><? } ?>
            </header>
            <div class="panel-body no-padder">
               <form class="form-horizontal" id="vis_form_change_password" name="vis_form_change_password" method="post">
                  <div class="col-md-12">
                     <div class="wrapper">
                        <div class="form-group">
                           <label for="OldPassword" class="col-sm-2 control-label"><? echo $vis_language['TXTOLDPASSWORD']; ?></label>
                           <div class="col-sm-8"><input type="password" class="form-control input-sm"  name="vis_oldpassword"  id="vis_oldpassword"  value=""/></div>
                        </div>
                        <div class="form-group">
                           <label for="NewPassword" class="col-sm-2 control-label"><? echo $vis_language['TXTNEWPASSWORD']; ?></label>
                           <div class="col-sm-8"><input type="password" class="form-control input-sm"  name="vis_newpassword"  id="vis_newpassword" data-display="password_strenght_id"/></div>
                        </div>
                        <div class="form-group" style="display:none" id="password_strength_show">
                           <label class="col-sm-2 control-label"></label>
                           <div class="col-sm-10">
                              <input type="hidden" name="password_strength_per" id="password_strength_per" value='0'>
                              <div id="password_strenght_id" class="checkbox-inline"></div>
                           </div>
                        </div>
                        <div class="form-group">
                           <label for="ConfirmPassword" class="col-sm-2 control-label"><? echo $vis_language['TXTCONFIRMNEWPASSWORD']; ?></label>
                           <div class="col-sm-8"><input type="password" class="form-control input-sm"  name="vis_confirm"  id="vis_confirm" /></div>
                        </div>
                        <input type="hidden" name="vis_operation" value="set_password" /><input type="hidden" name="vis_module" value="client" />
                     </div>
                  </div>
                  <div class="col-lg-offset-2 col-lg-8 m-b-lg">
                     <button type="submit" class="btn btn-primary"><? echo $vis_language['TXTUPDATE']; ?></button>
                  </div>
               </form>
            </div>
         </section>
      </div>
   </div>
</section>

