I. Following arraignment a minor alleged to be delinquent may be ordered by the court to be:
      (a) Retained in the custody of a parent, guardian, or custodian; or
      (b) Released in the supervision and care of a relative or friend; or
      (c) Released to the custody of the department of health and human services for placement in a foster home, as defined in RSA 169-C:3, XIII, a group home, a crisis home, or a shelter care facility with expenses charged according to RSA 169-B:40; or
      (d) [Repealed.]
      (e) Detained at a facility certified by the commissioner of the department of health and human services for detention of minors pursuant to the following:
         (1) No minor charged with delinquency shall be securely detained following arraignment unless the prosecution establishes probable cause to believe that the minor committed the alleged delinquent acts and unless the prosecution demonstrates by clear and convincing evidence the need for secure detention, based upon the criteria for secure detention specified in subparagraph (e)(2);
         (2) A minor shall not be securely detained unless secure detention is necessary:
            (A) To insure the presence of the juvenile at a subsequent hearing; or
            (B) To provide care and supervision for a minor who is in danger of self-inflicted harm when no parent, guardian, custodian, or other suitable person or program is available to supervise and provide such care; or
            (C) To protect the personal safety or property of others from the probability of serious bodily harm or other harm.
   II. The adjudicatory hearing shall be held within 21 days of arraignment for minors detained pending such hearing and within 30 days of arraignment for minors not detained. An extension of these time limits may be permitted, upon a showing of good cause, for an additional period not to exceed 14 calendar days.
   II-a. After arraignment, the court shall determine if the legally liable school district shall be joined pursuant to RSA 169-B:22.
   III. All orders issued pursuant to this section shall set forth findings in writing and may be subject to such conditions as the court may determine.