<script language="javascript" type="text/javascript">
<!--hide it---
    function checkPassword(form){
        if (($('confirm_password').value !="") && ($('new_password').value !="")){
            if ($('confirm_password').value != $('new_password').value){
                alert(lang("Your confirmation password does not match your new password"));
                return (false);
            }
        }else{
            if (($('confirm_password').value !="") || ($('new_password').value !="")){
                alert(lang("You must fill all password fields if you wish to change this password"));
                return (false);
            }
        }
        UpdatePassword($('new_password').value,$('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() {
                Ext.Msg.alert("Fail");
           },
           params: { new_password: newpassword, confirm_password: confirmpassword }
        });
    }
//-->
</script>
<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>