Ext.apply(Ext.form.VTypes, {
    password : function(val, field) {
        if (field.initialPassField) {
            var pwd = Ext.getCmp(field.initialPassField);
            return (val == pwd.getValue());
        }
        return true;
    },

    passwordText : 'Passwords do not match'
});

Ext.onReady(function(){

    Ext.QuickTips.init();

    // turn on validation errors beside the field globally
    Ext.form.Field.prototype.msgTarget = 'side';

    var bd = Ext.getBody();

	var pwd = new Ext.FormPanel({
		labelWidth: 125,
		frame: true,
		title: 'Password Verification',
		bodyStyle:'padding:5px 5px 0',
		width: 350,
		defaults: {width: 175,inputType: 'password'},
		defaultType: 'textfield',
		standardSubmit: true,
		items: 
		[
			{
				fieldLabel: 'Password',
				name: 'pass',
				id: 'pass',
				allowBlank: false
			},
			{
				fieldLabel: 'Confirm Password',
				name: 'pass-cfrm',
				vtype: 'password',
				initialPassField: 'pass',
				allowBlank: false
			}
		],
		buttons: 
		[
			{
				text: 'Save',
				type: 'submit',
				handler: function()
				{
					
					//simple.getForm().getEl().dom.action = "../register/registered.php";
					waitTitle:'Connecting';
    	            waitMsg:'Sending data...';
					//simple.getForm().getEl().dom.action = "../include/php/contactus.php";
					pwd.getForm().getEl().dom.action = "../include/php/login.php";
					pwd.getForm().getEl().dom.method = 'POST';
					pwd.getForm().submit();
				}
			},
			{
				text: 'Cancel',
				handler: function()
				{
					Ext.example.msg('Click','You clicked on "Action 1".');
				}
			}
		]
    });


	pwd.render('pw');


});


