At the end of any detention period ordered by the court under this chapter, the respondent shall be discharged unless a petition for further detention is filed and heard in the same manner as provided herein. Successive one-year detention periods, or successive one hundred eighty-day outpatient detention periods, are permissible on the same grounds and pursuant to the same procedures as the initial detention period. No order of civil detention under this chapter may exceed one year for an inpatient detention period or one hundred eighty days for an outpatient detention period.