Whenever a parent, guardian, or person in loco parentis requests the discharge of a minor admitted under Section 3-503 or 3-504, the minor shall be discharged at the earliest appropriate time, not to exceed 5 days to the custody of such person unless within that time the minor, if he is 12 years of age or older, or the facility director objects to the discharge in which event he shall file with the court a petition for review of the admission accompanied by 2 certificates prepared pursuant to paragraph (c) of Section 3-507.
405 ILCS 5/3-508