Checking for flash

I need some code that when a web user goes to my homepage will check for flash (say version 5). I need it to do the following when the page tries to load:

Check for flash
if flash is installed then just load the regular flash site
if flash is NOT installed then go to a different page which will tell the user that they need flash to view the site with a link to install flash.

Can anyone help?

Thanks