Section 31. For the purposes of this section, the following words shall have the following meaning unless the context requires otherwise:
''Sole legal custody'', one parent shall have the right and responsibility to make major decisions regarding the child's welfare including matters of education, medical care and emotional, moral and religious development.
''Shared legal custody'', continued mutual responsibility and involvement by both parents in major decisions regarding the child's welfare including matters of education, medical care and emotional, moral and religious development.
''Sole physical custody'', a child shall reside with and be under the supervision of one parent, subject to reasonable visitation by the other parent, unless the court determines that such visitation would not be in the best interest of the child.
''Shared physical custody'', a child shall have periods of residing with and being under the supervision of each parent; provided, however, that physical custody shall be shared by the parents in such a way as to assure a child frequent and continued contact with both parents.
In making an order or judgment relative to the custody of children, the rights of the parents shall, in the absence of misconduct, be held to be equal, and the happiness and welfare of the children shall determine their custody. When considering the happiness and welfare of the child, the court shall consider whether or not the child's present or past living conditions adversely affect his physical, mental, moral or emotional health.
Upon the filing of an action in accordance with the provisions of this section, section twenty-eight of this chapter, or section thirty-two of chapter two hundred and nine and until a judgment on the merits is rendered, absent emergency conditions, abuse or neglect, the parents shall have temporary shared legal custody of any minor child of the marriage; provided, however, that the judge may enter an order for temporary sole legal custody for one parent if written findings are made that such shared custody would not be in the best interest of the child. Nothing herein shall be construed to create any presumption of temporary shared physical custody.
In determining whether temporary shared legal custody would not be in the best interest of the child, the court shall consider all relevant facts including, but not limited to, whether any member of the family abuses alcohol or other drugs or has deserted the child and whether the parties have a history of being able and willing to cooperate in matters concerning the child.
If, despite the prior or current issuance of a restraining order against one parent pursuant to chapter two hundred and nine A, the court orders shared legal or physical custody either as a temporary order or at a trial on the merits, the court shall provide written findings to support such shared custody order.
There shall be no presumption either in favor of or against shared legal or physical custody at the time of the trial on the merits, except as provided for in section 31A.
At the trial on the merits, if the issue of custody is contested and either party seeks shared legal or physical custody, the parties, jointly or individually, shall submit to the court at the trial a shared custody implementation plan setting forth the details of shared custody including, but not limited to, the child's education; the child's health care; procedures for resolving disputes between the parties with respect to child-raising decisions and duties; and the periods of time during which each party will have the child reside or visit with him, including holidays and vacations, or the procedure by which such periods of time shall be determined.
At the trial on the merits, the court shall consider the shared custody implementation plans submitted by the parties. The court may issue a shared legal and physical custody order and, in conjunction therewith, may accept the shared custody implementation plan submitted by either party or by the parties jointly or may issue a plan modifying the plan or plans submitted by the parties. The court may also reject the plan and issue a sole legal and physical custody award to either parent. A shared custody implementation plan issued or accepted by the court shall become part of the judgment in the action, together with any other appropriate custody orders and orders regarding the responsibility of the parties for the support of the child.
Provisions regarding shared custody contained in an agreement executed by the parties and submitted to the court for its approval that addresses the details of shared custody shall be deemed to constitute a shared custody implementation plan for purposes of this section.
An award of shared legal or physical custody shall not affect a parent's responsibility for child support. An order of shared custody shall not constitute grounds for modifying a support order absent demonstrated economic impact that is an otherwise sufficient basis warranting modification.
The entry of an order or judgment relative to the custody of minor children shall not negate or impede the ability of the non-custodial parent to have access to the academic, medical, hospital or other health records of the child, as he would have had if the custody order or judgment had not been entered; provided, however, that if a court has issued an order to vacate against the non-custodial parent or an order prohibiting the non-custodial parent from imposing any restraint upon the personal liberty of the other parent or if nondisclosure of the present or prior address of the child or a party is necessary to ensure the health, safety or welfare of such child or party, the court may order that any part of such record pertaining to such address shall not be disclosed to such non-custodial parent.
Where the parents have reached an agreement providing for the custody of the children, the court may enter an order in accordance with such agreement, unless specific findings are made by the court indicating that such an order would not be in the best interests of the children.