In any county or group of counties the county boards may purchase, lease, erect, equip, and maintain a detention home for boys and girls, or a separate detention home for boys and girls, or a separate detention home for boys or a separate detention home for girls. The detention home may, with the approval of the district court judges in counties now or hereafter having a population of more than 200,000 or of the juvenile court judges in all other counties be a separate institution, or it may be established and operated in connection with a county home school or any organized charitable or educational institution. However, the plans, location, equipment, and operation of the detention home shall in all cases have the approval of the judges. Necessary staff shall be appointed and removed by the judges. The salaries of the staff shall be fixed by the judges, subject to the approval of the county boards. The county board of each county to which this section applies shall provide the necessary funds to carry out the provisions of this section.