Functional capacity and associated factors in community-dwelling and institutionalized elderly