
function showDiv(){
	document.getElementById("download").style.display="block";
}
function showResult(btn){
    document.location='../index.jsp';
}
Ext.onReady(function(){

    Ext.QuickTips.init();

    var fs = new Ext.FormPanel({
        labelWidth: 75,
        frame:true,
        title: '产品下载身份验证',
        bodyStyle:'padding:5px 5px 0',
        width: 350,

        items: [{
            xtype:'fieldset',
            title: '验证信息',
            collapsible: true,
            autoHeight:true,
            defaults: {width: 210},
            defaultType: 'textfield',
            items :[{
                    fieldLabel: '用户合同号 ',
                    name: 'yzm',
                    allowBlank:false
                },{
                    fieldLabel: '授权码 ',
                    name: 'business',
                    allowBlank:false
                }
            ]
        }]
    });

    // explicit add
    var submit = fs.addButton({
        text: '验证',
        handler: function(){
        if(fs.form.isValid()){
            fs.form.submit({
            	url:'../YpxxHandler?action=downloadValid',  
            	waitMsg:'正在提交，请等待...',                            
            	success:function(form,action){
                      Ext.MessageBox.alert('提示', '信息验证成功...');
                      fs.hide();
					  showDiv();
                            },
                failure: function(form,action) {
					  Ext.MessageBox.alert('提示', '信息验证失败...', showResult);
                               } 
                            });
              }
        }
    });
    // simple button add
    fs.addButton('返回', function(){
		showResult();
    });
    fs.addButton('注册', function(){
    
    });
    fs.addButton('说明', function(){
	var tabs = new Ext.TabPanel({
            region: 'center',
            margins:'3 3 3 0', 
            activeTab: 0,
            defaults:{autoScroll:true},

            items:[{
                title: '用户合同号',
                html: '<p>关于用户合同号...</p>'
            },{
                title: '用户授权码',
                html: '<p>关于用户授权码...</p>'
            },{
                title: '用户注册',
                html: '<p>关于用户注册...</p>'
            }]
        });

        // Panel for the west
        var nav = new Ext.Panel({
            title: '注意事项',
            region: 'west',
            split: true,
            width: 200,
            collapsible: true,
            margins:'3 0 3 3',
            cmargins:'3 3 3 3',
            html: '<p>关于产品下载的注意事项...</p>'
        });

        var win = new Ext.Window({
            title: '产品下载说明',
            closable:true,
            width:600,
            height:350,
            //border:false,
            plain:true,
            layout: 'border',
            modal:true,

            items: [nav, tabs]
        });
        win.show(this);
    });

    fs.render('valid');

});
