http://divorce-probate-mediation-nashville-tennessee.com/probate-willsestate/involuntary-committal/
The article here has the law for involuntary commital in NY. Here in Texas there are several State hospitals. Budget cuts are bad all over, but it's pretty clear what it takes to get a person commited for up to 28 days.
It is sad that the jails are full of folks busted for smoking weed, when a lot of the overcrowding could be relieved to make room for dangerous criminals, and the mental facilities could get more funding, if it didn't all got to jails.
On a side note, I had a doctor tell me that the only solution for one of my foster kids was jail, before he killed too many people. The child was 11, and diagnosed with schizoid disorder.