<script language="javascript" type="text/javascript">
<!--hide it---
    function checkPassword(form){
        if ((document.getElementById('confirm_password').value !="") && (document.getElementById('new_password').value !="")){
            if (document.getElementById('confirm_password').value != document.getElementById('new_password').value){
                alert(lang("Your confirmation password does not match your new password"));
                return (false);
            }
        }else{
            if ((document.getElementById('confirm_password').value !="") || (document.getElementById('new_password').value !="")){
                alert(lang("You must fill all password fields if you wish to change this password"));
                return (false);
            }
        }
        UpdatePassword(document.getElementById('new_password').value,document.getElementById('confirm_password').value);
    }

    function UpdatePassword(newpassword,confirmpassword){
        Ext.Ajax.request({
           url: 'index.php?fuse=clients&action=UpdatePassword',
           success: function(xhr) {
                        var data = Ext.util.JSON.decode(xhr.responseText);
                        if(data.error){
                           msg(lang("There was an error performing this action"),"");
                        }else if(data.message){
                            msg(data.message,"");
                        }else{
                            msg(lang("The password has been updated"),"");
                        }
                    },
           failure: function() {  },
           params: { new_password: newpassword, confirm_password: confirmpassword }
        });
    }
//-->
</script>
<div style="border-top:1px solid #D4D4D4;padding-bottom: 17px;"></div>
<dl class="form">
    <dt><label>[l]New Password[/l]</label></dt>
    <dd>
        <input class="x-form-text x-form-field" type="password" id="new_password" name="new_password" size="30" autocomplete="off">
    </dd>
    <dt><label>[l]Confirm password[/l]</label></dt>
    <dd>
        <input class="x-form-text x-form-field" type="password" id="confirm_password" name="confirm_password" size="30" autocomplete="off">
    </dd>
</dl>
<p class="buttons">
    <input type="button" class="button" value='[l]update[/l]' onclick='checkPassword();'>
</p>