Write a SQL query to find the third-highest-earning employee within each department from an employee database.