The circuit court has jurisdiction under this Chapter over persons not charged with a felony who are subject to involuntary admission. Inmates of penal institutions shall not be considered as charged with a felony within the meaning of this Chapter. Court proceedings under Article VIII of this Chapter may be instituted as to any such inmate at any time within 90 days prior to discharge of such inmate by expiration of sentence or otherwise, and if such inmate is found to be subject to involuntary admission, the order of the court ordering hospitalization or other disposition shall become effective at the time of discharge of the inmate from penal custody. The circuit court has jurisdiction over all persons alleged to be in need of treatment under Section 2-107.1 of this Code, whether or not they are charged with a felony.
405 ILCS 5/3-100