Adding click listener for thumbnail images