<script type="text/javascript">

function validate_cpass(){

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

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

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

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

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

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

</script>

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

			<h1>Administrator &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="changepassword.php" method="post" id="changePasswordFrm" name="changePasswordFrm" onsubmit="return validate_cpass();">
			
				<?php if(isset($_REQUEST['admin_id']) && $_REQUEST['admin_id']!=''){ ?>
					<input type="hidden" id="admin_id" name="admin_id" value="<?php echo $_REQUEST['admin_id'] ?>" >
				<?php } ?>
				
				<!-- Login -->
				<fieldset>
					<legend>Change Password</legend>
					<p>
						<label for="inp-02" class="req">New Password:</label><br />
						<input type="password" size="50" name="admin_password" id="admin_password" class="input-text-02" id="inp-02" /><span id="loading_pass"  class="aloader" style="display:none"><img src="images/ajaxLoader.gif"></span><br/>
						<span class="smaller low message" id="msg_admin_password">&nbsp;</span>
					</p>

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

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

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