(b) A child taken into custody may be detained prior to hearing on the petition only if:
1. the child is likely to abscond or be removed from the court's jurisdiction;
2. suitable supervision, care, or protection for the child is not being provided by a parent, guardian, custodian, or other person;
3. the child has no parent, guardian, custodian, or other person able to return the child to the court when required;
4. the child may be dangerous to himself or herself or the child may threaten the safety of the public if released;
5. the child has previously been found to be a delinquent child or has previously been convicted of a penal offense punishable by a term in jail or prison and is likely to commit an offense if released; or
6. the child's detention is required under subsection (f), below.
(c) If the child is not released, a request for detention hearing shall be made and promptly presented to the court, and an informal detention hearing shall be held promptly, but not later than the second working day after the child is taken into custody. If the child is taken into custody on a Friday or Saturday, then the detention hearing shall be held on the first working day after the child is taken into custody.
(d) A release of a child to an adult must be conditioned on the agreement of the adult to be subject to the jurisdiction of the juvenile court and to an order of contempt by the court if the adult, after notification, is unable to produce the child at later proceedings.
(e) If a child being released under this section is expelled from school in a county with a population greater than 125,000, the release shall be conditioned on the child's attending a juvenile justice alternative education program pending a deferred prosecution or formal court disposition of the child's case.
(f) A child who is alleged to have engaged in delinquent conduct and to have used, possessed, or exhibited a firearm in the commission of the offense shall be detained until the child is released at the direction of the judge of the juvenile court, a substitute judge, or a referee appointed, including an oral direction by telephone, or until a detention hearing is held.