Auto-allocate payment to several invoices?

Auto-allocate payment to several invoices?

1) A customer have several unpaid invoices
2) The customer make one big payment, enough to cover several, but not all, of the invoices

Is there a way that we can set up so this payment is AUTOMATICALLY allocated to the invoices.  Like allocate it to oldes unpaid invoices.  I know this can be done manually, but it would be extremely helpfull if the allocation could be done autmatically.

Any help or suggestion of alternative ways ware wellcome :-)