
6 P.3d 596 (2000)
101 Wash.App. 595
STATE of Washington, Respondent,
v.
L.W., B.D. 10-31-82, Appellant.
No. 44931-1-I.
Court of Appeals of Washington, Division 1.
July 24, 2000.
*597 Harlan Dorfman, David Koch, Nielsen Broman & Assoc., Seattle, for Appellant.
Maureen Howard, Seattle, for Respondent.
AGID, C.J.
Pending disposition of his first degree child rape charge, L.W. was released to a youth group home where he spent over five months subject to constraints upon his freedom similar to those imposed on juveniles placed in an alternative to secure detention. This case presents the question whether a juvenile released into a group home under such conditions must receive credit for pre-disposition time spent there. We agree with the trial court that L.W. was not entitled to credit under these circumstances and affirm.

FACTS
On October 15, 1998, L.W. was charged with first degree child rape. He remained out of custody until a hearing on December 17, when, at the request of his attorney and as an alternative to detention, he was placed in the Graham Street Shelter.[1] The court required L.W. to obey all shelter rules, including having no unsupervised absences from the shelter except to go to school. The court also prohibited him from having unsupervised contact with any children two or more years younger than he and required him to follow all additional rules set by his probation counselor.
The Graham Street Shelter is a youth group home that primarily houses children under the regular custody of the Department of Social and Health Services (DSHS). Unlike the Spruce Street Inn and other similar county group homes, it does not ordinarily provide an alternative to secure detention for juveniles charged with or convicted of crimes. However, the Royal Project, a King County program that provides alternatives to secure detention, does fund a bed at the Graham Street Shelter as a detention alternative. L.W. was placed there as part of this program.
L.W. entered a guilty plea on January 8, 1999, and despite the State's request that he be placed in detention, the trial court again released him to the Graham Street Shelter. This time, because of several incidents at the shelter that raised concerns about his behavior, the court added a condition that if the shelter terminated his residence there, he would immediately go to detention.
*598 At the disposition hearing on May 27, 1999, the trial court denied L.W.'s motion for a Special Sexual Offender Dispositional Alternative (SSODA) under RCW 13.40.160(3), finding that the community would not benefit from his being in community-based treatment. It imposed a standard range disposition of 30 to 40 weeks and rejected L.W.'s request for credit for the five months he had spent at the Graham Street Shelter. The court reasoned that although credit must be given for all time spent in pre-disposition detention under RCW 13.40.160(6), L.W.'s stay at Graham Street was not detention for purposes of the statute. L.W. now appeals both of the trial court's orders.

DISCUSSION

I.
The decision to grant or deny a SSODA lies wholly within the discretion of the trial court, and we review its decision only for abuse of discretion.[2] In deciding whether a SSODA is "appropriate," the court must "consider whether the offender and the community will benefit from use of this special sex offender disposition alternative and consider the victim's opinion whether the offender should receive a treatment disposition under this section."[3]
L.W. contends that the trial court abused its discretion, arguing that it denied the SSODA only because no suitable community placement was available. L.W. is correct that "[a] court may not commit a juvenile to a state institution solely because of the lack of facilities, including treatment facilities, existing in the community."[4] But the record establishes that the trial court explicitly considered several other factors in denying the motion, including the victim's age and vulnerability and the brutal nature of the offense.[5] The court found that, under these circumstances, the community would not benefit from giving L.W. a SSODA. It did not abuse its discretion in making that determination.

