
Application.login.LoginPanels = Ext.extend(Ext.Panel, {
	
	 email:											''
	,password:										''
	
	,cn: new Ext.data.Connection({
		 url: 										'/viewHelpers/Login.cfc'
		,extraParams : {
			returnFormat: 							'json'
		}
		,method: 									'POST'
	})
	
	,onForgotPassword: function () {
		this.layout.setActiveItem(1);
	}
	
	,onRetryLogin: function () {
		this.layout.setActiveItem(0);
	}
	
	,onLoginFormRender: function () {
		this.layout.setActiveItem(0);
	} 

	,initComponent: function () {
		
		Ext.apply(this, {
			layout: 								'card'
			,renderTo: 								this.renderTo ||  'dApp' //Ext.getBody()
			,bodyStyle: 							'padding: 5px;'
			,width: 								335
			,height: 								175
			,frame:									true
			//,autoHeight: 							true
			,border:								false
			,items: [
				{
					xtype: 							'login.loginpanel'
					,cn: 							this.cn
					,email:							this.email
					,password:						this.password
					,listeners: {
						 'forgotPassword': 			this.onForgotPassword
						,'render': 					this.onLoginFormRender
						,scope: 					this
					}	
				},{
					xtype: 							'login.retrievepasswordpanel'
					,cn: 							this.cn
					,listeners: {
						 'retryLogin': 				this.onRetryLogin
						,scope: this
					}	
				}
			]
		})
		
		Application.login.LoginPanels.superclass.initComponent.apply(this, arguments);
	}
	
});

Ext.reg('loginpanels', Application.login.LoginPanels);

