Complete thumbnail click handler function.