II.
L.W. next contends that the trial court erred in failing to award him credit for the time he spent at the Graham Street Shelter which, although not a state-contracted detention facility, appeared to function as one during his stay. Since the trial court's decision turned on an issue of statutory construction, we review it de novo.[6]
RCW 13.40.160(6) provides that, "a juvenile offender is entitled to credit for time spent in detention prior to a dispositional order...." Failure to give credit for time spent in pre-disposition detention violates a juvenile's due process and equal protection rights.[7] Although the Legislature did not define "detention," it clearly meant to award credit for all time spent in physical custody in a detention facility.[8] Detention facilities include not only secure detention, but also several alternative forms of detention, including *599 county group homes.[9] The statute further provides that the decision to take a juvenile into custody is wholly within the discretion of the trial court.[10] If it determines that detention is not necessary, the court must release the juvenile, but it retains wide discretion to fashion and impose appropriate conditions of release.[11]
Here, the trial court exercised that discretion. While L.W. was placed in a group home and subjected to constraints on his freedom, he was on conditional release, not under an order of detention. L.W. argues that awarding credit for time served cannot be based on this distinction because, when the constraints on liberty are identical, the reasons for granting credit for time served, including the right to be free from multiple punishments, are just as significant when a person is released as when he is detained. L.W. concludes that because he would have received credit for time spent at a county group home like the Spruce Street Inn under the Juvenile Justice Act (JJA), he must be awarded credit for the time he spent at the Graham Street Shelter under functionally equivalent circumstances. Finally, L.W. contends that not awarding credit for time spent under identical circumstances treats similarly-situated individuals differently and thus violates the Equal Protection Clause.
We construe statutes "`to ascertain and give effect to the intent of the legislature.'"[12] While the goals of the adult Sentencing Reform Act (SRA) are overwhelmingly punitive, the goals of the JJA are "more complex,"[13] reflecting an intent to protect community safety while also responding to the needs of juvenile offenders. The statute "attempts to tread an equatorial line somewhere midway between the poles of rehabilitation and retribution."[14] When, as here, we are resolving a dispute that rests on the JJA's legislative intent, we must ensure that our decision "effectuates to the fullest possible extent"[15] its dual purposes.
In order to properly balance these interests, trial courts must be permitted to fashion a broad range of pre- and post-disposition options for juvenilesoptions that are not necessary to effectuate the more limited punitive purposes of the SRA. Recognizing this, the JJA explicitly gives trial courts wide discretion, including discretion to detain the juvenile, and if detention is not necessary, to release him or her with a wide variety of conditions.[16] A statutory construction like the "functionally-equivalent" analysis L.W. urges us to adopt would severely undermine the trial court's ability to impose appropriate conditions upon a juvenile's pre-disposition release while retaining the ability to fashion appropriate post-disposition options. If a juvenile gets credit for time spent in pre-disposition release, the trial court's post-disposition options will be too limited because most of the short detention time authorized by the JJA will be consumed by pre-disposition credit, even though it is not spent in detention. This is contrary not only to the explicit language of the JJA but also to its purposes, which require a flexible system of *600 pre- and post-disposition options for treating and educating juvenile offenders.
Credit for time served is always in the best interests of an adult offender, for it means simply serving less time in prison. But, it is often not in the best interests of a juvenile offender. Because of the JJA's rehabilitative purposes, disposition time often means time spent in treatment programs or facilities specifically set up to assist troubled juveniles in working through their problems and addictions. Many of these programs are available only after disposition. Giving credit for time spent in conditions other than those defined as detention would severely limit the trial court's ability to use these facilities to benefit juveniles who need them because, without a manifest injustice sentence, the time needed for a rehabilitation program would have already been counted as part of pre-disposition release.
This is a case in point. The trial court kept L.W. out of detention and on release status for the express purpose of ensuring that his post-disposition sentence would be productive; that is, time spent in treatment. Trial courts also often have other compelling reasons to conditionally release juveniles instead of placing them in detention, such as keeping a child accused of a relatively minor offense away from more dangerous juveniles or, as here, to allow him to accumulate evidence of good behavior to support a SSODA or a manifest injustice disposition below the standard range. Broadening the scope of credit for time served to include conditional release as L.W. urges would not benefit the community or many of the juvenile offenders and would be contrary to the rehabilitative purpose of the JJA.[17]
The functional equivalent rule has recently been rejected in the adult context as well. In State v. Vasquez,[18] Division III of this court held that an adult defendant was not entitled to credit against his sentence for time spent under house arrest. It rejected his argument that the credit was required by statute because house arrest is functionally indistinguishable from electronic home monitoring for which defendants receive credit.[19] In Reno v. Koray,[20] the United States Supreme Court also rejected the functional equivalent test. It held that an adult defendant who had spent time at a community treatment center under conditions significantly curtailing his liberty while "released" on bail was not entitled to credit for time served under the relevant statute requiring credit for time spent under "official detention."[21] The Court reversed the Third Circuit Court of Appeals which, employing the functional equivalent analysis, had held that time should be credited whenever the defendant was in "`jail-type confinement.'"[22]
Even if we were to adopt L.W.'s functional equivalent analysis, his time in the shelter was distinguishable from that spent in a detention facility such as the Spruce Street Inn. Accepting that those "released" could under some circumstances be subject to constraints upon their liberty identical to those "detained," the fact remains that those detained remain in physical custody while those released, by definition, do not. This distinction is crucial. A person is guilty of escape in the second degree if "[h]e escapes *601 from a detention facility"[23] or "[h]aving been charged with a felony or an equivalent juvenile offense, he escapes from custody."[24] Thus, while a detained juvenile who escapes from a county group home detention facility could be convicted of escape in the second degree, a juvenile who has been released could not, regardless of the release conditions. While the constraints upon the juvenile's liberty may be superficially equivalent, the penalty for violating those constraints is substantially different.
L.W. disagrees, arguing that he could have been convicted of second degree escape had he left the shelter without permission. Neither statutory nor case law authority supports his position. JuCR 7.3, which governs the procedure for dealing with juveniles who violate their conditions of release, does not mention charges under other criminal statutes. Rather, it provides that although juveniles may be arrested, taken into custody and detained, they are also entitled to a prompt detention hearing during which the trial court must decide whether detention is necessary. If not, the juvenile must be released again.[25] Even if he could have been arrested for leaving the shelter, L.W. still could not have been convicted of escape for doing so. The Graham Street Shelter is not a detention facility. It is a group care facility[26] that provided foster care[27] to L.W. pending his disposition.[28]
Nor was L.W. in custody, and his reliance on State v. Ammons[29] to establish that he was is misplaced. Although dicta in that case implies that custody, defined as "restraint pursuant to a lawful arrest or an order of a court,"[30] is to be given a broad interpretation, the holding actually supports our decision here. The Ammons court concluded that a defendant who failed to report for a work crew could be convicted of escape because defendants on work crews are under restraint pursuant to an order of a court. Unlike the Ammons defendants, L.W. was not under an order of restraint by a court. On the contrary, he was explicitly released. Because a violation of his conditional release could not have been the basis for a criminal escape charge, L.W. is not similarly situated to those who are detained or in custody and to whom credit for time served must be given.
L.W.'s final argument is that not awarding credit for time spent in the functional equivalent of detention violates the Equal Protection Clause. Because L.W.'s argument implicates neither a fundamental right nor a suspect or semi-suspect class, the challenged statute must merely satisfy the rational basis test to comport with the Equal Protection Clause.[31] That is, "the law must be rationally related to a legitimate state interest, and will be upheld unless the classification rests on grounds wholly irrelevant to the achievement of a legitimate state objective."[32] Here, as the discussion above establishes, there are substantial distinctions between those detained under a court order *602 and those on conditional release. Moreover, the legitimate state interests are clear: The JJA is designed to protect community safety and respond to the needs of juvenile offenders. The trial judge's decision to detain one individual to ensure community safety and conditionally release another to ensure that, as here, the juvenile will have adequate opportunity to receive post-disposition treatment is an appropriate exercise of discretion that comports with the legitimate purposes of the JJA. Decisions based on the facts of each case and the circumstances of each juvenile are crucial to ensuring that the trial court's decisions further these goals. Awarding credit for time in detention but not for its functional equivalent does not violate equal protection.
Affirmed.
KENNEDY, J., and BECKER, J., concur.
NOTES
[1]  The alleged victim lived with L.W.'s parents, so home placement was not an option.
[2]  State v. J.W., 84 Wash.App. 808, 929 P.2d 1197 (1997). A standard range disposition can only be appealed if the trial court committed a procedural error. See id. at 811, 929 P.2d 1197. As a preliminary matter, L.W. and the State disagree about whether L.W. can appeal his sentence. Because we reject L.W.'s SSODA argument on the merits, we do not address that issue.
[3]  RCW 13.40.160(3).
[4]  RCW 13.40.150(5).
[5]  The court stated:

