Ext.onReady(function(){

	var btn1 = Ext.get('btn1');
	if(btn1 != null){
	    var pbar1 = new Ext.ProgressBar({
	        text:'就绪',
	        width: 120
	    });
	    pbar1.on('update', function(val){
			pbar1.updateText('查询账户点数中...');
	    });
	    btn1.on('click', function(){
	    	Ext.fly('p1text').update('');
	        if (!pbar1.rendered){
	            pbar1.render('p1');
	        }else{
	            pbar1.text = '就绪';
	            pbar1.show();
	        }
	        btn1.dom.disabled = true;
	        pbar1.wait({
	            interval:200,
	            increment:20
	        });
	        Ext.Ajax.request({
				url: 'smsGetUpdateBalance.action',
				method: 'POST',
				success : function(response, options){
					var responseArray = Ext.util.JSON.decode(response.responseText);
					pbar1.reset(true);
					if(responseArray.result == 'success'){
						pbar1.reset(true);
						Ext.fly('p1text').update("您的账户点数： <font style='color:blue;font-weight:bold;'>"+responseArray.msg+"</font> 点").show();
					}else{
						pbar1.reset(true);
						Ext.fly('p1text').update(responseArray.msg).show();
					}
					btn1.dom.disabled = false;
				},
				failure : function(response, options){
					pbar1.reset(true);
					Ext.fly('p1text').update('查询账户点数超时，请稍后再试').show();
					btn1.dom.disabled = false;
				}
			});
	    });
    }
});