How to fade out an image after it has faded in?

Hi - we have created a ‘thank you’ image that pops up after a visitor has pressed the ‘submit’ button on our contact page.
This image fades in, yet because it is invoked by the button click, i cannot get it to ‘fade out’ after a set number of seconds unless you click the ‘submit’ button again!
Any thoughts or ideas on how this can be done?
Appreciate the help!!