The construction, acquisition and maintenance of juvenile detention facilities for dependent, wayward and delinquent children, separate and apart from the detention facilities for adults, is hereby declared to be a mandatory function of the several counties of the state.