/**
 * @author skydong
 * 
 */
Ext.QuickTips.init();
// Ext.form.Field.prototype.msgTarget = 'side';
Ext.BLANK_IMAGE_URL = '/ext-2.2/resources/images/default/s.gif'
LoginWindow = Ext.extend(Ext.Window, {
	title : '会员登陆入口',
	width : 265,
	id : "window",
	modal : true,
	resizable : false,
	height : 180,
	animateTarget : "user_login",
	closeAction : "hide",
	collapsible : false,
	closable : true,
	buttonAlign : 'center',
	createFormPanel : function() {
		return new Ext.form.FormPanel({
					bodyStyle : 'padding-top:6px',
					defaultType : 'textfield',
					labelAlign : 'right',
					labelWidth : 60,
					method : 'POST',
					onSubmit : Ext.emptyFn,
					submit : function() {
						this.getEl().dom.action = "/index.asp";
						this.getEl().dom.submit();
					},
					labelPad : 0,
					frame : true,
					monitorValid:true,
					defaults : {
						allowBlank : false,
						width : 150
					},
					items : [{
								name : 'module',
								xtype : 'hidden',
								value:"login"
							},{
								cls : 'user',
								name : 'u_name',
								fieldLabel : '用户名',
								blankText : '用户名不能为空'
							}, {
								cls : 'key',
								name : 'u_password',
								fieldLabel : '密码',
								blankText : '密码不能为空',
								inputType : 'password'
							}, {
								cls : 'rand',
								name : 'u_code',
								id : 'randCode',
								fieldLabel : '验证码',
								width : 70,
								minLength : 4,
								maxLength : 4,
								minLengthText : '超过验证码字符个数',
								blankText : '验证码不能为空',
								listeners : {
									'specialkey' : function(field, e) {
										if (e.getKey() == Ext.EventObject.ENTER) {
											this.login();
										}
									},
									scope : this
								}
							}]
				});
	},

	login : function() {
		if(this.fp.form.isValid())
			this.fp.form.submit();
		else
		  Ext.Msg.alert("警告信息","信息填写不完整，请按要求填写！！");
	},
	initComponent : function() {
		LoginWindow.superclass.initComponent.call(this);
		this.fp = this.createFormPanel();
		this.add(this.fp);
		this.addButton({
					text : "提交",
					formBind:true,
					type : "button"
				}, this.login, this);
		this.addButton('清除', function() {
					this.fp.form.reset();
				}, this);
	}
});