hi, anyone can help me on how to match pictures using javascript

bird-------------> seeds
cat-------------> milk

so if we consider above there are four images(bird, seeds, cat, milk, for sake of convenience i am just writing names as it wil b easy to understand what i am trying to say),

As birds feed on seeds and cat on milk. we need to match those pictures in javascript like this

if we click on bird and then on seeds it should say "correct match" and both images needs to vanish else "not correct match and try again"

if we click on cat and then on milk it should say "correct match" and both images needs to vanish else "not correct match and try again"

after all are matched correctly we need to redirect to homepage...

any help
regards