$(function(){
	//日歷調用,所有以_date]結尾的
	$("form [id$='_date]']").css({cursor:"pointer"}).datepicker();
	//只能寫數字
	$("form [id^='lastnum']").onlypressnum();

	//最新消息表單數據檢測
	$("form#form_payment").submit(function(){
		if($("[id='notice[name]']").eq(0).val().length == 0){
			alert('名字不能為空！');
			$("[id='notice[name]']").eq(0).focus();
			return false;
		}
		if($("[id='notice[pay_pro]']").eq(0).val().length == 0){
			alert('收費項目不能為空！');
			$("[id='notice[pay_pro]']").eq(0).focus();
			return false;
		}
		if(!(/^\d+[\.]?\d+$/.test($("[id='notice[pay_amount]']").eq(0).val()))){
			alert('繳費金額格式不對！');
			$("[id='notice[pay_amount]']").eq(0).focus();
			return false;
		}
		if(!(/^\d{4}[-]\d{2}[-]\d{2}$/.test($("[id='notice[pay_date]']").eq(0).val()))){
			alert('收費日期格式不对！');
			$("[id='notice[pay_date]']").eq(0).focus();
			return false;
		}
		if($("[id='notice[pay_way]']:checked").val()==1 && $("#lastnum1").val().length == 0){
			alert('銀行帳號後5位不能為空');
			$("#lastnum1").focus();
			return false;
		}
		if($("[id='notice[pay_way]']:checked").val()==2 && $("#lastnum2").val().length == 0){
			alert('交易序號不能為空');
			$("#lastnum2").focus();
			return false;
		}
		//交易序號/notice[pay_way]
		return true;
	});
});