<? 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){
			$("#strength_div").show();
			$("#password_strength_per").val(strengthPercentage);
			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>
<div class="form-horizontal">
    <div class="col-sm-1"></div>
    <div class="col-sm-11">
        <div class="radio i-checks pull-left m-r-lg">
        <label>
            <input type="radio" name="vis_password_btn" id="vis_updatepassword" value="1" checked="checked"><i></i>
            <? echo $vis_language['TXTUPDATEPASSWORD']; ?>
        </label></div>
        <div class="radio i-checks pull-left">
        <label>
            <input type="radio" id="vis_resetpassword" name="vis_password_btn" value="0" ><i></i>
            <? echo $vis_language['TXTSENDRESETPASSWORDEMAIL']; ?>
        </label></div>	
    </div>	
</div>
 <div class="line b-b line-lg pull-in"></div><br/><br/><br/>

<form class="form-horizontal" data-validate="parsley" id="vis_staff_password_reset_form" name="vis_staff_password_reset_form" method="post" >
  <input type="hidden" name="vis_staff_id" id="vis_staff_id" value="<? echo $operation['vis_staff_id']; ?>" />
  <div class="form-group">
    <label class="col-sm-4 control-label"><? echo $vis_language['TXTNEWPASSWORD']; ?></label>
    <div class="col-sm-8">
      <input class="form-control input-sm" name="vis_newpassword" id="vis_newpassword" type="password" autocomplete="off" data-display="password_strenght_id" />
    </div>
  </div>
  <div class="form-group" id="strength_div" style="display:none;">
	<label class="col-sm-4 control-label"></label>
    <div class="col-sm-8">
		 <input type="hidden" name="password_strength_per" id="password_strength_per" value='0'>
      <div id="password_strenght_id"></div>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-4 control-label"><? echo $vis_language['TXTCONFIRMNEWPASSWORD']; ?></label>
    <div class="col-sm-8">
      <input class="form-control input-sm" name="vis_confirm" id="vis_confirm" type="password" autocomplete="off" />
    </div>
  </div>
  <div class="line b-b line-lg pull-in"></div>
  <br/>
  <br/>
  <input type="hidden" name="vis_email" id="vis_email" value="<? echo $client_details['vis_email']; ?>" >
  <div class="form-group">
    <div class="col-sm-4 col-sm-offset-2">
      <button type="button" class="btn btn-primary" onclick="$('#vis_workpanel_div').visExecution('submit_form',{'vis_module':'client', 'vis_operation':'set_forgetpassword','vis_form':'vis_staff_password_reset_form'});"><? echo $vis_language['TXTUPDATE']; ?></button>
    </div>
  </div>
</form>
<form class="form-horizontal" data-validate="parsley" id="vis_reset_email_form" name="vis_reset_email_form" style="display:none;">
    <div class="form-group">
        <div class="col-sm-2 col-sm-offset-2">
             <button onclick="$('#vis_global_msg_div').visExecution('load_operations', {'vis_module':'client', 'vis_operation':'reset_send_password', 'vis_client_id':'<? echo $client_details['client_id']; ?>','vis_email':'<? echo $client_details['vis_email']; ?>'});" class="btn btn-primary" type="button"   data-dismiss="modal" ><? echo $vis_language['TXTSEND']; ?></button>			 
    </div></div>
</form>
<script>
	$("#vis_updatepassword").change( function(){ $("#vis_reset_email_form").hide();$("#vis_staff_password_reset_form").show(); });
	$("#vis_resetpassword").change( function(){ $("#vis_reset_email_form").show();$("#vis_staff_password_reset_form").hide(); });
</script>