There's a knock at the door of John and Janet Henry's home in Pacifica and the family dog, Cookie, whirls into action. She scampers to the front door, runs back to the Henrys, jumps on them, bounces back and forth until the visitor is let in. Cookie seems the stereotype of the undertrained, overnervous animal, and probably spoiled rotten.

In fact, she is precisely the reverse. Cookie is a hearing dog, painstakingly taught to alert the Henrys, who are both deaf, to usual sounds, like a knock at the door, and unusual noises, like a prowler. She was trained at the Hearing Dog Center of the San Francisco Society for the Prevention of Cruelty to Animals -- the first such training center in the country. So far, four dogs have been placed in homes in San Francisco and San Diego, and head trainer Ralph Dennard hopes to place 40 more in California this year.

The hearing dog program is one of those rare situations where it seems all parties come out as winners. The deaf person gains a loving and useful companion; the dog, picked off the street or abandoned at a shelter, is assured a home.

The program evolved from a study done by the Minnesota SPCA four years ago, although Dennard points out that "the idea came from the deaf themselves, who long ago learned to watch their dogs." Two years ago, the American Humane Association in Denver took over and developed a pilot program. Eventually, according to Richard Azanziono, executive vice president of the San Francisco SPCA, it is hoped there will be training centers across the country.

Cookie, the Henrys' dog, is between 18 months and 2 years old. Her early history is unknown. "We think she is a pointer mix -- we are not exactly sure," Dennard says. "She is typical of a lot of dogs available for adoption."

Hearing dogs are chosen from abandoned dogs at SPCA shelters. Cookie was picked up as a stray last June. The dogs have to be between 6 and 18 months old, have the right temperament, be intelligent and healthy. They get complete medical examinations and are given all vaccinations. Male dogs are neutered and female dogs spayed. Training takes about four months. It starts with modified obedience training, the dogs learning to respond to voice command and hand signals. "Many of the recipients will only use sign language," Dennard points out.

Next the dogs work out in the training center, fitted out like a home, with sofas, beds, a crib, a kitchen and a telephone-teletype system, which many deaf people use. From a remote control panel, the trainer is able to set off all the sounds to which the dog must learn to respond -- a doorbell or knock, smoke alarm, telephone, a baby's cry. Cookie, for example, was taught to jump on the bed and lick Dennard's face when a smoke alarm sounded. "This is one of the few jobs where you get to stay in bed half the day, while you train the dog," Dennard says.

After the dog is placed, a trainer makes several home visits to work with dog and master and settle any difficulties.

The hearing dogs are expected to alert their owners to unusual noises, which Dennard acknowledges covers a lot of ground. But he says, "A dog is curious about what is happening around his territory and naturally will alert you to strange sounds." He recalls one he trained, while he was learning the techniques of working with hearing dogs in Denver, tha kept waking his owner at 6:30 a.m., an hour and a half too early. Then it was realized the dog was reacting to a paper boy crossing the lawn. The animal was retrained.

Training costs about $2,500 per dog but hearing dogs are given free to the deaf. They are taken care of in the SPCA's veterinary program for $2 a visit, no matter the problem. The program is supported by the dues, donations and gifts of the SPCA's members and others.

Dennard points out that hearing dogs take the place of mechanical aids available to the more affluent deaf. He explains: "There are bed-shakers (which act as alarm clocks). It is possible to have the whole house wired to flash when the doorbell rings."

But mechanical devices, besides being expensive, are only as good as the human in control, as John and Janet Henry learned recently. The Henrys have a baby daughter, Elizabeth, 19 months old, and had rigged up a speaker that activates a light in their room if she cries in the night. One night, though, they forgot to turn it on. At 2 a.m. Elizabeth, who had a chest cold, woke up struggling to breathe. She was, her father says, "coughing and turning blue. The dog woke us -- she jumped up on the bed and woke us. Cookie can tell the difference between regular cries and more important ones. She can sense the danger."

Hearing dogs are made available to those with severe or profound deafness, 18 years old and over, who do not have hearing people living with them. Deaf people caring for infants are a priority group.

The Henrys have both been deaf since birth. Janet Henry recalls that after Elizabeth was born "someone came into the room to nail something on the wall and I saw the baby cry at the noise." With relief she realized her daughter was not deaf.

Mrs. Henry works as a medical technologist in San Francisco; her husband as a fiberglass specialist in San Jose. A neighbor looks after Elizabeth during the day.

The Henrys, as other applicants, were not allowed to select a specific dog from among those being trained, although they could specify what size dog they wanted. Dennard says, "People think of a German shepherd when they think of a service dog, but for this program there are no requirements as to size or breed. All that is necessary is that the dog is alert, friendly, resilient enough to undergo the stress of the training and has a temperament and character to be willing to be trainable. Personally, I like them to be frisky and energetic (rather than placid). They have to like a lot of people."

Cookie has all these virtues, plus patience: As Dennard talks, Elizabeth sits on a resting Cookie, twiddles her tail, flicks her ear, then sticks a fist in the dog's mouth. Cookie sneezes and slides away.

Janet Henry says she had a dog when she was a child "but I didn't like him. I like Cookie, though." Her husband says that although he's had dogs all his life he had never trained one before -- "Well, maybe I taught him 'roll over'." Elizabeth climbs back onto Cookie and pulls her tail.

After a dog is placed, the trainer spends some time working with the new owner and the dog at home to iron out any problems. "The most difficult part is making the new owner an effective trainer," Dennard says. "We have to transfer authority to the new masters. We show them how to correct what they are doing if the dog is obviously not responding. We try to teach the recipients to go on training the dog. They are required to set off the smoke alarm, for example, once a week. Dogs are not little machines."

John Henry says he has plans for teaching Cookie new tricks. "I'll teach her to lead me to Elizabeth if Elizabeth is crying and I cannot find her, maybe by playing hide and seek," he says. "But we want the dog to become adjusted to our home first."

Elizabeth trots back into the room carrying a bottle of hand lotion, a "hint" she would like a bottle of milk. She sports Cookie lying at her father's feet, pulls the dog's tail and squeals with joy. Cookie patiently pushes the baby away with her nose, again.