There are many scripts available on the internet.
This one was found at DHTMLCentral.com