function invoiceShow(){
	
	 var chkRadio = $('input:radio[name="invoiceType"]:checked').val();
     if (chkRadio == null) {
         alert("没有选中项");
         return false;
     } else if(chkRadio==1) {
    	 $('#plainInvoice_box').hide();
    	 $('#specialInvoice_box').show();
     }else if(chkRadio==0){
    	 $('#plainInvoice_box').show();
    	 $('#specialInvoice_box').hide();
     }
    
}

function mailShow(){
	var chkRadio = $('input:radio[name="doPost"]:checked').val();
    if (chkRadio == null) {
        alert("没有选中项");
        return false;
    } else if(chkRadio==1) {
   	 $('#mail_box').show();
    }else if(chkRadio==0){
   	 $('#mail_box').hide();
    }
}

$(function () {
	
	$('#invoice').validator({
	    timely: 3,
	    focusCleanup: true,
	    rules: {
	    	invoiceTitle: function() {
	    		return $('#invoicePlain').prop('checked');
	        },
	        invoiceCompany: function() {
	        	return $('#invoiceSpecial').prop('checked');
		        }
	        ,isMail: function() {
	        	return $('#isMail').prop('checked');
	        }
	    },
	    fields: {
	    	invoiceTitle: 'required(invoiceTitle);',
	    	invoiceCompany:'required(invoiceCompany);',
	    	TIN:'required(invoiceCompany);',
	    	address:'required(invoiceCompany);',
	    	phone:'required(invoiceCompany);',
	    	bank:'required(invoiceCompany);',
	    	bankAccount:'required(invoiceCompany);',
	    	'invoicePrice': 'required; '
		    ,invoiceElement: 'required; '
		    ,'invoiceType': 'required'
			,recipients: 'required(isMail); '
			,recipientsPhone: 'required(isMail); '
			,recipientsAddress: 'required(isMail); '
	    }
	});
	
	$("form[name='invoiceApproval']").validator({
		timely: 3,
	    focusCleanup: true,
	    theme:"yellow_top",
	    fields: {
	        //'opinion': 'required; '
	    }
	});
	
	$("form[name='invoicePrint']").validator({
		timely: 3,
	    focusCleanup: true,
	    theme:"yellow_top",
	    fields: {
	        'invoiceNo': 'required; '
	    }
	});

	$("form[name='invoiceExpress']").validator({
		timely: 3,
	    focusCleanup: true,
	    theme:"yellow_top",
	    fields: {
	        'actualItems': 'required; ',
	        'nu': 'required; ',
	        'express': 'required; '
	    }
	});
	
	$("form[name='untreadInvoice']").validator({
	    timely: 3,
	    focusCleanup: true,
	    rules: {
	        isUntread: function() {
	        	return $("input[node-untread='post']").prop('checked');
	        }
	    },
	    fields: {
	    	 untreadReason: 'required; '
		    ,untreadPost: 'required; '
			,untreadCompany: 'required(isUntread); '
			,untreadNumber: 'required(isUntread); '
			,untreadItems: 'required(isUntread); '
	    }
	});
	
	$("form[name='receivablesInvoice']").validator({
	    timely: 3,
	    focusCleanup: true,
	    fields: {
	    	receivablesPrice: 'required; '
		    ,receivablesMessage: 'required; '
			,receivablesBank: 'required '
			,receivablesDate: 'required '
			,receivablesCategory: 'required '
			,receivablesStaff: 'required '
	    }
	});
	
//	$("form[name='invoiceReceivablesUpdateClaim']").validator({
//	    timely: 3,
//	    focusCleanup: true,
//	    fields: {
//			receivablesCategory: 'required '
//			,receivablesStaff: 'required '
//	    }
//	});
	
})