var text=$.Objects.Text($.lng('change_pass_tips'));
text.Location(10,10,980,200);
text.Add();

var lbl_pass=$.Objects.Text($.lng('new_pass')+':');
lbl_pass.Location(210, 305, 300, 20);
lbl_pass.Add();

var txt_pass=$.Objects.TextBox('password');
txt_pass.Location(510,300,200,20);
txt_pass.SetMaxLength(80);
txt_pass.Add();

var lbl_confirm=$.Objects.Text($.lng('confirm_new_pass')+':');
lbl_confirm.Location(210,330,300,20);
lbl_confirm.Add();

var txt_confirm=$.Objects.TextBox('password');
txt_confirm.Location(510,325,200,20);
txt_confirm.SetMaxLength(80);
txt_confirm.Add();

var cmd_ok = $.Objects.Button($.lng('accept'));
cmd_ok.Location(0, 520, 495, 22);
cmd_ok.Add();

var cmd_cancel = $.Objects.Button($.lng('cancel'));
cmd_cancel.Location(505, 520, 495, 22);
cmd_cancel.Add();

var validator=$.Objects.Validator();
validator.Add(txt_pass, 'required', $.lng('new_pass'));
validator.Add(txt_confirm, 'required', $.lng('confirm_new_pass'));
validator.Add([txt_pass, txt_confirm], 'same', [$.lng('new_pass'), $.lng('confirm_new_pass')]);

cmd_ok.onclick=function(){
	if(validator.Validate()){
		var ajax=$.AjaxDBSave("users", ['pass'], [ $.Encrypt.MD5(txt_pass.GetText())], "id='"+USER.id+"'");
		if(!ajax.error){
			$.Redirect('?resume');
		}
		else{ $.Debug.Add(ajax.text); }
	}
}
cmd_cancel.onclick=function(){ $.Redirect('?resume'); }