The respondent shall be permitted to remain in his place of residence pending any examination for certification or diagnostic evaluation. He may be accompanied by one or more of his relatives or friends or by his attorney to the place of examination. If, however, the court finds that it is necessary in order to complete the examination the court may order that the person be admitted to a developmental disabilities facility pending examination and may order a peace officer or other person to transport him there. Whenever possible the examination shall be conducted at a local developmental disabilities facility. No person may be detained for examination for certification for more than 24 hours and for a diagnostic evaluation for more than 7 days.
405 ILCS 5/4-504