(a) In an action involving a question of the custody, support, or visitation of a child, the court may, upon the motion of a party to the action or upon its own motion, appoint an attorney or the office of public advocacy to represent a minor with respect to the custody, support, and visitation of the minor or in any other legal proceeding involving the minor's welfare or to represent an unmarried 18-year-old child with respect to post-majority support while the child is actively pursuing a high school diploma or an equivalent level of technical or vocational training and living as a dependent with a parent or guardian or a designee of the parent or guardian. When custody, support, or visitation is at issue in a divorce, it is the responsibility of the parties or their counsel to notify the court that such a matter is at issue. Upon notification, the court shall determine whether the minor or other child should have legal representation or other services and shall make a finding on the record before trial. If the parties are indigent or temporarily without funds, the court shall appoint the office of public advocacy. The court shall notify the office of public advocacy if the office is required to provide legal representation or other services. The court shall enter an order for costs, fees, and disbursements in favor of the state and may further order that other services be provided for the protection of the minor or other child.
(b) If custody, support, or visitation is at issue, the order for costs, fees, and disbursements shall be made against either or both parents, except that, if one of the parties responsible for the costs is indigent, the costs, fees, and disbursements for that party shall be borne by the state. If the parents are only temporarily without funds, the office of public advocacy shall provide legal representation or other services required by the court. The attorney general is responsible for enforcing collections owed the state. Repayment shall be made to the Department of Revenue under AS 37.10.050 for deposit in the general fund. The court shall, if possible, avoid assigning costs to only one party by ordering that costs of the minor's legal representation or other services be paid from proceeds derived from a sale of joint, community, or individual property of the parties before a division of property is made.
(c) Instead of, or in addition to, appointment of an attorney under (a) of this section, the court may, upon the motion of either party or upon its own motion, appoint an attorney or other person or the office of public advocacy to provide guardian ad litem services to a child in any legal proceedings involving the child's welfare. The court shall require a guardian ad litem when, in the opinion of the court, representation of the child's best interests, to be distinguished from preferences, would serve the welfare of the child. The court in its order appointing a guardian ad litem shall limit the duration of the appointment of the guardian ad litem to the pendency of the legal proceedings affecting the child's interests, and shall outline the guardian ad litem's responsibilities and limit the authority to those matters related to the guardian's effective representation of the child's best interests in the pending legal proceeding. The court shall make every reasonable effort to appoint a guardian ad litem from among persons in the community where the child's parents or the person having legal custody or guardianship of the child's person reside. When custody, support, or visitation is at issue in a divorce, it is the responsibility of the parties or their counsel to notify the court that such a matter is at issue. Upon notification, the court shall determine if a child's best interests need representation or if a minor or other child needs other services and shall make a finding on the record before trial. If one or both of the parties is indigent or temporarily without funds the court shall appoint the office of public advocacy. The court shall notify the office of public advocacy if the office is required to provide guardian ad litem services. The court shall enter an order for costs, fees, and disbursements in favor of the state and may further order that other services be provided for the protection of a minor or other child.