It was a madhouse in City Hall courtroom 676 today.

There began day one of a court pilot program to help financially troubled homeowners avoid foreclosure by talking - talking directly to the lawyers who represent lenders and working out deals, on the spot, to begin paying regularly or to give up and move on.

Gone was the usual silent, churchlike decorum, replaced instead with knots of lawyer volunteers conferring in corners with brand-new clients, ever-growing stacks of files piled precariously on tables, mortgage lawyers answering calls on cell phones, and dazed-looking homeowners hoping that out of all the chaos would emerge a way for them to keep foreclosed homes that had been destined for a sheriff's sale.

And it will continue tomorrow and the rest of the week.

Housing advocates around the nation say Philadelphia's program is among the most innovative they've seen, because it involves the court, consumer advocates and mortgage lawyers.

"I was surprised at the showing," said Common Pleas Court Judge Anita Rizzo, who is part of the judicial muscle behind the program. "We can't save every home, but if we save one, it'll be worth it."

Rizzo had formed a committee of housing advocates and mortgage lawyers after a foreclosure crisis in 2004. Members continued to meet and developed the pilot. President Judge Darnell Jones 2d crafted the legal framework.

Today, Rizzo enlisted nearly a dozen lawyers to serve as temporary judges. Working out of nearby conference rooms, they were dispatched to strong-arm, in a nice way, both sides into working out a deal.

In theory, the Residential Mortgage Foreclosure Diversion Pilot is supposed to work like this:

Under court order, no house can be sent to a sheriff's sale without the owner-occupant's having an opportunity to have a court-sponsored conciliation session.

Before that session, the homeowner must take part in a free housing-counseling session to draw up a reasonable proposal to present to the mortgage company. If the counselor cannot work out a deal, then the borrower and advocates for the borrower and lender appear at a conciliation session before a temporary judge.

If it doesn't work, a full-time judge like Rizzo may get involved. Or, ultimately, the homes can move to sheriff's sale.

That's how it will work, Rizzo promises, once the backlog is cleared out.

But the program already started to work for Charles and Shanazz Dabydeen of Northeast Philadelphia.

Their three-bedroom rowhouse had been scheduled for sheriff's sale next month, but lawyer volunteer Eric Vath and a lawyer representing their lender negotiated another month for the couple to work out a deal.

"We want to make the payments," Shanazz Dabydeen said today.

A car accident in 2006 put her out of work as a nanny and injured her two children. He lost days as a body-shop worker caring for them. Then, in September, a car accident sidelined him. Now he's beginning to work. She hopes to start soon.

They are months behind on two mortgages, including one with 22 percent interest. "We stress out all the time over this," she said.

In March, at City Council's urging, Sheriff John D. Green stayed April's foreclosure sales. Judge Jones stayed the May, June and July sales.

Another session is scheduled for August to handle more cases and leftovers from this session, including the Dabydeens' situation.

More than 160 cases were on today's calendar. About a third of the homeowners showed up, some without the required counseling. They were funneled immediately to counselors. Many others were walk-ins.

Despite glitches, there was a sense of purpose. About three dozen lawyer volunteers signed up to represent the borrowers. Longtime housing advocates, such as Philadelphia Unemployment Project director John Dodds, helped to move the process along.

Lenders also have an incentive to deal.

"Clearly, we can't take an owner-occupied house to sheriff's sale without going through this," said Rizzo committee member Michael T. McKeever, of Goldbeck, McCafferty & McKeever, a Philadelphia law firm that represents lenders.

McKeever said his clients lost money with every foreclosure. "In a declining market, the losses get bigger."

He applauds the forced conciliation sessions because they require both sides to work out a deal more quickly. "The longer they are in default, the harder it is for them to pay," he said, and the more money the lenders lose.

Contact staff writer Jane M. Von Bergen at 215-854-2769 or jvonbergen@phillynews.com.