This is a circuit I've used, it's very similar to that given by dlloyd. The SFH628 opto actually has two LEDs connected back to back, so I've marked the diode as NNF (not normally fitted). The capacitor provides some protection from ESD and transient voltage spikes on the mains. (Don't be fooled into thinking it will filter the signal by 100nF x 100k, it has 1k in parallel with it, so the effective time constant is just 100us).
Do note that there will be a phase error with any simple circuit like this, because as the a.c. voltage reduces towards zero, the LED current will fall below the opto detection threshold before the a.c. reaches zero. If phase accuracy is important, (and it usually is in ZCD applications), then you will need to determine this using an oscilloscope and correct for it in software.
