n. a court's determination of which parent, relative or other adult should have physical and/or legal control and responsibility for a minor (child) under 18. Child custody can be decided by a local court in a divorce or if a child, relative, close friend or state agency questions whether one or both parents is unfit, absent, dead, in prison or dangerous to the child's well-being. In such cases custody can be awarded to a grandparent or other relative, a foster parent or an orphanage or other organization or institution. While a divorce is pending the court may grant temporary custody to one of the parents, require conferences or investigation (in some states, if the parents cannot agree, custody is automatically referred to a mediator, commissioner or social worker) before making a final ruling. There is a difference between physical custody, which designates where the child will actually live, and legal custody, which gives the custodial person(s) the right to make decisions for the child's welfare. If the parents agree, the court can award joint custody, physical and/or legal. Joint legal custody is becoming increasingly common. The basic consideration on custody matters is supposed to be the best interests of the child or children. In most cases the non-custodial parent is given visitation rights, which may include weekends, parts of vacations and other occasions. The court can always change custody if circumstances warrant.