/**
 * @author Roderik
 */

Ext.onReady(function(){
	
	Ext.QuickTips.init();
		
	Ext.form.Field.prototype.msgTarget = 'side';
	
	var aidLoginForm = new Ext.FormPanel({
	        labelWidth: 100, // label settings here cascade unless overridden
	        labelAlign: 'right',
	        url:'/dashboard/',
			standardSubmit: true,
	        frame:true,
			monitorValid:true,
	        title: 'Sign in',
	        bodyStyle:'padding:5px 5px 0',
	        width: 350,
	        defaultType: 'textfield',
	
	        items: [{
	                fieldLabel: 'Email',
	                name: 'username',
					anchor: '95%',
					allowBlank:false,
	                vtype:'email'
	            }, {
	                fieldLabel: 'Password',
	                name: 'password',
					anchor: '95%',
					allowBlank:false,
					inputType: 'password'
	            }
	        ],
	
	        buttons: [{
	            text: 'Login',
				type: 'submit',
				formBind:true,
				handler: function() {
					aidLoginForm.getForm().getEl().dom.action = '/dashboard/';
			        aidLoginForm.getForm().getEl().dom.method = 'POST';
		        	aidLoginForm.getForm().submit();
		     	}

	        }]
	    });
	
	aidLoginForm.render('loginform');
	
});
