N.Y.C. Buildings Chief Resigns as Prosecutors Examine Gambling Ties