$(document).ready(function() {
	$('#ddlCurrecy').change(function(){
	    $.ajax({
	        url:'AdvCharge.aspx?type=ajax&Action=BindPaymentByCurrencyID&CurrencyID='+$('#ddlCurrecy').val(),
	        cache:false,
	        success:function(data){
	            alert(data);
	            if(!checkLoginStatus(data)){return false;}
	            $('#PaymentContent').html(data);
	        },
	        error:function(){alert('error');}
	    });
	});//end change
	
	$('#btnSubmit').click(function(){
	    var dot = 0;//小数点个数
	    var tmp = $('#txtMoney').val();
	    var money = $.trim($('#txtMoney').val());
	    while(tmp.indexOf('.') != -1){
	        dot += 1;
	        tmp = tmp.replace('.','_');
	    };
	    var reg = new RegExp(/[^\d\.]/g);
	    if(reg.test(money) || money == '' || dot > 1){
	        alert('充值金额填写错误');
	        $('#txtMoney').focus();
	        $('#txtMoney')[0].select();
	        return false;
	    };
	    
	    if($('input[@type=radio][@name=payment][@checked]').length == 0){
	        alert('请选择支付方式');
	        return false;
	    }
	});//end click
	
});

function checkLoginStatus(data){
    var result = true;
    if(data.indexOf('<!DOCTYPE') != -1){
        result = false;
        alert('身份已过期,请重新登陆!');
    }
    return result;
}