entrar = function(){
	
	entrar.superclass.constructor.call(this, {
		autoCreate: true										  
	});
	
	var formulario = new Ext.form.Form({
		style: "padding:10px",
		labelWidth: "auto",
		labelAlign: "top",
		waitTitle: "Espere por favor",
		method: "GET",
		disableCaching: false,
		errorReader: new Ext.data.JsonReader({
			root: "resultado", 
			successProperty: "exito"
		}, ["id", "msg"])
	});
	
	formulario.fieldset({legend:"Datos de ingreso"}, 
		new Ext.form.NumberField({
			fieldLabel: "Rut (ej: 113334442 ; k=0)",
			name: "USU_RUT",
			allowBlank: false,
			allowDecimals: false,
			allowNegative: false,
			minLength: 8,
			maxLength: 9,
			tabIndex : 1,
			width: 180
		}),
		new Ext.form.TextField({
			fieldLabel: "Contraseņa",
			name: "USU_CONTRASENA",
			minLength: 4,
			maxLength: 10,
			width: 180,
			tabIndex : 2,
			inputType: "password"
		})
	);
	
	formulario.render(this.getEl());
	
	formulario.on("actioncomplete", function(form, action){

		if(action.type == "submit"){
				
			window.location.reload();
			
		};
			
	});
	
	formulario.on("show", function(){
		this.formulario.findField("USU_RUT").focus();
	});
	
	this.formulario = formulario;
};

Ext.extend(entrar, Ext.ContentPanel, {
	
	enviar: function(){
		
		this.formulario.submit({
			url: "modulos/usuario/entrar.php",
			waitMsg: "Entrando..."
		});
		
	},
	
	limpiar: function(){
		
		this.formulario.reset();
	
	}
		   
});