When I weigh her particular vulnerability against the lack of criminal history and the way that the offense was committed and the lack of assurance I can give to the public that there is community-based treatment....
I'm satisfied that because of the legal issue involved [whether the court had the authority to force DSHS to provide an appropriate treatment placement], I cannot order a SODA [sic] in this case. I've tried to weigh the discretion [sic] and take into consideration all these factors, but I can't assure the public that it would be protected. I can't make a finding under the facts ... that the community would benefit....
[6]  See, e.g., State v. Azpitarte, 140 Wash.2d 138, 140, 995 P.2d 31 (2000).
[7]  See In re Trambitas, 96 Wash.2d 329, 635 P.2d 122 (1981).
[8]  See RCW 13.40.020(5).
[9]  A detention facility is: "[A] county facility, paid for by the county, for the physical confinement of a juvenile alleged to have committed an offense or an adjudicated offender subject to a disposition or modification order. `Detention facility' includes county group homes, inpatient substance abuse programs, juvenile basic training camps, and electronic monitoring[.]" RCW 13.40.020(9). Time spent in all such facilities must be credited against the final disposition. See, e.g., State v. Eugene W., 41 Wash.App. 758, 706 P.2d 235 (crediting time for Blue Mountain Boy's Ranch), review denied, 104 Wash.2d 1025 (1985); State v. Ashbaker, 82 Wash.App. 630, 919 P.2d 619 (1996) (crediting time for electronic monitoring).
[10]  See RCW 13.40.040.
[11]  See RCW 13.40.050.
[12]  Janovich v. Herron, 91 Wash.2d 767, 771, 592 P.2d 1096 (1979) (quoting Strenge v. Clarke, 89 Wash.2d 23, 29, 569 P.2d 60 (1977)).
[13]  State v. Rice, 98 Wash.2d 384, 392, 655 P.2d 1145 (1982).
[14]  Id. at 393, 655 P.2d 1145.
[15]  Id. at 394, 655 P.2d 1145.
[16]  Among the conditions statutorily contemplated are placing the juvenile in the custody of another, including DSHS, and imposing constraints on the juvenile's travel. See RCW 13.40.050(6); RCW 13.40.050(7).
[17]  The functional equivalent analysis L.W. advocates would also require trial courts to engage in a factual inquiry in every case of pretrial release to determine whether the conditions imposed upon the defendant were actually the same as those in one of the alternatives to secure detention. It is not only difficult to precisely define "functionally similar," but also to provide helpful guidelines for applying the concept. Confusion over its meaning could create a rule that is either overly broad, converting all youth group homes into de facto detention facilities, or overly narrow, encompassing none.
[18]  75 Wash.App. 896, 881 P.2d 1058 (1994), review denied, 126 Wash.2d 1005, 891 P.2d 38 (1995).
[19]  Cf. State v. Speaks, 119 Wash.2d 204, 829 P.2d 1096 (1992) (crediting time to adults for electronic monitoring); Ashbaker, 82 Wash.App. at 633, 919 P.2d 619 (crediting time to juveniles for electronic monitoring).
[20]  515 U.S. 50, 115 S.Ct. 2021, 132 L.Ed.2d 46 (1995).
[21]  18 U.S.C.A. § 3585(b).
[22]  Koray, 515 U.S. at 54, 115 S.Ct. 2021.
[23]  RCW 9A.76.120(1)(a).
[24]  RCW 9A.76.120(1)(b).
[25]  Under JuCR 7.3, a juvenile who violates a conditional release order may be taken into custody and held in detention either before or after a motion to modify the conditional release order is filed. In either case the juvenile is entitled to a prompt detention hearing.
[26]  A group care facility is "an agency, other than a foster-family home, which is maintained and operated for the care of a group of children on a twenty-four hour basis." RCW 74.15.020(1)(g).
[27]  Foster care is "temporary physical care in a foster family home or group care facility as defined in RCW 74.15.020 and licensed by the department [DSHS], or other legally authorized care[.]" RCW 13.40.020(11).
[28]  The fact that L.W. was placed at the shelter as part of the Royal Project is irrelevant; L.W. was not there under an order of detention, and that remains dispositive.
[29]  136 Wash.2d 453, 963 P.2d 812 (1998).
[30]  RCW 9A.76.010.
[31]  State v. Coria, 120 Wash.2d 156, 169, 839 P.2d 890 (1992). See also State v. Schaaf, 109 Wash.2d 1, 19, 743 P.2d 240 (1987) (holding that juveniles form neither a suspect nor semi-suspect class for equal protection purposes).
[32]  DeYoung v. Providence Med. Ctr., 136 Wash.2d 136, 144, 960 P.2d 919 (1998).
