When a separation agreement is the basis for an award of spousal support, the court, in approving the agreement, shall examine the agreement to ascertain whether it clearly provides for spousal support to continue beyond the remarriage of the payee or to cease in such event. When spousal support is to be paid pursuant to the terms of a separation agreement which does not state whether the payment of spousal support is to continue beyond the remarriage of the payee or is to cease, or when the parties have not entered into a separation agreement and spousal support is awarded, the court shall have the discretion to determine, as a part of its order, whether such payments of spousal support are to be continued beyond the remarriage of the payee. In the event neither an agreement nor an order makes provision for the remarriage of the payee, spousal support other than rehabilitative spousal support or spousal support in gross shall cease on the remarriage of the payee. Rehabilitative spousal support does not cease upon the remarriage of the payee during the first four years of a rehabilitative period. In the event neither an agreement nor an order makes provision for the remarriage of the payee, spousal support in gross continues beyond the payee's remarriage.