<script type="text/javascript">

function validate_cpass(){

	var password = $("#user_password").val();
	var passed = validatePassword(password, {
		length:   [6, Infinity],
		numeric:  1,
		special:  1
	});
	
	if($("#user_password").val()==''){
		$("#msg_user_password").html('Please enter Password');
		$("#user_password").addClass('jquery_err');
		$("#user_password").focus();
		return false;
	}else if(!passed){
		$("#msg_user_password").html('Password should have minimum 6 char and atleast one numeric or one special char. ');
		$("#user_password").addClass('jquery_err');
		$("#user_password").focus();
		return false;
	}else if($("#user_password").val()!='' && $("#user_password").val()!=$("#user_repassword").val()){
		$("#msg_user_password").html('Password and Again password do not matched');
		$("#user_password").addClass('jquery_err');
		$("#user_password").focus();
		return false;
	}else{
		$("#msg_user_password").html('');
		$("#user_password").removeClass('jquery_err');
	}
	
}

$(document).ready(function(){
	$("#user_password").blur(function (){
		$("#loading_pass").show();

		var password = $("#user_password").val();
		var passed = validatePassword(password, {
			length:   [6, Infinity],
			numeric:  1,
			special:  1
		});
		
		if($("#user_password").val()==''){
			$("#msg_user_password").html('Please enter Password');
			$("#user_password").addClass('jquery_err');
			$("#user_password").focus();
			return false;
		}else if(!passed){
			$("#msg_user_password").html('Password should have minimum 6 char and atleast one numeric or one special char. ');
			$("#user_password").addClass('jquery_err');
			$("#user_password").focus();
			return false;
		}else{
			$("#user_password").removeClass('jquery_err');
			$("#msg_user_password").html('');
  		}
  		$("#loading_pass").hide();
	});

	$("#user_repassword").blur(function (){
		$("#loading_repass").show();

		if($("#user_repassword").val()!==$("#user_password").val()){
			$("#user_repassword").addClass('jquery_err');
			$("#msg_user_repassword").html('Password and Again password do not matched');
	  	}else{
			$("#user_repassword").removeClass('jquery_err');
			$("#msg_user_repassword").html('');
  		}

  		$("#loading_repass").hide();
	});
});

</script>

<!-- Content (Right Column) -->
		<div id="content" class="box">

			<h1>Member &raquo; Change Password</h1>

			<?php if(isset($successMsg) && $successMsg!=''){ ?>
				<p class="msg done"><?php echo $successMsg; ?></p>
			<?php } ?>
			
			<?php if(isset($failedMsg) && $failedMsg!=''){ ?>
				<p class="msg error"><?php echo $failedMsg; ?></p>
			<?php } ?>

			<form action="changempassword.php" method="post" id="changePasswordFrm" name="changePasswordFrm" onsubmit="return validate_cpass();">
			
				<?php if(isset($_REQUEST['user_id']) && $_REQUEST['user_id']!=''){ ?>
					<input type="hidden" id="user_id" name="user_id" value="<?php echo $_REQUEST['user_id'] ?>" >
                    <input type="hidden" id="status" name="status" value="<?php echo $_REQUEST['status'] ?>" >
				<?php } ?>
				
				<!-- Login -->
				<fieldset>
					<legend>Change Password</legend>
					<p>
						<label for="inp-02" class="req">New Password:</label><br />
						<input type="password" size="50" name="user_password" id="user_password" class="input-text-02" /><span id="loading_pass"  class="aloader" style="display:none"><img src="images/ajaxLoader.gif"></span><br/>
						<span class="smaller low message" id="msg_user_password">&nbsp;</span>
					</p>

					<p class="nomb">
						<label for="inp-03" class="req">New Password again:</label><br />
						<input type="password" size="50" name="user_repassword" id="user_repassword" value="" class="input-text-02" /><span id="loading_repass"  class="aloader" style="display:none"><img src="images/ajaxLoader.gif"></span><br/>
						<span class="smaller low message" id="msg_user_repassword">&nbsp;</span>
					</p>

				</fieldset>
				
					<p>
					  <input type="submit" value="Change Password" id="submit" name="submit" class="input-submit" />
					</p>
		  </form>

		</div> <!-- /content -->