I would definitely let them know ASAP if you like the firm, so to give them as much time to recruit someone else. I think the best way to do that is with a quite word with the manager on the side, explain why your leaving and you just want to give as much notice as possible, and you'll formally resign closer to the time. That way there should be no bad blood and if things go tits up with the other place, you may still keep your job. If your not so keen on the firm and arent so worried about them, then wait until you have a job offer, but by the sounds of things you don't want to screw them over?