A two-level pattern trigger for the MAGIC telescope